This structure is provided for every asynchronous function a plugin can implement. It can be used to get access to the event loop as well as indicating to MailerQ when the plugin is done.
MailerQ is a multi-threading application, with multiple working threads that are all sending and receiving messages at the same time. For every single worker thread, a separate context object is created. If you want to be notified when a new context is created, or when a context is destroyed, you can define the following functions in your plugin:
|mq_context_initialize()||Called by MailerQ when a worker thread is created|
|mq_context_cleanup()||Called by MailerQ when a worker thread is destroyed|
Both of the listed functions are optional. It is not necessary for your plugin to export them, but you can for example use these functions to initialize plugin specific data, and to deallocate that data when the worker thread exits.
Your plugin may store a pointer to plugin specific data in a context. This is a pointer that is completely ignored by MailerQ, but that might be useful for your plugin. If you allocate data for this, it is also your responsibility to deallocate the data when the context is destroyed.
|MQ_contextData()||Retrieve the plugin managed data from the context|
|MQ_setContextData()||Assign plugin managed data to the context|
The plugin data is not shared between plugins. Every plugin can therefore associate its own data with a context, and you do not have to worry about other plugins that overwrite your data.
The main feature that a MQ_Context offers, is access to the event loop. There are a number of functions available that you can use for registering file descriptors and timeouts with the event loop. Internally, MailerQ uses a libev event loop, and you can also get access to this loop pointer.
|MQ_ev()||Access to the underlying libev instance|
|MQ_ioWatch()||Watch a filedescriptor for activity|
|MQ_ioUnwatch()||Stop watching a filedescriptor for activity|
|MQ_startTimer()||Start a timer|
|MQ_stopTimer()||Stop a timer|
|MQ_resetTimer()||Reset a timer to a new timeout|
One of our favourite tools in MailerQ is tags. With tags, you can do a lot on an individual delivery level - or on any level ...
We are excited to announce the latest version of MailerQ - version 5.5 - which includes improved insights into deliveries that are sch...