|
SObjectizer
5.5
|
SObjectizer-5.5.24 contains another feature for customization of SObjectizer Run-Time behaviour. It is an event_queue_hook.
Since v.5.5.24 there is a single instance of event_queue_hook in SObjectizer Environment. By default it is no-op hook (nothing is happened when this no-op hook is invoked). But user can set his/her own instance can in environment_params_t before launching of SObjectizer Environment.
Since v.5.5.24 every agent calls event_queue_hook two times:
event_queue_hook_t::on_bind method. As result agent receives a new pointer and this new pointer will be used by agent for enqueuing new demands;event_queue_hook_t::on_bind to event_queue_hook_t::on_unbind method.The event_queue_hook mechanism allows to make specialized wrappers around actual event queues. These wrappers can be used for different tasks. For example for tracing purposes or for gathering some run-time stats.
Please note that this is a low-level mechanism intended to be used for very specific tasks. Because its low-level nature the details and behavior of that mechanism can be changed dramatically in future versions of SObjectizer without any prior notice.
As a very simple example we provide a rather trivial implementation of event_queue_hook. This implementation wraps every event_queue in a special proxy object:
Where event_queue_logging_proxy can looks like:
This event_queue_hook can be passed to SObjectizer Environment this way:
In that case instance of demo_event_queue_hook is created on stack and because of that noop_deleter will be used with event_queue_hook_unique_ptr_t.
We can also create an instance of demo_event_queue_hook as dynamic object. In that case we can write:
1.8.14