Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bluesky-stomp

Package Overview
Dependencies
Maintainers
0
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluesky-stomp

STOMP integration for bluesky

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
0

CI Coverage PyPI License

Bluesky Stomp

STOMP integration for bluesky

Sourcehttps://github.com/DiamondLightSource/bluesky-stomp
PyPIpip install bluesky-stomp
Releaseshttps://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()

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc