pamoja.loopback
Idiomatic loopback-broker facade.
An in-process broker: publish on one link, receive on another, with no broker process, no network, and no hardware. It is what makes a message flow testable from a unit test rather than only from a deployment.
1"""Idiomatic loopback-broker facade. 2 3An in-process broker: publish on one link, receive on another, with no broker 4process, no network, and no hardware. It is what makes a message flow testable 5from a unit test rather than only from a deployment. 6""" 7 8from __future__ import annotations 9 10from pamoja._native import LoopbackBroker, LoopbackTransport, Message 11 12__all__ = [ 13 "LoopbackBroker", 14 "LoopbackTransport", 15 "Message", 16]
class
LoopbackBroker:
An in-process broker.
Every transport built from one broker shares its traffic, so a message one publishes reaches the others that subscribed to the topic.
class
LoopbackTransport:
One in-process link to a broker.
class
Message:
A message that arrived on a subscribed topic.
CoAP and the loopback broker both hand back a topic and a payload, so one class serves them rather than a near-identical type per transport.