Skip to main content

Standalone IBM MQ adapter for FastStream

Project description

faststream-mq

CI Connected IBM MQ tests Docs PyPI Python versions

Standalone IBM MQ adapter for FastStream.

faststream-mq is an early standalone adapter extracted from pending FastStream IBM MQ work. It is already used in production, but still tracks upstream FastStream work closely. If equivalent IBM MQ support is accepted upstream, this package will be deprecated in favor of upstream FastStream.

Install

pip install faststream-mq

Real IBM MQ connections require IBM MQ native C client libraries. For IBM MQ 9.4 redistributable clients, native runtime support is available on Linux x86-64 and Windows x64. The package remains installable on other platforms so TestMQBroker and non-connected tests can run without native MQ libraries.

Optional integrations:

pip install "faststream-mq[fastapi]"
pip install "faststream-mq[otel]"
pip install "faststream-mq[prometheus]"
pip install "faststream-mq[all]"

Quick start

from faststream import FastStream
from faststream_mq import MQBroker

broker = MQBroker(queue_manager="QM1")
app = FastStream(broker)


@broker.subscriber("DEV.QUEUE.1")
async def handle(message: str) -> None:
    print(message)

Run a local IBM MQ broker with Docker Compose:

docker compose up -d ibmmq

Migration from the pending FastStream PR

The standalone adapter intentionally uses faststream_mq as its canonical import package.

# Before
from faststream.mq import MQBroker, TestMQBroker

# After
from faststream_mq import MQBroker, TestMQBroker

There is intentionally no faststream.mq compatibility shim. A standalone package cannot safely inject a submodule into the non-namespace faststream package. See the migration guide for project migration details.

Development

This repository uses uv, uv_build, ruff, ty, and prek.

Install the IBM MQ client SDK first when you need real MQ runtime support on a Supported MQ Client Platform; the ibmmq Python package needs the MQ C headers to build. See the IBM MQ Client SDK docs for details and troubleshooting.

MQ_FILE_PATH="$HOME/.local/opt/mqm" ./scripts/install-mq-client.sh
export MQ_FILE_PATH="$HOME/.local/opt/mqm"
export LD_LIBRARY_PATH="$MQ_FILE_PATH/lib64:$LD_LIBRARY_PATH"

uv sync --all-extras --group dev
uv run prek install
uv run ruff format
uv run ruff check
./scripts/ty-check.sh
uv run pytest
uv run --only-group docs mkdocs build --strict

Connected IBM MQ tests require the local MQ services and a successful client-connectivity probe. See the connected testing docs for details and troubleshooting.

docker compose up -d ibmmq ibmmq_ha2
uv run python scripts/wait-mq-ready.py "127.0.0.1(1414)" "127.0.0.1(1415)"
uv run pytest -m connected

Documentation

Documentation is built with MkDocs using the docs uv dependency group. Read the Docs can build the site from .readthedocs.yaml without a separate requirements.txt.

uv sync --only-group docs
uv run --only-group docs mkdocs serve

Release

Releases are published from version tags by GitHub Actions using PyPI Trusted Publishing. The release workflow also creates a GitHub Release and attaches the built package artifacts. See the release checklist.

git tag v0.1.0
git push origin v0.1.0

License and attribution

Apache-2.0. This package is extracted from IBM MQ broker work originally written for FastStream and preserves the FastStream upstream attribution and API style where appropriate.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faststream_mq-0.2.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faststream_mq-0.2.0-py3-none-any.whl (47.9 kB view details)

Uploaded Python 3

File details

Details for the file faststream_mq-0.2.0.tar.gz.

File metadata

  • Download URL: faststream_mq-0.2.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for faststream_mq-0.2.0.tar.gz
Algorithm Hash digest
SHA256 515d5fe0fca8da806434de1c5d585df1556b51c233d70cc86909c8c758472776
MD5 f40617ec176c10a5c21ff62185ece22f
BLAKE2b-256 fd1ab6aa39c707ac460698d03506bd98109723ecda4b70899acb372a45a90910

See more details on using hashes here.

File details

Details for the file faststream_mq-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: faststream_mq-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 47.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for faststream_mq-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc4d0f25a02cbe70eb0e0070ab9ae45ffb93a127c5d245dcf3766eb1e139b1b6
MD5 b0e419178625fbda44bdeef64b6eb8bd
BLAKE2b-256 4b88534c2e2c881ea490706466baa749ac6ceda825fc6b6f1ad474221a5c2e86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page