As a user I want to run bluesky callbacks (of the form (name: str, doc: dict) -> None) in a separate process using a stomp broker as the intermediary for the documents.
Also requested by @olliesilvester to aid in the Hyperion migration.
Possible Solution
I imagine we want something that looks a bit like this
import bluesky.plans as bp
from bluesky.run_engine import RunEngine
from dodal.i22 import saxs, waxs
from ophyd_async.core import DeviceCollector
from bluesky_stomp.router import DocumentRouter
from bluesky.callbacks.best_effort import BestEffortCallback
username = input("Please enter your username")
password = input("Please enter your password", password=True)
auth = BasicAuthentication(username=username, password=password)
# We assume there is a RunEngine out there somewhere publishing documents to topic "foo"
router = DocumentRouter(host="localhost", port=61613, destination=Topic(name="foo"), auth=auth)
bec = BestEffortCallback()
router.subscribe(bec)
input("Press enter to finish")
Where we have a wrapper around StompClient that takes a RunEngine callback of the form (name, doc) -> None, bundles it into a dictionary of the form {"name": name, "doc": doc} and sends it to the desired destination.
Acceptance Criteria
There is an importable helper class/method for handling documents coming out of the message bus
This can easily be hooked up to existing bluesky callbacks such as BestEffortCallback
It can authenticate against the broker with a username and password
As a user I want to run bluesky callbacks (of the form
(name: str, doc: dict) -> None
) in a separate process using a stomp broker as the intermediary for the documents.Also requested by @olliesilvester to aid in the Hyperion migration.
Possible Solution
I imagine we want something that looks a bit like this
Where we have a wrapper around
StompClient
that takes aRunEngine
callback of the form(name, doc) -> None
, bundles it into a dictionary of the form{"name": name, "doc": doc}
and sends it to the desired destination.Acceptance Criteria
BestEffortCallback