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.2.tar.gz (7.6 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.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for faststream_stomp-1.2.2.tar.gz
Algorithm Hash digest
SHA256 5308887d929c9801d2a61ec37fd44afde5e07591956be5fee128aa1ed3b42e28
MD5 3d8570849208baa7066fe68d31eba5bb
BLAKE2b-256 963b4a9a9dcd67b02727f024399b8af447f597edda355621df31bdc62ac55c95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for faststream_stomp-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6595051e78e3bd9e33415a42a5a786211d5a5de827e54e6c9c321a0b2c3c060e
MD5 18b644c493ff8987ad872f1dc0134d3c
BLAKE2b-256 76b76fd83b802833aee21b3ced01129af13ebc626296cc02e2ed137f10777fa4

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