Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distributed ActiveMQ with Camel

I am in the process of learning ActiveMQ and Camel, with the goal to create a little prototype system that works something like this:

alt text
(source: paulstovell.com)

(big)

When an order is placed in the Orders system, a message is sent out to any subscribers (a pub/sub system), and they can play their part in processing the order. The Orders, Shipping and Invoicing applications have their own ActiveMQ installations, so that if any of the three systems are offline, the others can continue to function. Something takes care of moving messages between the ActiveMQ installs.

Getting Apache Camel to move messages from one queue to another via routes is quite easy, if they are on the same ActiveMQ instance. So this works for managing the subscription queues.

The next challenge is pushing messages from one ActiveMQ instance to another, and it's the bit where I am not sure what to look at next.

  1. Can Camel route between different ActiveMQ installations? (I can't figure out what the JMI endpoint URI would be if they are on different machines).
  2. I understand ActiveMQ has store and forward capabilities. Is this what I would use to move messages between Orders and Shipping/Invoicing?
  3. Or is this what Apache ServiceMix is meant to solve?
like image 286
Paul Stovell Avatar asked Feb 17 '10 09:02

Paul Stovell


People also ask

Is ActiveMQ distributed?

The members of the unit are usually distributed across multiple servers within a cluster, with each queue member belonging to a separate JMS server. AMQ provides network connectors to connect AMQ servers as a cluster.

What is camel ActiveMQ?

ActiveMQ Component. The ActiveMQ component allows messages to be sent to a JMS Queue or Topic or messages to be consumed from a JMS Queue or Topic using Apache ActiveMQ.

Is Apache Camel A message queue?

Apache Camel - Message Queues.

How many queues can ActiveMQ handle?

There is no arbitrary limit on the number of queues. The only limitation is the resources available to the JVM as each new queue will consume heap memory not just for the messages in the queue but for the queue's own data-structures.


1 Answers

This is a pretty straightforward asynchronous, event-driven application that is well-suited for ActiveMQ and Camel.

Actually you do not move messages explicitly from one ActiveMQ instance to another. The way it works is using what's known as a network of brokers. In your case, you'd have three brokers: ActiveMQ-purple, ActiveMQ-green and ActiveMQ-blue. ActiveMQ-purple creates a uni-directional broker network with ActiveMQ-green and ActiveMQ-blue. This allows ActiveMQ-purple to store-and-forward messages to ActiveMQ-green and ActiveMQ-blue based on consumer demand.

The Orders app accepts orders on the orders queue on ActiveMQ-purple. The Orders app uses Camel to consume and process a message to determine if it is an invoicing message or a shipping message. Camel routes the messages to either the invoicing queue or the shipping queue on ActiveMQ-purple.

Consumer demand comes from the Invoicing app and the Shipping app. The Invoicing uses Camel to consume messages from the invoicing queue on ActiveMQ-green. The Shipping app uses Camel to consume messages from the shipping queue on ActiveMQ-blue. Because of the broker network and because of the consumer demand on the ActiveMQ-green.invoicing queue and the ActiveMQ-blue.shipping queue, messages will be forwarded from ActiveMQ-purple to the appropriate broker and queue. There is no need to explicitly route messages to specific broker.

I hope this answers your questions. Let me know if you have anymore.

Bruce

like image 105
bsnyder Avatar answered Oct 13 '22 02:10

bsnyder