salsa  0.4.0
NodeZyre.hh
1 #pragma once
2 
3 #include <ActorZmq.hh>
4 #include <MessageZyre.hh>
5 #include <Node.hh>
6 
7 #include <PollerZmq.hh>
8 #include <SocketZyre.hh>
9 
10 namespace Salsa {
19 class NodeManagerZyre;
20 class NodeZyre : public Node, public ActorZmq {
21 public:
23  NodeZyre(std::string name = "");
25  virtual ~NodeZyre();
26 
27  virtual int init();
28  virtual int exec();
29  virtual int finish();
30 
31  void addSocket(std::shared_ptr<SocketZyre> socket);
32  std::vector<std::shared_ptr<SocketZyre>> sockets() const;
33  void addSocket(zsock_t * pSocket);
34 
36  zsock_t * socketExternal(int i) { return mZmqSockets.at(i); }
37 
38  void handleExternalZmq(zmsg_t * pMsg, zsock_t * pSocket);
39 
41  void jobInfoBrokerUrl(std::string url) { mJobInfoBrokerUrl = url; }
43  std::string jobInfoBrokerUrl() { return mJobInfoBrokerUrl; }
45  void jobInfoClientUrl(std::string url) { mJobInfoClientUrl = url; }
47  std::string jobInfoClientUrl() { return mJobInfoClientUrl; }
48 
49 private:
50  std::vector<std::shared_ptr<SocketZyre>> mSockets{};
51  std::vector<zsock_t *> mZmqSockets{};
53  std::string mJobInfoBrokerUrl;
54  std::string mJobInfoClientUrl;
56 };
57 
58 } // namespace Salsa
virtual ~NodeZyre()
Destruct Zyre node.
Definition: NodeZyre.cc:19
virtual int init()
First function.
Definition: NodeZyre.cc:40
virtual int exec()
Main function.
Definition: NodeZyre.cc:98
std::string mJobInfoClientUrl
JobInfo url for client (salsa-broker –out ...)
Definition: NodeZyre.hh:54
void jobInfoClientUrl(std::string url)
Sets JobInfo client url.
Definition: NodeZyre.hh:45
virtual int finish()
Last function.
Definition: NodeZyre.cc:222
Base Node class.
Definition: Node.hh:22
int mJobCheckTimeout
Job check timeout.
Definition: NodeZyre.hh:55
NodeZyre(std::string name="")
Construct Zyre node with provided name (and packetizer)
Definition: NodeZyre.cc:12
std::vector< zsock_t * > mZmqSockets
List of zmq sockets.
Definition: NodeZyre.hh:51
ZeroMQ implementation of salsa actor class.
Definition: ActorZmq.hh:19
void addSocket(std::shared_ptr< SocketZyre > socket)
Definition: NodeZyre.cc:235
void handleExternalZmq(zmsg_t *pMsg, zsock_t *pSocket)
Definition: NodeZyre.cc:268
std::string mJobInfoBrokerUrl
JobInfo broker url (salsa-broker –in ...)
Definition: NodeZyre.hh:53
void jobInfoBrokerUrl(std::string url)
Sets JobInfo broker url.
Definition: NodeZyre.hh:41
std::vector< std::shared_ptr< SocketZyre > > mSockets
List of zyre sockets.
Definition: NodeZyre.hh:50
zsock_t * socketExternal(int i)
Rerturns external socket.
Definition: NodeZyre.hh:36
salsa node class
Definition: NodeZyre.hh:20
std::vector< std::shared_ptr< SocketZyre > > sockets() const
Definition: NodeZyre.cc:250
std::string jobInfoClientUrl()
Returns JobInfo client url.
Definition: NodeZyre.hh:47
std::string jobInfoBrokerUrl()
Returns JobInfo broker url.
Definition: NodeZyre.hh:43
std::string name() const
Returns node name.
Definition: Node.hh:33
NodeManagerZyre class.
NodeManagerZyre * mpNodeManager
Job manager.
Definition: NodeZyre.hh:52