com.apama.cumulocity
Event TenantSubscriptionNotifier
Helper utility to get notifications of tenant subscriptions and unsubscriptions.
Note that if the TenantSubscriptionNotifier is used from multiple monitor instances to receive callback, the order in which the callback actions are called is not defined.- Sends:
- com.apama.cumulocity.GetAllTenantsSubscribedToApplication -
- Listens:
- com.apama.cumulocity.ApplicationSubscribedForTenant -
- com.apama.cumulocity.ApplicationUnsubscribedForTenant -
- com.apama.cumulocity.TenantsSubscribedToApplication -
create
com.apama.cumulocity.TenantSubscriptionNotifier static create()
Create a new instance of the TenantSubscriptionNotifier.- Returns:
- The new TenantSubscriptionNotifier.
onSubscription
com.apama.cumulocity.TenantSubscriptionNotifier onSubscription(action<com.apama.cumulocity.TenantDetails> callback)
Register a callback to receive a notification whenever a tenant is subscribed to the current application.
A new monitor instance is spawned for each tenant on a private context for that tenant. Each tenant gets its own context. The callback action is called from within the new monitor instance.- Parameters:
- callback - The callback action to receive subscription notifications.
- Returns:
- The existing TenantSubscriptionNotifier.
onUnsubscription
com.apama.cumulocity.TenantSubscriptionNotifier onUnsubscription(action<string> callback)
Register a callback to receive a notification whenever a tenant is unsubscribed from the current application.
The callback action is called within the same monitor instance and context from which the subscription callback was called. The monitor instance is terminated after the callback.- Parameters:
- callback - The callback action to receive unsubscription notifications.
- Returns:
- The existing TenantSubscriptionNotifier.