1

I have two applications (classic java program and a batch) that have to deal with each other. In order to decouple them as much as possible the communication, i'm thinking about using a queue between the applications.

The thing is that the first application is providing some java objects that the second one has to transform to another objects type (sort of DTO pattern) and do some business logic and web service call using the newly constructed objects. Is using a queue is the best solution in this case?

if it is, is there a performance issue on the queue (thinking espacially about size, and consumation time)? What is the best way to implement this queue?

thank you in advance :)

Naoufel
  • 95
  • 1
  • 2
  • 8
  • Not sure how are you exchanging java objects between a batch and a java program – Drona May 16 '12 at 08:34
  • Hy Vikas, thnx for your interest! In my scenario, the classic application will push some java objects in the queue, that the batch application will consume, transform to another objects types, do some business logic and then send the result by web services calls to another application. – Naoufel May 16 '12 at 10:45

1 Answers1

2

Queue is probably the best solution if the job is long running and resource intensive. For example if your batch application is sending out massive emails with the each content the classic application provides, then yes Queue is the right solution.

Drawbacks of queue includes it introduces management overhead like you have to worry about what if the queue gets too large, how to delivery response back to the classic application etc.

If the batch program can process each request from the classic application quickly then I would expose the batch program as web service so the classic application can get immediate response.

Alvin
  • 10,308
  • 8
  • 37
  • 49
  • Thank you for your Answer Alvin! Indeed, the batch application has a long running treatement. So, if the queue is adapted to this case, we'll choose it. As you talked about issue like queue size, how to let the classic application know about how things are going in the other side of the queue, have you any recommandation about the queue implementation mechanism? best framework... etc thanks again. – Naoufel May 16 '12 at 10:03
  • I wouldn't go with implementing a messaging queue myself as 1) it's going to take a while 2)it's re-inventing the wheel. I personally used IBM MQ before, but unfortunately I don't think it's free. Take a look at this thread:http://stackoverflow.com/questions/731233/activemq-or-rabbitmq-or-zeromq-or, it compares few open source messaging queue frameworks. – Alvin May 16 '12 at 10:38
  • Really thank you so much Alvin! Very interesting thread!! i'll take a look, it will help to make a choice. – Naoufel May 16 '12 at 10:47