Difference between revisions of "IS-Notifier"
Lucio.lelii (Talk | contribs) |
Lucio.lelii (Talk | contribs) |
||
Line 23: | Line 23: | ||
* ''IsOngoingResponse isOngoing(IsOngoingRequest request)'' allows client to know which topic registration are still ongoing or finished. | * ''IsOngoingResponse isOngoing(IsOngoingRequest request)'' allows client to know which topic registration are still ongoing or finished. | ||
+ | == Examples == | ||
+ | How to retrieve the IS-Notifier EPR in the gcube system using the [[IS-CLient|IS-CLient library]]: | ||
+ | <code> | ||
+ | GCUBEScope scope = ... | ||
+ | ISClient client = GHNContext.getImplementation(ISClient.class); | ||
+ | GCUBERIQuery query = client.getQuery(GCUBERIQuery.class); | ||
+ | query.addAtomicConditions(new AtomicCondition("/Profile/ServiceName","IS-Notifier"),new AtomicCondition("/Profile/ServiceClass","InformationSystem") ); | ||
+ | List<GCUBERunningInstance> ris= client.execute(query, scope); | ||
+ | EndpointReferenceType notifierEPR= ris.get(0).getAccessPoint().getEndpoint("gcube/informationsystem/notifier/Notifier"); | ||
+ | </code> | ||
+ | |||
+ | The following code explains how to register as consumer to a Topic: | ||
+ | <code> | ||
+ | GCUBEScope scope = | ||
+ | SubscribeMessage mess = new SubscribeMessage(); | ||
+ | mess.setEndpointReference(consumerEPR); | ||
+ | mess.setTopic(topic); | ||
+ | NotifierServiceAddressingLocator brokerLocator = new NotifierServiceAddressingLocator(); | ||
+ | NotifierPortType notifierPT = brokerLocator.getNotifierPortTypePort(notifierEPR); | ||
+ | notifierPT= GCUBERemotePortTypeContext.getProxy(port, scope); | ||
+ | brokerPT.subscribeToTopic(mess); | ||
+ | </code> | ||
[[Category:Information System]] | [[Category:Information System]] |
Revision as of 14:18, 14 April 2011
The IS-Notifier is the gCube Service dedicated to manage subscriptions with respect to Topics, i.e. organised items of interest for publishing/subscription . It acts as a subscriptions broker since allows its client to subscribe to a topic while freeing them from the need to know the location of the notifications producer (i.e. its EPR). It also supports subscriptions to Topics that are not yet exposed by their producers. In this case, the IS-Notifier maintains a subscription in a pending state until the notification producer registers the related Topic.
It is important to notice that the design of such a service does not implement the classical brokered notification schema since the IS-Notifier subscribes the consumer directly to the notification producer. In this way, there is no single service that is in charge to receive notifications from producers and then dispatch them to the subscribed client(s). However, the IS-Notifier plays a mediator role because of the subscriptions brokerage. In fact, the IS-Notifier automatically manages the relocation of notification producers by forwarding the client subscription requests to the new instances of the producers. Moreover, the service supports the transparent subscription/re-subscription of the client to the new producer instances that comes up after the initial request of subscription.
Contents
Design
The IS-Notifier service adopts a singleton pattern. It implements a notification broker system on top of the WS-Notification standard implemented in GT4. A library that simplifies the interaction with this service is released with the gHN distribution (namely the IS-Notification library).
Role
The IS-Notifier service allows any entity in the GCUBE framework to receive notifications produced by others services in the framework. The most important feature is to determine if a notification producer or a notification consumer has been relocated in a different node. This feature is possible because IS-Notifier service has as main entities topics and not producers or consumer.
Operations
The IS-Notifier follows the singleton pattern, it has only one PortType (NotifierPortType) and implements the following operations:
- String registerTopic(RegisterTopicMessage message) allows client to register as producer of a topic, if the topic already exists his address is added as producer of the topic.
- UnregisterTopicResponse unregisterTopic(RegisterTopicMessage message) allows client to unregister a specific topic.
- SubscribeToTopicResponse subscribeToTopic(SubscribeMessage message) allows client to register as consumer of a topic, f the topic already exists his address is added as consumer of the topic.
- RemoveSubscriptionResponse removeSubscription (SubscribeMessage message) allows client to remove the subscription to a topic.
- ListTopicsResponse listTopics (ListTopics topics) returns the list of all topic registered.
- RemoveNotifierResponse removeNotifier(RemoveNotifier notifiers) removes a specific host from all the topic it was registered as producer
- RemoveSubscriberResponse removeSubscriber(RemoveSubscriber subscribers) removes a specific host from all the topic it was registered as consumer
- IsOngoingResponse isOngoing(IsOngoingRequest request) allows client to know which topic registration are still ongoing or finished.
Examples
How to retrieve the IS-Notifier EPR in the gcube system using the IS-CLient library:
GCUBEScope scope = ...
ISClient client = GHNContext.getImplementation(ISClient.class);
GCUBERIQuery query = client.getQuery(GCUBERIQuery.class);
query.addAtomicConditions(new AtomicCondition("/Profile/ServiceName","IS-Notifier"),new AtomicCondition("/Profile/ServiceClass","InformationSystem") );
List<GCUBERunningInstance> ris= client.execute(query, scope);
EndpointReferenceType notifierEPR= ris.get(0).getAccessPoint().getEndpoint("gcube/informationsystem/notifier/Notifier");
The following code explains how to register as consumer to a Topic:
GCUBEScope scope =
SubscribeMessage mess = new SubscribeMessage();
mess.setEndpointReference(consumerEPR);
mess.setTopic(topic);
NotifierServiceAddressingLocator brokerLocator = new NotifierServiceAddressingLocator();
NotifierPortType notifierPT = brokerLocator.getNotifierPortTypePort(notifierEPR);
notifierPT= GCUBERemotePortTypeContext.getProxy(port, scope);
brokerPT.subscribeToTopic(mess);