Consumer application basics

For a JMS consumer application, perform the basic steps contained in this topic.

  1. Retrieve a connection factory object from a JNDI repository.
  2. Create a connection using the connection factory object.
  3. Create a session using the connection object.
  4. Retrieve a destination object from a JNDI repository.
  5. Use the session object and the destination object to create a message consumer.
  6. Use the message consumer to receive messages from the destination.

    In order for a consumer to receive messages, there must be a producer sending messages to the same destination from which the consumer is attempting to receive.

    For persistent or transacted workloads on Eclipse Amlen, you can maximize performance by increasing the value of IMADeliveryThreads environment variable. The IMADeliveryThreads environment variable has a default value of 2. In persistent or transacted workloads it can be helpful to increase this value up to 100. The optimal value depends on several factors:
    • The number of cores that are allocated to the Eclipse Amlen VM.
    • The number of cores that are allocated to the application using the Eclipse Amlen JMS client library.
    • The number of concurrent and active connections between the application and the Eclipse Amlen VM.

    As these numbers increase, you can increase the value of IMADeliveryThreads to maximize performance.