What is jms?
It is an API for sending messages between two or more clients. The specification are developed under the the jar JSR 914.
The JMS API supports two models:
- Point-to-point
- Publish and subscribe
Some of the jms providers:
- Apache ActiveMQ
- OpenJMS,
- JBoss Messaging
- WebSphere MQ
Advantage of MQ over Database:
- we need jms bcz it can store the msg. but if we are interacting directly with DB and we are expecting a result from DB and the application goes down then again the application have to go to DB to fetch the result. but in jms, the result can be stored in queue which the application can fetch any time.
- jms we need for the system where we need high reliability.JMS message queue is a high performance highly concurrent load balancer designed for huge throughput.it can send usually tens of thousands of messages per second to many concurrent consumers in many processes and threads. this is not possible in db.bcz in db if one thread is accessing a table then table is locked till thread is done with its own processing.so the throughput is very low.
- jms is recommended as a solution of banking software where many client access the application simultaneously.
- in DB client and server are tightly coupled but in MQ client and server are loosley coupled
- fetching data from DB is sync. but from MQ can be async.
- communication in MQ is event driven which is absent in DB
Advantage of MQ over web service
- msg. is never lost in MQ as it can be persistent which web service does not guarntee
- communication is event based, so client gets notified on arrival of msg.
-one way(request only)
-two way(request+response)
-one to many
-many to one
Messaging:
Stream of byte which application uses to communicate with each other.
Queuing:
Putting msg. in queue
Message parts:
Message Descriptor:
creation time
persistence
priority
Application Data:
contains the data related to application
Types of msg (according to persistence) :
- Persistent:
-logged
-recover on MQ startup
- Non-Persistent:
-not logged
-msg. lost on MQ startup
Types of msg(according to content):
- Datagram:
-no response expected
- Request:
-response is expected
- Reply:
-response to request
- Report:
-exception report
-expiry report
-delivery confirmation report

No comments:
Post a Comment