Chapter 2. OpenWire ActiveMQ Client APIs
Abstract
OpenWire is a cross language Wire Protocol that allows native access to ActiveMQ from different languages and platforms. It provides higher performance and reduced network bandwidth.
2.1. General Approach to Establishing a Connection
Steps to establish a connection
Regardless of the API in use, the pattern for establishing a connection between a messaging client and a message broker is the same. You must:
- Get an instance of the Red Hat JBoss A-MQ connection factory.Depending on the environment, the application can create a new instance of the connection factory or use JNDI, or another mechanism, to look up the connection factory.
- Use the connection factory to create a connection.
- Get an instance of the destination used for sending or receiving messages.Destinations are administered objects that are typically created by the broker. The JBoss A-MQ allows clients to create destinations on-demand. You can also look up destinations using JNDI or another mechanism.
- Use the connection to create a session.The session is the factory for creating producers and consumers. The session also is a factory for creating messages.
- Use the session to create the message consumer or message producer.
- Start the connection.
Note
You can add configuration information when creating connections and destinations.