STOMP integration for bluesky
Project description
Bluesky Stomp
STOMP integration for bluesky
| Source | https://github.com/DiamondLightSource/bluesky-stomp |
|---|---|
| PyPI | pip install bluesky-stomp |
| Releases | https://github.com/DiamondLightSource/bluesky-stomp/releases |
Low Level API
The library comes with some helpers for interacting with a stomp broker:
from bluesky_stomp.messaging import MessageContext, StompClient
from bluesky_stomp.models import Broker, MessageQueue, MessageTopic
# Assumes you have an unauthenticated broker such as ActiveMQ running on localhost:61613
client = StompClient.for_broker(Broker(host="localhost", port=61613))
try:
# Connect to the broker
client.connect()
# Send a message to a queue and a topic
client.send(MessageQueue(name="my-queue"), {"foo": 1, "bar": 2})
client.send(MessageTopic(name="my-topic"), {"foo": 1, "bar": 2})
# Subscribe to messages on a topic, print all messages received,
# assumes there is another service to post messages to the topic
def on_message(message: str, context: MessageContext) -> None:
print(message)
client.subscribe(MessageTopic(name="my-other-topic"), on_message)
# Send a message and wait for a reply, assumes there is another service
# to post the reply
reply_future = client.send_and_receive(
MessageQueue(name="my-queue"), {"foo": 1, "bar": 2}
)
print(reply_future.result(timeout=5.0))
finally:
# Disconnect at the end
client.disconnect()
python -m bluesky_stomp --version
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bluesky_stomp-0.2.0.tar.gz
(37.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bluesky_stomp-0.2.0.tar.gz.
File metadata
- Download URL: bluesky_stomp-0.2.0.tar.gz
- Upload date:
- Size: 37.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ad3f283a71427f20188c5c799923cd80ad069e911090f042158c2655a22ef82
|
|
| MD5 |
9cc4f86fe7c3d913c9e5df6fb4c97e1a
|
|
| BLAKE2b-256 |
5cbc2b41defcec6b9d4f2e7899e67549aff2c04bb2fef3e4427c92d33c61149d
|
File details
Details for the file bluesky_stomp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bluesky_stomp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6c01504839717c2953b9efdc714f63db3cd1f2e0b2d0221f0b4f51415d7a0f2
|
|
| MD5 |
bab0367490a8f37d24ee68a095530eb0
|
|
| BLAKE2b-256 |
394dd3069d2e0675ad5037c583b8819e5df6fa07ac1814930ed18644191fa232
|