Class ServiceHandler
Defined in File service_handler.hpp
Inheritance Relationships
Base Types
public email::EmailHandler
(Class EmailHandler)public std::enable_shared_from_this< ServiceHandler >
Class Documentation
-
class ServiceHandler : public email::EmailHandler, public std::enable_shared_from_this<ServiceHandler>
Email handler for service servers.
Distributes them to the right service server.
There can be more than one service server for the same service name. All service servers may get the request and respond, but only the first response will be used by the original service client; the rest will be discarded.
Public Types
-
using ResponseMap = SafeMap<SequenceNumber, std::pair<struct EmailData, ServiceInfo>>
-
using RequestQueue = SafeQueue<std::pair<struct EmailData, ServiceInfo>>
Public Functions
-
ServiceHandler()
Constructor.
-
virtual ~ServiceHandler()
-
void register_service_client(const Gid &gid, ResponseMap::WeakPtr response_map)
Register a service client with the handler.
- Parameters:
gid – the service client GID
response_map – the service client’s response map to add the new response to
-
void register_service_server(const std::string &service_name, RequestQueue::WeakPtr request_queue)
Register a service server with the handler.
- Parameters:
service_name – the service name
request_queue – the service server’s request queue to push the new request to
Register this handler.
Registers this handler with the
PollingManager
so that it is called with new emails. To be called after creation.- Parameters:
polling_manager – the polling manager to register with
Public Static Attributes
-
static constexpr auto HEADER_SEQUENCE_NUMBER = "Request-Sequence-Number"
Custom header name for service request sequence number.
Note that there is no “X-” prefix. See RFC 6648: https://tools.ietf.org/html/rfc6648
-
using ResponseMap = SafeMap<SequenceNumber, std::pair<struct EmailData, ServiceInfo>>