Broker
class Broker : public std::enable_shared_from_this<Broker>
Functions
| Name | Description |
|---|---|
| getInstanceId | The function creates broker communication object with the new identity by cloning the parent object. |
| getDomain | Get the domain this broker is communicating to Return : domain |
| setConsumeBroadcasts | Set flag defining the way how to handle broadcast messages. |
| brokersFromEnv | Establish logical signal-slot connection between 2 devices that is required by used protocol for registration signalInstanceId : device instance ID of a signal signalFunction : signal name Close logical signal-slot connection. De-registration in broker specific API. signalInstanceId : signalFunction : Establish signal-slot connection asynchronously signalInstanceId : signalFunction : completionHandler : this callback is called when complete Unsubscribe from (remote) signal asynchronously signalInstanceId : signalFunction : completionHandler : Set up handlers for processing messages arriving via main communication path handler : - read handler errorNotifier : - error handler Stop processing messages coming via main path Set up handlers for processing heartbeat messages arriving via special path. Heartbeat is used for tracking instances (tracking all instances or no tracking at all) handler : - read message handler errorNotifier : - error handler Send message to broker topic : header : body : priority : timeToLive : Specifies the string of broker URLs from the environment variable KARABO_BROKER. If KARABO_BROKER is not defined, uses a hard coded fallback. |
| brokerTypeFromEnv | Specifies the broker type as the protocol of the broker URLs defined by brokersFromEnv(). |
| brokerTypeFrom | Specifies the broker type as the protocol of the given broker URLs. |
| brokerDomainFromEnv | Specify broker domain (i.e. topic for JmsBroker) from environment variables. First source is KARABO_BROKER_TOPIC, as a fall back the environment variables LOGNAME, USER, LNAME and USERNAME are checked in that order. |
Function Details
brokerDomainFromEnv
static std::string brokerDomainFromEnv()
Specify broker domain (i.e. topic for JmsBroker) from environment variables.
First source is KARABO_BROKER_TOPIC, as a fall back the environment variables LOGNAME, USER, LNAME and USERNAME are checked in that order.
brokerTypeFrom
static std::string brokerTypeFrom(const std::vector<std::string>& urls)
Specifies the broker type as the protocol of the given broker URLs. Throws LogicException if broker addresses specified with different types or without protocol.
brokerTypeFromEnv
static std::string brokerTypeFromEnv()
Specifies the broker type as the protocol of the broker URLs defined by brokersFromEnv(). Throws LogicException if broker addresses specified with different types or without protocol.
brokersFromEnv
static std::vector<std::string> brokersFromEnv()
Establish logical signal-slot connection between 2 devices that is required by used protocol for registration
signalInstanceId
: device instance ID of a signal
signalFunction
: signal name
Close logical signal-slot connection. De-registration in broker
specific API.
signalInstanceId
:
signalFunction
:
Establish signal-slot connection asynchronously
signalInstanceId
:
signalFunction
:
completionHandler
: this callback is called when complete
Unsubscribe from (remote) signal asynchronously
signalInstanceId
:
signalFunction
:
completionHandler
:
Set up handlers for processing messages arriving via main communication path
handler
: - read handler
errorNotifier
: - error handler
Stop processing messages coming via main path
Set up handlers for processing heartbeat messages arriving via special path.
Heartbeat is used for tracking instances (tracking all instances or no tracking at all)
handler
: - read message handler
errorNotifier
: - error handler
Send message to broker
topic
:
header
:
body
:
priority
:
timeToLive
:
Specifies the string of broker URLs from the environment variable KARABO_BROKER.
If KARABO_BROKER is not defined, uses a hard coded fallback.
getDomain
const std::string& getDomain() const
Get the domain this broker is communicating to
Return : domain
getInstanceId
const std::string& getInstanceId() const
The function creates broker communication object with the new identity by cloning the parent object. Concrete meaning of cloning strategy is an implementation detail.
instanceId
: - unique ID
Return : new broker communication object This function establishes connection to the broker otherwise throws exception Close broker connection Predicate to check broker connection status
Return : true if connection is open Get active URI used for establishing connection to broker
Return : uri like "mqtt://localhost:1883" Get type string identifying broker. Example: "AmqpBroker"
Return : the type defined by active uri Get current instance ID associated with this broker object
Return : instanceId
setConsumeBroadcasts
void setConsumeBroadcasts(bool consumeBroadcasts)
Set flag defining the way how to handle broadcast messages. It influences on subscription to such messages, i.e. has to be called before startReading(..)
consumeBroadcasts
: true means subscription