public final class SampleQuerySubscriptions extends Object
The code below illustrates how an event consumer can query the Eventing Framework for subscriptions that it has created.
In the first sample below the consumer uses the EventingFactory
to
create an EventingService
object. The consumer then creates a
SubscriptionSelectionFilter
object and sets filter attributes for the
"Call" family and the "CALL_ANSWERED" event type. The
querySubscriptions method is then called to query the Eventing
Framework for matching subscriptions.
package com.mycompany; import com.avaya.collaboration.eventing.EventFilter; import com.avaya.collaboration.eventing.EventSubscription; import com.avaya.collaboration.eventing.EventSubscriptionAttributes; import com.avaya.collaboration.eventing.EventingFactory; import com.avaya.collaboration.eventing.EventingService; import com.avaya.collaboration.eventing.SubscriptionSelectionFilter; import com.avaya.collaboration.eventing.families.EventFamilyCall; import com.avaya.collaboration.eventing.families.EventFamilySystem; final EventingService eventingService = EventingFactory.createEventingService(); final SubscriptionSelectionFilter filter = EventingFactory.createSubscriptionSelectionFilter(); filter.setFamily(EventFamilyCall.FAMILY_NAME); filter.setFamily(EventFamilyCall.EVENT_CALL_ANSWERED); final Set<EventSubscription> subscriptionSet = eventingService.querySubscriptions(filter);
The second sample below is very much like the first example. The only
difference is that the filter attributes for consumer name and version are
set rather than the family and event type attributes. Note that the consumer
name and version attributes are the "on behalf of" consumer name and version.
See the package level Javadoc for the
eventing
package for details about
"on behalf of" functionality.
package com.mycompany; import com.avaya.collaboration.eventing.EventFilter; import com.avaya.collaboration.eventing.EventSubscription; import com.avaya.collaboration.eventing.EventSubscriptionAttributes; import com.avaya.collaboration.eventing.EventingFactory; import com.avaya.collaboration.eventing.EventingService; import com.avaya.collaboration.eventing.SubscriptionSelectionFilter; import com.avaya.collaboration.eventing.families.EventFamilyCall; import com.avaya.collaboration.eventing.families.EventFamilySystem; final EventingService eventingService = EventingFactory.createEventingService(); final SubscriptionSelectionFilter filter = EventingFactory.createSubscriptionSelectionFilter(); filter.setConsumerName("MyConsumer"); filter.setConsumerVersion("1.0.0.0.0"); final Set<EventSubscription> subscriptionSet = eventingService.querySubscriptions(filter);
Copyright © 2023 Avaya. All rights reserved.