简体   繁体   中英

ESB/Message Queue quick start

I need to implement a demo system for prove of concept. Basically, the system description can be reduced to 2 modules:

  1. Module 1 sends requests
  2. Module 2 picks them up, processes and sends the response back

( Note: the modules reside in the same intranet, so I probably want the protocol to be faster than http. I thought of the following options:

  1. Message Queue
  2. ESB
  3. Protobuf

Ideally, the system would be (but not limited to) java-based, run on Linux RH and be able to scale linearly.However, the performance is out of the scope for the POC. I was looking at ServiceMix and ActiveMQ . My idea was to implement in java theses modules. The architecture will be message-driven. The modules will communicate over message queue or the service bus.

The 'consumer' sends the requests as messages to the message queue, the 'producer' picks them up by certain subscription topic, processes the requests and posts the response back to the same queue. The 'consumer' that is subscribed on 'response' topic picks the results from the queue. END.

My questions are:

  1. What are other good options (protocols, architecture, existing libraries) to be considered in order to implement the above functionality?
  2. In order to achieve the above I tried to look at ServiceMixESB User Guide but it seems like in order to get something like above running I got to learn bunch of stuff I am not familiar with: JBI, NMR, Karaf, Camel etc and I do not have time to do it. So, I wonder: is there any quick start guide or java sample code for ESB/Message Queue 'Hello World' application that could help just set everything in motion?

ActiveMQ with XML messages should be enough, unless your messages are big and lots of them, in which case I would go for protobuf(disclaimer: I used them on the last project).

As a matter of fact I would probably go for some amqp implementation, like Apache Qpid(disclaimer: used that also some time ago) over ActiveMQ. But this is more a personal reason.

The downside of protobuf is that you need some knowledge about them, there are hello worlds all around the web, but once you try to face 'real problems' it does not get too easy. You will also need a maven plugin to build and compile the files, unless you want to do it manually.

ActiveMQ is simply a JMS Provider, and I am sure you already looked at this examples:

Hello World ActiveMQ

On an implementation side, when module1 sends the request you want to be sure that the response will be read by the same module. Temporary queues is what I would suggest. Send the request to some queue (and also the temporary queue name for example that the response is expected to come to); module2 processes the message and sends the response to the temporary queue, where it is read by module1 with a message listener.

Now, you have to delete this temporary queues really fast so that don't pile up, and also check that ActiveMQ provides them with unique names.

In QPID with a simple parameter auto-delete=true, when there are no active listeners the queue is deleted, I have no idea how that is handled in ActiveMQ, but there should be a way.

Just my 0.02$

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM