1Z0-895 · Question #50
You are writing an EE component that functions as a message producer. The message producer sends message to a JMS queue. The component environment defines a resource-ref of type…
The correct answer is D. @Resource (loopkup = "jms/QueueConnectionFactory"). A 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 theConnectionFactory…
Question
Options
- AContext context = new initialContext();
- BInitialContext Context = new Context () ;
- C@Resource ("ConnectionFactory")
- D@Resource (loopkup = "jms/QueueConnectionFactory")
How the community answered
(37 responses)- A3% (1)
- B8% (3)
- C5% (2)
- D84% (31)
Explanation
A 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 theConnectionFactory, QueueConnectionFactory, or TopicConnectionFactory interface At the beginning of a JMS client program, you usually inject a connection factory resource into a ConnectionFactory object. For example, the following code fragment specifies a resource whose JNDI name is jms/ConnectionFactory and assigns it to a ConnectionFactory object: @Resource(lookup = "jms/ConnectionFactory") private static ConnectionFactory connectionFactory; The Java EE 6 Tutoria, The JMS API Programming Model
Topics
Community Discussion
No community discussion yet for this question.