# FastStream STOMP broker
## How To Use
Install the package:
```sh
uv add faststream-stomp
poetry add faststream-stomp
```
Basic usage:
```python
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](https://faststream.airt.ai/latest/getting-started).
Raw data
{
"_id": null,
"home_page": null,
"name": "faststream-stomp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "activemq, artemis, faststream, jms, messaging, stomp",
"author": null,
"author_email": "Lev Vereshchagin <mail@vrslev.com>",
"download_url": "https://files.pythonhosted.org/packages/5d/15/a13388c2a6dee5ad9b24175b77f548b6b043c7da6a63751dca9290e297ff/faststream_stomp-0.1.0.tar.gz",
"platform": null,
"description": "# FastStream STOMP broker\n\n## How To Use\n\nInstall the package:\n\n```sh\nuv add faststream-stomp\npoetry add faststream-stomp\n```\n\nBasic usage:\n\n```python\nimport asyncio\n\nimport faststream\nimport faststream_stomp\nimport stompman\n\nserver = stompman.ConnectionParameters(host=\"127.0.0.1\", port=61616, login=\"admin\", passcode=\"password\")\nbroker = faststream_stomp.StompBroker(stompman.Client([server]))\n\n\n@broker.subscriber(\"first\")\n@broker.publisher(\"second\")\ndef _(message: str) -> str:\n print(message) # this will print message from startup\n return \"Hi from first handler!\"\n\n\n@broker.subscriber(\"second\")\ndef _(message: str) -> None:\n print(message) # this will print message from first handler\n\n\napp = faststream.FastStream(broker)\n\n\n@app.after_startup\nasync def send_first_message() -> None:\n await broker.connect()\n await broker.publish(\"Hi from startup!\", \"first\")\n\n\nif __name__ == \"__main__\":\n asyncio.run(app.run())\n```\n\nAlso there are `StompRouter` and `TestStompBroker` for testing. It works similarly to built-in brokers from FastStream, I recommend to read the original [FastStream documentation](https://faststream.airt.ai/latest/getting-started).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "FastStream STOMP broker",
"version": "0.1.0",
"project_urls": {
"repository": "https://github.com/vrslev/stompman"
},
"split_keywords": [
"activemq",
" artemis",
" faststream",
" jms",
" messaging",
" stomp"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ecb965e2689a6999d307810460a437e233dea687b450c8349d4af399fae9435e",
"md5": "e5b221b3c23743e89518fee3cc0cd0cc",
"sha256": "e5ea0314bbf9319d5d48d146f00ce51093e44647a722e8fbcd714c711959004e"
},
"downloads": -1,
"filename": "faststream_stomp-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e5b221b3c23743e89518fee3cc0cd0cc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 10619,
"upload_time": "2025-01-29T13:35:29",
"upload_time_iso_8601": "2025-01-29T13:35:29.401071Z",
"url": "https://files.pythonhosted.org/packages/ec/b9/65e2689a6999d307810460a437e233dea687b450c8349d4af399fae9435e/faststream_stomp-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5d15a13388c2a6dee5ad9b24175b77f548b6b043c7da6a63751dca9290e297ff",
"md5": "9ef52b5ed9e89d3699000c262129be98",
"sha256": "4494999ec95f28d69560781bafbefaca440d24fd56235bb4fac8b25f369a604c"
},
"downloads": -1,
"filename": "faststream_stomp-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "9ef52b5ed9e89d3699000c262129be98",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 6399,
"upload_time": "2025-01-29T13:35:32",
"upload_time_iso_8601": "2025-01-29T13:35:32.851316Z",
"url": "https://files.pythonhosted.org/packages/5d/15/a13388c2a6dee5ad9b24175b77f548b6b043c7da6a63751dca9290e297ff/faststream_stomp-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-29 13:35:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vrslev",
"github_project": "stompman",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "faststream-stomp"
}