API Gateway 10.3 | Using API Gateway | Policies | System-defined Stages and Policies | Transport | Enable JMS/AMQP | Configuring API Gateway for JMS with AMQP Protocol
 
Configuring API Gateway for JMS with AMQP Protocol
Before configuring AMQP in API Gateway, ensure your message broker supports AMQP 1.0
For using JMS with AMQP protocol in API Gateway you have to configure the appropriate settings for the provider URL and the connection factory lookup name required for API Gateway to communicate using JMS with AMQP protocol.
To configure API Gateway to use JMS with AMQP protocol
1. Create a properties file that contains the information for the JNDI lookup name and connectionfactory details.
2. Configure JNDI settings as per the client you are using to achieve JMS over AMQP protocol support.
For a detailed procedure, see Creating a JNDI Provider Alias.
3. Configure JMS settings as per the client you are using to achieve JMS over AMQP protocol support.
For a detailed procedure, see Creating a JMS Connection Alias.
*To configure API Gateway for JMS with AMQP protocol using Apache qpid libraries
1. Create a properties file that contains the information for the JNDI lookup name and connectionfactory details.
A sample properties file, for example amqp.properties, would look like
# Set the InitialContextFactory class to use
java.naming.factory.initial = org.apache.qpid.jms.jndi.JmsInitialContextFactory
# Define the required ConnectionFactory instances
# connectionfactory.<JNDI-lookup-name> = <URI>
connectionfactory.qpidConnectionFactory = amqp://<hostname>:<port#>
2. Navigate to > Administration.
3. Select General > Messaging.
4. Configure the JNDI provider alias as follows:
a. Click Add JNDI provider alias in the JNDI provider alias definitions section.
b. Provide the following information:
*JNDI Alias Name. Provide a name that you want to assign to this JNDI provider.
*Description. Provide a brief description for this JNDI alias.
*Predefined JNDI Templates. Select the predefined JNDI template depending on the provider you may want to use.
For example, if you want to use the JMS with AMQP protocol, select Qpid AMQP (0-x).
*Initial Context Factory. The JNDI provider uses the initial context as the starting point for resolving names for naming and directory operations. This value gets pre-populated depending on the predefined JNDI template selected. For example, if you have selected Qpid AMQP (0-x) as the predefined JNDI template the Initial context factory field would display org.apache.qpid.jms.jndi.JmsInitialContextFactory.
*Provider URL. Provide the file path location of the properties file that contains the context factory details. For example, C:\amqp.properties
c. Click Add.
The JNDI provider alias is created and listed in the JNDI Provider alias definitions table.
5. Configure the JMS settings as follows:
a. Click Add JMS connection alias in the JMS connection alias definitions section.
b. Provide the following information in the General Settings section:
*Connection Alias Name. Provide a name for the connection alias. Each connection alias represents a connection factory to a specific JMS provider.
*Description. Provide a brief description for the connection alias.
c. Provide the following information in the Connection Protocol Settings section:
*JNDI Provider Alias Name. The alias to the JNDI provider that you want this JMS connection alias to use to look up administered objects. Select the JNDI Provider alias name created in the earlier step.
*Connection Factory Lookup Name. The lookup name for the connection factory that you want to use to create a connection to the JMS provider specified in this JMS connection alias. Provide the value qpidConnectionFactory.
d. Click Add.
The JMS Connection alias is created and listed in the JMS Connection Alias Definitions table.
e. Enable the JMS connection alias by clicking toggle button to enable it.
The JNDI provider alias and the JMS connection alias are now set up and API Gateway is configured to use JMS with AMQP protocol.