Belle II Software development
ZMQClasses.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <daq/hbasf2/apps/ZMQApp.h>
11#include <framework/pcore/zmq/connections/ZMQConfirmedConnection.h>
12#include <framework/pcore/zmq/connections/ZMQLoadBalancedConnection.h>
13#include <framework/pcore/zmq/connections/ZMQRawConnection.h>
14#include <framework/pcore/zmq/connections/ZMQNullConnection.h>
15
16namespace Belle2 {
26 class ZMQReadySender : public ZMQStandardApp<ZMQLoadBalancedInput, ZMQNullConnection> {
27 protected:
29 void initialize() final;
31 void addOptions(po::options_description& desc) final;
32
33 private:
35 std::string m_inputAddress;
37 unsigned int m_bufferSize = 20;
38 };
39
45 class ZMQAcceptor : public ZMQStandardApp<ZMQConfirmedInput, ZMQNullConnection> {
46 protected:
48 void initialize() final;
50 void addOptions(po::options_description& desc) final;
51
52 private:
54 std::string m_inputAddress;
55 };
56
63 class ZMQWorker : public ZMQStandardApp<ZMQLoadBalancedInput, ZMQConfirmedOutput> {
64 protected:
66 void initialize() final;
68 void addOptions(po::options_description& desc) final;
70 void handleInput() final;
71
72 private:
74 std::string m_inputAddress;
76 std::string m_outputAddress;
78 unsigned int m_bufferSize = 20;
79 };
81}
App to only send a confirmation on every incoming message - behaves the same as the input of a (final...
Definition: ZMQClasses.h:45
std::string m_inputAddress
Parameter: input address.
Definition: ZMQClasses.h:54
void initialize() final
Initialize the two connections using the command line arguments.
Definition: ZMQClasses.cc:30
void addOptions(po::options_description &desc) final
Add the parameters to the cmd line arguments.
Definition: ZMQClasses.cc:37
App to only send a ready on every incoming message - behaves the same as the input of a worker (but w...
Definition: ZMQClasses.h:26
unsigned int m_bufferSize
Parameter: buffer size.
Definition: ZMQClasses.h:37
std::string m_inputAddress
Parameter: input address.
Definition: ZMQClasses.h:35
void initialize() final
Initialize the two connections using the command line arguments.
Definition: ZMQClasses.cc:13
void addOptions(po::options_description &desc) final
Add the parameters to the cmd line arguments.
Definition: ZMQClasses.cc:20
Generic base class for all standalone ZMQ applications.
Definition: ZMQApp.h:46
App to mimick a basf2-worker by accepting an incoming message with a ready message and sending it out...
Definition: ZMQClasses.h:63
unsigned int m_bufferSize
Parameter: buffer size.
Definition: ZMQClasses.h:78
std::string m_inputAddress
Parameter: input address.
Definition: ZMQClasses.h:74
void initialize() final
Initialize the two connections using the command line arguments.
Definition: ZMQClasses.cc:45
void addOptions(po::options_description &desc) final
Add the parameters to the cmd line arguments.
Definition: ZMQClasses.cc:52
std::string m_outputAddress
Parameter: output address.
Definition: ZMQClasses.h:76
void handleInput() final
Transport the message from the input to the output connection.
Definition: ZMQClasses.cc:64
Abstract base class for different kinds of events.