Class SubscriptionHandler

Inheritance Relationships

Base Types

  • public email::EmailHandler (Class EmailHandler)

  • public std::enable_shared_from_this< SubscriptionHandler >

Class Documentation

class SubscriptionHandler : public email::EmailHandler, public std::enable_shared_from_this<SubscriptionHandler>

Email handler for subscriptions.

Distributes new messages to the right subscription(s).

Public Types

using MessageQueue = SafeQueue<std::pair<std::string, MessageInfo>>

Public Functions

SubscriptionHandler()

Constructor.

virtual ~SubscriptionHandler()
void register_subscription(const std::string &topic_name, MessageQueue::WeakPtr message_queue)

Register a subscription with the handler.

New messages will be added to the subscription’s queue if the topic name matches.

Parameters:
  • topic_name – the topic name

  • message_queue – the subscription’s message queue to push the new message to

virtual void register_handler(std::shared_ptr<PollingManager> polling_manager)

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

virtual void handle(const struct EmailData &data)

Handle new email.

Adds the message to the queues of subscriptions with topic names that match the new message.