Difference between revisions of "Common Messaging endpoints"
Andrea.manzi (Talk | contribs) |
Andrea.manzi (Talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The | + | <!-- CATEGORIES --> |
+ | [[Category: Developer's Guide]] | ||
+ | <!-- CATEGORIES --> | ||
+ | |||
+ | 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: | The library expects each Message Broker instance to be published on the IS as a gCube Runtime Resource having the following model: | ||
Line 72: | Line 76: | ||
</pre> | </pre> | ||
− | The current implementation is using ONLY the openwire broker interface, but in future release if requested we can also | + | 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. |
Line 80: | Line 84: | ||
<source lang="java5"> | <source lang="java5"> | ||
− | ScopeProvider.instance.set(<scope>); | + | ScopeProvider.instance.set(<scope>); |
− | ScheduledRetriever retriever = BrokerEndpoints.getRetriever(<waiting_time>, <refresh_period>); | + | ScheduledRetriever retriever = BrokerEndpoints.getRetriever(<waiting_time>, <refresh_period>); |
</source> | </source> | ||
Line 95: | Line 99: | ||
<source lang="java5" > | <source lang="java5" > | ||
− | ScopeProvider.instance.set(<scope>); | + | ScopeProvider.instance.set(<scope>); |
− | ScheduledRetriever retriever = BrokerEndpoints.getRetriever(); | + | ScheduledRetriever retriever = BrokerEndpoints.getRetriever(); |
</source> | </source> | ||
Line 104: | Line 108: | ||
The addresses provided are of two types: | The addresses provided are of two types: | ||
− | * JMS failover endpoint ( retriever.getFailoverEndpoint() | + | * 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 | + | |
+ | <source lang="java5" > | ||
+ | retriever.getFailoverEndpoint(); | ||
+ | </source> | ||
+ | |||
+ | * 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. | ||
+ | |||
+ | <source lang="java5" > | ||
+ | retriever.getEndpoints(); | ||
+ | </source> |
Latest revision as of 12:46, 24 July 2013
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:
<ID></ID> <Type>RuntimeResource</Type> <Scopes> <Scope>/xxx/xxxxx</Scope> </Scopes> <Profile> <Category>Service</Category> <Name>MessageBroker</Name> <Description /> <Platform> <Name>ActiveMQ</Name> <Version>5</Version> <MinorVersion>5</MinorVersion> <RevisionVersion>1</RevisionVersion> <BuildVersion>1</BuildVersion> </Platform> <RunTime> <HostedOn>hostname</HostedOn> <GHN UniqueID="" /> <Status>READY</Status> </RunTime> <AccessPoint> <Description>openwire interface</Description> <Interface> <Endpoint EntryName="openwire">tcp://hostname:port</Endpoint> </Interface> <AccessData> <Username /> <Password /> </AccessData> </AccessPoint> </Profile>
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:
ScopeProvider.instance.set(<scope>); 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
ScopeProvider.instance.set(<scope>); 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:
retriever.getFailoverEndpoint();
- 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.
retriever.getEndpoints();