Hi everybody,
I am rather new in ActiveMQ and I have some difficulties trying to setup
a network of brokers using multicast and JGroups. In fact in some
aspects I am not even very sure about how things really work.
We have several centers communicating together using a not very reliable
network. Every client can send and receive a message, from any part of
the network. And the "network of brokers" should be in charge of the
transport of the message between the brokers.
Moreover it is a "star" network (one center and many client to send and
receive messages)(what is the term for that kind of network?).
So the choosen solution is to use Multicast to send messages - from the
center to the clients. But as it has to be reliable, one thought about
using JGroups.
So our goal is to create a network of brokers communicating together via
reliable multicast (jgroups).
If someone wants to send a message or receive a message it does not have
to connect to a remote JMS Server that could be unreableable. But It
connects to a "local" ActiveMQ server (I mean by "local" a server on its
local network) who will be in charge of sending the message to the
Central Server.
On the other sense, the client connects to the "local" JMS server to
receive messages from the central ActiveMQ Broker.
Thus it is not the client that deals with the not-reliable network but
it is the ActiveMQ network of brokers. If the network between 2 servers
is down, the client does not receive a message for a while but when the
network is up again, it should receive the messages - that mechanism
being transparent to the client.
Do you think such a mechanism is doeable?
I made first tests and it seemed to work. Here is my XML Configuration.
<beans xmlns="http://activemq.org/config/1.0">
<!-- Allows us to use system properties as variables in this
configuration file -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<broker useJmx="true" brokerName="spationavActiveMQ">
<managementContext>
<managementContext connectorPort="1099"
jmxDomainName="org.apache.activemq"/>
</managementContext>
<!-- In ActiveMQ 4, you can setup destination policies -->
<destinationPolicy>
<policyMap><policyEntries>
<policyEntry topic="FOO.>">
<dispatchPolicy>
<strictOrderDispatchPolicy />
</dispatchPolicy>
<subscriptionRecoveryPolicy>
<lastImageSubscriptionRecoveryPolicy />
</subscriptionRecoveryPolicy>
</policyEntry>
</policyEntries></policyMap>
</destinationPolicy>
<persistenceAdapter>
<journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.home}/activemq-data"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="internal" uri="tcp://localhost:61616"
discoveryUri="multicast://225.0.0.1:61616"/>
</transportConnectors>
<networkConnectors>
<!-- by default just auto discover the other brokers -->
<networkConnector name="default" uri="multicast://225.0.0.1:61616"/>
</networkConnectors>
</broker>
</beans>
Simple, isn't it? from now I very like the simplicity of configuration
with activeMQ.
From that point I have some questions:
- If some publish a message on that network will it be send via a
MULTICAST protocol to the other brokers? I already read that page :
http://www.activemq.org/site/how-do-distributed-queues-work.html but I
am not sure of the answer, because I do not understand when the protocol
of the URI of the networkConnector is used: is it during the discovery
of agents or during the transport of messages? Be sumerize: what is the
protocol used during the transport of messages?
- How to use JGroups as the transport protocol between the ActiveMQ
brokers? I tried to indicate for instance
<networkConnector name="default" uri="jgroups:default"/>
And I added the JGRoups .jar in $ACTIVE_HOME/lib/optionnal
But, trying to run that configuration gives an exception:
Property 'uri' threw exception; nested exception is java.io.IOException:
DiscoveryAgent scheme NOT recognized: [jgroups]
Did I tryed to configure jgroups at a worng place? Where must I
configure the jgroups aspects?
Or may be I misunderstood some concepts? In that case please let me know.
Thanks in advance.
Gabriel.