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-2.0.1.tar.gz (8.5 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-2.0.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for faststream_stomp-2.0.1.tar.gz
Algorithm Hash digest
SHA256 02b6bba42b0629165a7964f2924199aa15b0e6ce483ce3ad4c89daefa89729fd
MD5 357dffc013c0f03f28d4a3d730863ecf
BLAKE2b-256 97f0198eeb144835d8b3eef180d11d3317f517bab890c9761cbb4fb4a3c2ea79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for faststream_stomp-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c112a33346615e7734119fd8445d94d8cd953943dc4cdc59fa0116fbe2be665c
MD5 a0a696d90d8892d218e92e2d9f5850b2
BLAKE2b-256 0d78510facfb95d4dbe049b38efd9be5eb1e75f4ec4ff1581ec7d85727f2bfef

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