java messaging service
TRANSCRIPT
![Page 1: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/1.jpg)
Java Messaging Service (JMS)
Presentation By
-Anil Prajapati
![Page 2: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/2.jpg)
Messaging
Messaging is a method of communication between software components or applications.
A messaging system is a peer-to-peer facility. Messaging enables distributed communication
that is loosely coupled. Messaging differs from tightly coupled
technologies such as Remote Method Invocation (RMI )
Messaging also differs from electronic mail (e-mail)
![Page 3: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/3.jpg)
What is JMS?
A specification that describes a common way for Java programs to create, send, receive and read distributed enterprise messages
loosely coupled communication Asynchronous messaging
A JMS provider can deliver messages to a client as they arrive; a client does not have to request messages in order to receive them.
Reliable delivery A message is guaranteed to be delivered once and only once.
Outside the specification Security services Management services
![Page 4: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/4.jpg)
A JMS Architecture
JMS Clients Java programs that send/receive messages
Messages the objects that communicate information between JMS
clients Administered Objects
preconfigured JMS objects created by an admin for the use of clients
ConnectionFactory, Destination (queue or topic) JMS Provider
messaging system that implements JMS and administrative functionality
![Page 5: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/5.jpg)
JMS Architecture
AdministrativeTool
JNDI Namespace
JMS Client JMS Provider
Bind
Lookup
LogicalConnection
CF D
![Page 6: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/6.jpg)
Architecture Interaction
• The administrator binds connection factories (CF) and destinations (D) into a JNDI namespace.
• A JMS client can then lookup the administered objects and establish a logical connection to them via the JMS Provider
![Page 7: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/7.jpg)
JMS Messaging Domains
Point-to-Point (PTP)
Publish-Subscribe systems
Request-Reply Messaging
![Page 8: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/8.jpg)
Publish-Subscribe Messaging
When multiple applications need to receive the same messages, Publish- Subscribe Messaging is used.
The central concept in a
Publish-Subscribe messaging system is the Topic.
In Publish-Subscribe Messaging
is that, there may be multiple Senders and multiple Receivers.
![Page 9: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/9.jpg)
Point- To-Point Messaging
When one process needs to send a message to another process, Point-To-Point Messaging can be used.
There are two basic types: • The first one involves a client
that directly sends a message to another client.
• The second and more common implementation is based on the concept of a Message Queue.
in Point-to-Point messaging even though there may be multiple Senders of messages, but there is only a single Receiver.
![Page 10: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/10.jpg)
Request-Reply Messaging
When an application sends a message and expects to receive a message in return, Request-Reply Messaging can be used.
It could be: • Synchronous • Asynchronous JMS does not explicitly support Request-
Reply Messaging, though it allows it in the context of the other methods.
![Page 11: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/11.jpg)
JMS API Programming Model
Connection
creates creates
creates
MsgDestination
receives from
sends to
ConnectionFactory
Destination
MessageConsumerSession
MessageProducer
creates
![Page 12: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/12.jpg)
JMS Messages
Message Header used for identifying and routing messages contains vendor-specified values, but could also contain
application-specific data typically name/value pairs
Message Properties (optional) Message Body(optional)
contains the data five different message body types in the JMS
specification :-Bytes Messages ,Map Messages, Object Messages, Stream Messages , Text Messages
![Page 13: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/13.jpg)
JMS Message Types
Message Type Contains Some MethodsTextMessage String getText,setText
MapMessage set of name/value pairs setString,setDouble,setLong,getDouble,getString
BytesMessage stream of uninterpreted bytes
writeBytes,readBytes
StreamMessage stream of primitive values
writeString,writeDouble,writeLong,readString
ObjectMessage serialize object setObject,getObject
![Page 14: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/14.jpg)
Development in JMS
JMS API was first introduced in 1998 JMS provider may implement message-driven
beans to process messages concurrently. Message sends and receives can participate in
Java Transaction API (JTA) The JMS API allows for a very loosely coupled
interaction between J2EE applications and existing Enterprise Information system (EIS).
![Page 15: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/15.jpg)
JMS Availability
Allaire Corporation - JRun Server BEA Systems, Inc. Brokat Technologies (formerly GemStone) IBM iPlanet (formerly Sun Microsystems, Inc. Java Message Queue) Oracle Corporation Pramati SilverStream Software, Inc. Sonic Software SpiritSoft, Inc. (formerly Push Technologies Ltd.) Talarian Corp. TIBCO Software, Inc.
![Page 16: Java Messaging Service](https://reader036.vdocument.in/reader036/viewer/2022080213/55a5f94f1a28ab3e188b4926/html5/thumbnails/16.jpg)
Thank You