JMS
JMS
---------------------------------------------
JMS means Java Messaging Service. It is the new standard for inter client
communication. It allows the J2EE application component to create, send, read and
receive the messages.
Queue technique is used for one to one messaging, and it supports point to point
messaging.
Topic is typically used for one to many messaging and it supports public subscribe
model of messaging.
Byte message
------------
Byte message is a stream of uninterrupted bytes. It contains an array of primitive
bytes in its payload. For the transfer of data between two applications in their
native format, byte message is used, which may be not possible with other message
types.
StreamMessage
------------
StreamMessage object is used to send the stream of primitive data types in the Java
programming language. The data are sequentially filled and read. It inherits from
the Message interface and adds a stream message body.
Text Message
-------------
Text message is the one that is taken care of by java.lang.String and it inherits
from the message interface and adds a text message body. This is used to transport
the messages containing a text.
object message
--------------
object message generally contains a serializable Java object in its message body.
Generally, the receiver application receives the Object message in a read-only
mode.
Map Message
---------------
Map Message object contains a set of name-value pairs, where the names are String
objects, and values are Java primitives.
JMS VS RPC:
------------
In the case of JMS, the sender application sends the message to the destination
application and then it again waits/or processes another message as per the
programming criteria.
While in the case of RPC, the thread is completed once the message reaches the
destination and the control comes back to the method responsible for message
transport.
JNDI
-----------
JNDI is the Java Naming and Directory Interface. If an application is connected to
a database, it allows the application developer to give a name to that database
instead of worrying about the database connection credentials.
The JNDI API will access the naming directory and will find the mapping between the
name and the database object and connect accordingly. We can use this mechanism
while we are connecting to any connectionFactory (queue or topic) for sending
messages.
JMS Sub-deployment
-------------------
A subdeployment is a mechanism by which JMS module resources (such as queues,
topics, and connection factories) are grouped and targeted to a server resource
(such as JMS servers, server instances, SAF agents, or a cluster)\
Foreign server:
----------------
A Foreign Server represents a JNDI provider that is outside WebLogic server. It
contains information that allows a local WebLogic Server instance to reach a remote
JNDI provider, thereby allowing for a number of foreign connection factory and
destination objects to be defined on one JNDI directory.
Connection factory
--------------------
A connection factory is an object that a JMS client (a JMS program that uses the
JMS API) uses to create a connection with a JNDI provider.
It is a set of connection configurations parameters that are used to create
connections between JMS clients using JNDI provider.
JMS topic
------------
pub-sub model . It is distributed to all topic consumers. If a consumer registers
itself as a durable subscriber with the broker, then any messages sent to the topic
while the subscriber is away, will be sent to the consumer when they come back
online.
JMS queue
---------------
point-to-point destination model . It is distributed to only one consumer.
Distributed Queue
------------------------------
Defines a set of queues that are distributed on multiple JMS servers, but which are
accessible as a single, logical queue to JMS clients.
Distributed Topic
------------------------------
Defines a set of topics that are distributed on multiple JMS servers, but which are
accessible as a single, logical topic to JMS clients.
XA vs NON XA transaction:
--------------------------
XA: it can use multiple transactions at a time between different applications.
NON-XA: It can use only one transaction at a time.
JMS persistence:
------------------
Ensure that message will not be lost in case of failure.