# 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).
### Caveats
- When exception is raised in consumer handler, the message will be nacked (FastStream doesn't do this by default)
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/29/59/45bd017b4d760a0149c352a7bebc8b5c0b05a2eb5cb1ce2165ad56b9000d/faststream_stomp-1.0.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\n### Caveats\n\n- When exception is raised in consumer handler, the message will be nacked (FastStream doesn't do this by default)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "FastStream STOMP broker",
"version": "1.0.0",
"project_urls": {
"repository": "https://github.com/community-of-python/stompman"
},
"split_keywords": [
"activemq",
" artemis",
" faststream",
" jms",
" messaging",
" stomp"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a6ad91ff9904aca9b47bbc9bd30c82efe480316e36cd1db864b2966c80714410",
"md5": "89540c0c6cf898e2e1353fd189b86256",
"sha256": "5440bad6252238ade8dc7dc3c0eab61780a519fce752430ac4d1027c458386be"
},
"downloads": -1,
"filename": "faststream_stomp-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "89540c0c6cf898e2e1353fd189b86256",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 12758,
"upload_time": "2025-02-14T07:04:01",
"upload_time_iso_8601": "2025-02-14T07:04:01.888799Z",
"url": "https://files.pythonhosted.org/packages/a6/ad/91ff9904aca9b47bbc9bd30c82efe480316e36cd1db864b2966c80714410/faststream_stomp-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "295945bd017b4d760a0149c352a7bebc8b5c0b05a2eb5cb1ce2165ad56b9000d",
"md5": "78d4fb421100055dda27ec9400a3e5ce",
"sha256": "a6d38b63d2012f001674b5d5a33eb97adae18bcd311ec18b984c780a2412e820"
},
"downloads": -1,
"filename": "faststream_stomp-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "78d4fb421100055dda27ec9400a3e5ce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 7550,
"upload_time": "2025-02-14T07:04:02",
"upload_time_iso_8601": "2025-02-14T07:04:02.955815Z",
"url": "https://files.pythonhosted.org/packages/29/59/45bd017b4d760a0149c352a7bebc8b5c0b05a2eb5cb1ce2165ad56b9000d/faststream_stomp-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-14 07:04:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "community-of-python",
"github_project": "stompman",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "faststream-stomp"
}