Skip to main content

FastStream STOMP broker

Project description

FastStream STOMP broker

How To Use

Install the package:

uv add faststream-stomp
poetry add faststream-stomp

Basic usage:

import asyncio

import faststream
import faststream_stomp
import stompman

server = stompman.ConnectionParameters(host="127.0.0.1", port=61616, login="admin", passcode="password")
broker = faststream_stomp.StompBroker(stompman.Client([server]))


@broker.subscriber("first")
@broker.publisher("second")
def _(message: str) -> str:
    print(message)  # this will print message from startup
    return "Hi from first handler!"


@broker.subscriber("second")
def _(message: str) -> None:
    print(message)  # this will print message from first handler


app = faststream.FastStream(broker)


@app.after_startup
async def send_first_message() -> None:
    await broker.connect()
    await broker.publish("Hi from startup!", "first")


if __name__ == "__main__":
    asyncio.run(app.run())

Also there are StompRouter and TestStompBroker for testing. It works similarly to built-in brokers from FastStream, I recommend to read the original FastStream documentation.

Caveats

  • When exception is raised in consumer handler, the message will be nacked (FastStream doesn't do this by default)

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_stomp-1.2.5.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

faststream_stomp-1.2.5-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file faststream_stomp-1.2.5.tar.gz.

File metadata

  • Download URL: faststream_stomp-1.2.5.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.5

File hashes

Hashes for faststream_stomp-1.2.5.tar.gz
Algorithm Hash digest
SHA256 bf37e245ad1054892074c4ac79b032d2dea03ce02530e4e8f70f0cbe3a5286da
MD5 4346d13deca3123ef1bc52ce2fd3e133
BLAKE2b-256 598e22db457308885d41a85bf553255585556eadb492a4251be4e5f97e706770

See more details on using hashes here.

File details

Details for the file faststream_stomp-1.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for faststream_stomp-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ca6892e84fd637ec34eb8d2d13433c7ad53facf61f80f70ab902f6d51ca21134
MD5 ec5ca5323f5b1f538a9c3c6d9bd8cc1f
BLAKE2b-256 35ab2ee37e09b8f3da1da6e3e4d31b0d6ccfea3626764536a94119c63250fb45

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