Explain the administered objects in JMS.

Answered

Explain the administered objects in JMS.

Ninja Asked on 19th September 2018 in JMS.
Add Comment
1 Answer(s)
Best answer

The two administered objects in JMS are connection factories and destinations. These two objects are created administratively.

A JMS connection factory is the object a client uses to create a connection to a provider. A connection factory encapsulates a set of connection configuration parameters that has been defined by an administrator. Each connection factory is an instance of the ConnectionFactory, QueueConnectionFactory, or TopicConnectionFactory interface.  A connection factory is injected as a resource into ConnectionFactory in the JMS client program that tries to produce or consume message.

@Resource(lookup = “jms/DemoConnectionFactory”)

private static ConnectionFactory connectionFactory;

A destination is the object a client uses to specify the target of messages it produces and the source of messages it consumes. In the PTP messaging domain, destinations are called queues. In the pub/sub messaging domain, destinations are called topics. A JMS application can use multiple queues or topics (or both). In addition to injecting a connection factory as a resource in the JMS client program, a destination is also injected as shown below:

@Resource(lookup = “jms/DemoQueue”)

private static Queue queue;

@Resource(lookup = “jms/DemoTopic”)

private static Topic topic;

Ninja Answered on 19th September 2018.
Add Comment