Common Messaging endpoints

From Gcube Wiki
Jump to: navigation, search

The Messaging Endpoints Libary is a simple library that has been developed in order to harvest and make available to clients the Message broker instances addresses that are published on the gCube Information System

The library expects each Message Broker instance to be published on the IS as a gCube Runtime Resource having the following model:

      <Description />
         <GHN UniqueID="" />
         <Description>openwire interface</Description>
            <Endpoint EntryName="openwire">tcp://hostname:port</Endpoint>
            <Username />
            <Password />

The current implementation is using ONLY the openwire broker interface, but in future release if requested we can also add other interface addresses (.e.g STOMP) and give the possibility to retrieve them trough the library.

The Library can be instantiated by clients to retrieve MessageBroker addresses as follows:

 ScheduledRetriever retriever = BrokerEndpoints.getRetriever(<waiting_time>, <refresh_period>);
  • waiting_time specifies the waiting time in seconds ( the MAX waiting time for the library to try to contact the IS and get the profiles)
  • refresh_period specifies the refreshing time for the profiles

each ScheduledRetriever is static within the JVM, so only one ScheduledRetriever is instantiated per scope.

Once the retriever is instantiated it can be also retrieved as follows

 ScheduledRetriever retriever = BrokerEndpoints.getRetriever();

The addresses provided are of two types:

  • JMS failover endpoint returned as : failover://(address1, ..., addressn), which can be used JMS producer side to automacally and transparently select one of the available brokers ( with transparent failover support). The failover address can be is available from the ScheduledRetriever as follows:
  • Broker addresses which are used by JMS Consumers to connect to brokers. In this case each Consumer should connect to each available broker on the infra.