Configure JMS connection factories and destinations

This page discusses - Configure JMS connection factories and destinations

Configure JMS connection factories and destinations

Configure JMS connection factories and destinations

Adding message queues and topics

The Java Message Service (JMS) programming interface provides a common way for Java programs to create, send, receive, and read asynchronous requests as JMS messages. Messages are sent to and received from queues or topics. For example, a Java program sends a message to a queue, the queue processes the request and then returns a message in another queue. Message-driven beans, listening for the response from the second queue, get the message and the cycle is complete. In a nutshell, JMS allows transactions to take place asynchronously.

A message queue, used in a Point-to-Point messaging system, receives messages from many senders and puts them in one queue to one receiver. That receiver might be, for example, an EIS system. A topic, used in a Publish-Subscribe messaging system, receives messages from many senders and sends them to many receivers, which subscribe to the topic.

This section tells you how to add queues and topics to your test environment or server so your program can access them at run time. Accessing a queue or topic is similar to accessing any resource needed by your program. You need to have a connection factory to generate a connection at run time and that connection needs to know the location of the queue or a topic (that is, the destination of the connection).

Adding queues and topics to your server configuration are done through the WebSphere JMS Provider Options page. You will find it as a JMS tab when you open a WebSphere V5.x server.

Note that the WebSphere JMS Provider Options page reflects the settings of IBM's internal WebSphere JMS server.

To add a message queue or topic to your server, follow these steps:

  1. In the Server Configuration view, expand Servers.

  2. Double-click on the TitanServer server. The server editor opens.

  3. Click the JMS tab at the bottom of the editor.

  4. Select the scope for the queue or topic you want to add. The scopes, from largest to smallest, are: cell, node and server. The relationship of the scopes is that a cell can contain many nodes and a node can contain many servers.

  5. In the JMS Server Properties section, click the Add button beside the Queue Names list box and add the names of any queues that you will specify in the JMS Connection Factories or JMS Destinations sections. The names must match.

    Queue name: ReservationQueue

  6. In the JMS provider section, select one of the following radio buttons:

    • Disable - Specifies that the initial state of the JMS server is not started.

    • MQ Simulator for Java Developers - MQ Simulator for Java Developers is an in-process MQ JMS service provider. It can be used to easily unit test message-driven beans and JMS applications within the WebSphere test environment. It does not support persistence or communication between processes.

    • Embedded Messaging - Embedded Messaging allows you to fully test and publish your applications within a JMS runtime environment. It is recommended that you install Embedded Messaging with the WebSphere Studio installer. You may need to perform some additional configuration steps if you have installed Embedded Messaging with the WebSphere Application Server installer.

    If you have selected Embedded Messaging, you will need to add the embedded messaging Java implementation classes. Click the Environment tab at the bottom of the editor. In the ws.ext.dirs section, click the Add External Folder button and add the directory containing the classes. The default value is: C:\Program Files\IBM\WebSphere MQ\java\lib.

  7. Beneath the JMS Connection Factories section, click the Add button beside the WASQueueConnectionFactory entries list table or the WASTopicConnectionFactory entries list table. In the pop-up dialog box, fill in the values for the connection factory. They are similar to the connection factory values you would fill in for any resource using the Java Naming and Directory Interface (JNDI). Some default values are provided for some properties such as number of connections and connection timeout. Other values may be selected from drop-down lists, where items have already been created. You will need to specify an alias name if for security reasons your application requires component-managed or container-managed authentication. A name for the connection factory and its JNDI name must be specified. For more information about any of the fields on this dialog box, select the field and then press F1.

    JMS Connection Factory: Name - ReservationQueueFactory, JNDI Name - jms/ReservationQueueFactory

  8. Beneath the JMS Destinations section, click the Add button beside the WASQueue entries list table or the WASTopic entries list table. Specify the destination values for the connection factory you just created. The name for the destination and its JNDI name must be specified.

    JMS Destinations: Name - ReservationQueue, JNDI Name - jms/ReservationQueue

    JMS
  9. Save and close the server editor.

Adding listener ports to a server

Listener ports are used by message-driven beans associated with the port to retrieve messages. They simplify administration of the association between a connection factory, JMS destination, and deployed message-driven bean. When a message arrives at the destination, the listener passes the message to a new instance of a message-driven bean for processing.

Note: Listener ports can only be added to a WebSphere v5.x test environment or server.

To add a listener port, follow these steps:

  1. Expand Servers in the Server Configuration view.

  2. Double-click TitanServer WebSphere test environment. The server editor opens.

  3. Click the EJB tab at the bottom of the editor. 0

  4. Click the Add button beside the Listener ports list table. The Add Listener Port dialog box opens.

  5. In the dialog box, fill in the values for the listener port (LP1). Some default values are provided for some properties such as maximum messages and maximum retries. Other values may be selected from drop-down lists, where items have already been created, such as connection factory JNDI name, and destination JNDI name. For more information about any of the fields on this dialog box, select the field and then press F1. Click OK.

    Listener port
  6. Save your changes and close the editor. 1

    Listener port

Tutorials

  1. Appendix A. Additional materials
  2. WSAD 5.0 Practicing for IBM Test 000-287 Mind Map
  3. Deploy enterprise applications into servers
  4. Chapter 6. Assemble enterprise applications and deploy them in IBM WebSphere Application Server
  5. Configure resource and security-role references
  6. Design and develop custom tags
  7. Chapter 4. Demonstrate understanding of database connectivity and messaging within IBM WebShpere Application Server
  8. Chapter 5. EJB transactions
  9. Design and develop message-driven EJBs
  10. Design and develop entity EJBs
  11. Validate operational parameters of application server to support the enterprise application
  12. Chapter 1. Design, build and test reusable enterprise components
  13. Access container and server services from enterprise components
  14. Part I. Exam Objectives
  15. Explain implications of resource management on application design and implementation
  16. Manage end-user state and understand performance tradeoffs of using HTTP sessions
  17. Chapter 7. Validate, tune and troubleshoot an application within an IBM WebSphere Application Server environment
  18. Implement mechanisms for efficient inter-component calls
  19. IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide
  20. Chapter 3. Develop clients that access the enterprise components
  21. Implement Java clients calling Web Services
  22. Configure JMS connection factories and destinations
  23. Design, develop and test JSPs
  24. Use JTA to control transaction demarcation
  25. Manipulate transactional behavior of EJBs using deployment descriptors
  26. Implement mechanisms which support loose coupling between clients and components
  27. Identify misbehaving application components
  28. Preface
  29. WSAD 5.0 Practicing for IBM Test 000-287
  30. Part II. Appendixes
  31. Interact with connection pools to obtain and release connections
  32. Describe the effects of a server failure on the application
  33. Test and debug enterprise components
  34. Chapter 2. Design, build and test web components
  35. Chapter 2. Design, build and test web components