Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is best design for communication between two components

Currently we are working on a project and we are in design and architecture phase of the project following are main points of projects.

  • There are switches which are generating real time data
  • We have two components in to be made in Java/Java EE, call it CompA and CompB
  • CompA apply some process based on input record from switch without contacting to any databases, CompA does not have DB access.
  • CompB takes process record of CompA and apply processing also, this involves business database
  • CompA and CompB have multiple instances in system for scalability and fault tolerance.
  • Record is text record having multiple fields
  • Record is transactional , On record is considered processed if it is process from both CompA and CompB , other wise it will be roll backed and resend again

Now the problem is what is best way for communication between CompA adn Comp B

One way is

 1. CompA--------> CompB
 2. CompA-------->Messaging Server(JMS)------> CompB

Requirment: There will be more than one CompA and CompB is the system and if any component fails it load will be shared by other peers e.g if CompA fails its load will be shared by other CompA instances in the system. For that we are going for second option with JMS so that CompA is not tightly bound with CompB. But as new Component (Messaging Server)is introduced this may cause performance degradation as the record processing is transactional the system is real time.
Your suggestions and expert advices will be highly appriciated

like image 288
zaffargachal Avatar asked Nov 05 '12 11:11

zaffargachal


2 Answers

JMS is the way to go - http://docs.oracle.com/javaee/6/tutorial/doc/bnceh.html

It is very reliable, you can do things like set message expirations and enforce priorities and it is perfect for your model which is basically a "Multiple producer/multiple consumer" over the network.

JMS supports transactions and it is built for reliability - by far it is the most reliable mechanism available. Performance-wise, you should talk about "scalability" more than "raw performances". Provided your hardware can cope, JMS will.

Wikipedia has a very good list of available JMS implementations: http://en.wikipedia.org/wiki/Java_Message_Service#Provider_implementations

I have used Apache ActiveMQ, Open Message Queue and OpenJMS and, even if I have no experience of deployment of JMS servers on a clustered environment, I agree ActiveMQ is the most reliable solution I used.

like image 175
thedayofcondor Avatar answered Nov 10 '22 07:11

thedayofcondor


I would suggest to use JMS with spring integration. check example

In my case we have used ActiveMq with spring integration so that we were able to handle loadbalancing and fail over fetures easily.

like image 40
someone Avatar answered Nov 10 '22 09:11

someone