ServiceEventListenerHook

struct cppmicroservices::ServiceEventListenerHook

Service Event Listener Hook Service.

Bundles registering this service will be called during service (register, modify, and unregister service) operations.

Remark
Implementations of this interface are required to be thread-safe.

Public Types

using ShrinkableMapType = ShrinkableMap<BundleContext, ShrinkableVector<ServiceListenerHook::ListenerInfo>>

ShrinkableMap type for filtering event listeners.

Public Functions

virtual ~ServiceEventListenerHook()
virtual void Event(ServiceEvent const &event, ShrinkableMapType &listeners) = 0

Event listener hook method.

This method is called prior to service event delivery when a publishing bundle registers, modifies or unregisters a service. This method can filter the listeners which receive the event.

Parameters
  • event: The service event to be delivered.
  • listeners: A map of Bundle Contexts to a list of Listener Infos for the bundle’s listeners to which the specified event will be delivered. The implementation of this method may remove bundle contexts from the map and listener infos from the list values to prevent the event from being delivered to the associated listeners.