Explain the administered objects in JMS.
Explain the administered objects in JMS.
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;