salsa 0.7.1
Loading...
Searching...
No Matches
PublisherZmq.cc
1#include "PublisherZmq.hh"
2
3namespace Salsa {
5 : Publisher(url)
6{
10
11 mpSocket = zsock_new_pub(url.c_str());
12}
14{
18
19 zsock_destroy(&mpSocket);
20}
21
22void PublisherZmq::publish(std::string id, std::string name, std::string data, bool forcePublish)
23{
27
28 if (!mpSocket) {
29 SPD_ERROR("PublisherZmq::publish() mpSocket is null");
30 return;
31 }
32
33 SPD_TRACE("PublisherZmq::publish() Sending msg sub [salsa:{}] id [{}] data [{}]", id, name, data);
34
35 zmsg_t * msg = zmsg_new();
36 zmsg_addstr(msg, fmt::format("salsa:{}", id).data()); // Later we change it to something meaningfull
37 zmsg_addstr(msg, name.data());
38 zmsg_addstr(msg, data.data());
39 zmsg_addstr(msg, fmt::format("{}", forcePublish).data());
40 zmsg_send(&msg, mpSocket);
41}
42
43} // namespace Salsa
PublisherZmq(std::string url=">tcp://localhost:1234")
zsock_t * mpSocket
Socket that... does stuff...
virtual void publish(std::string id, std::string name, std::string data, bool forcePublish=false)
Publish TODO publish what?
Base Publisher class.
Definition Publisher.hh:14
std::string url() const
Returns url.
Definition Publisher.hh:23