Over a million developers have joined DZone.

Consuming Messages From Oracle AQ in WSO2 Enterprise Integrator 6

DZone's Guide to

Consuming Messages From Oracle AQ in WSO2 Enterprise Integrator 6

If you want your project be able to consume messages from a queue in OracleAQ without an LDAP, this tutorial is for you.

Free Resource

Discover how Microservices are a type of software architecture where large applications are made up of small, self-contained units working together through APIs that are not dependent on a specific language. Brought to you in partnership with AppDynamics.

In a project that we are working on, we have a requirement to consume messages from a Queue in OracleAQ. We can find some articles on how to do it, but all of them require an LDAP in front of AQ. In the customer environment, we don’t have that in place. In the documentation and articles we found, the LDAP was required to be able to use the JMS transport on WSO2 EI.

We were able to connect to the Oracle AQ using the JMS transport without adding custom code. Let’s see the steps we took:

Add The Required Jars

Place the required jar files in the [WSO2_EI_HOME]/lib directory:

  • aqapi.jar
  • jmscommon.jar
  • jta.jar
  • ojdbc6.jar

Configure The JMS Transport Receiver

Change the axis2.xml file to add the following configuration:

<transportReceiver name="oracleaq" class="org.apache.axis2.transport.jms.JMSListener">        
        <parameter name="myQueueConnectionFactory" locked="false">
            <parameter name="java.naming.factory.initial" locked="false">oracle.jms.AQjmsInitialContextFactory</parameter>
<parameter name="db_url" locked="false">[[Oracle_AQ_JDBC_URL]]</parameter>
<parameter name="java.naming.security.principal" locked="false">[[ORacle_AQ_D_bUser]]</parameter>
<parameter name="java.naming.security.credentials" locked="false">[[Oracle_AQ_DB_Password]]</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>

We defined a transport named "oracleaq."

Replace the JDBC URL, Username and Password. The db_url parameter is an OracleAQ specific parameter.

Create a ProxyService Listening to a Queue on Oracle AQ

Create a proxy like below, adding the required parameters to use the ConnectionFactory we defined in the previous configuration and the Queue Name:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
         <log level="full"/>
   <parameter name="transport.jms.DestinationType">queue</parameter>
   <parameter name="transport.jms.Destination">QUEUE_NAME</parameter>
   <parameter name="transport.jms.ContentType">
      <rules xmlns="">
   <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>

Basically, it is a proxy service using the OracleAQ transport that we defined previously with the required service parameters to pull the messages from the queue.

Now, if everything was okay, it will log the messages that it is pulling from the Oracle AQ Queue.

I hope you enjoyed.

See you in the next post.

Discover the six challenges and best practices in managing microservice performance, brought to you in partnership with AppDynamics.

wso2 esb ,oracle aq ,jms ,integration ,testng tutorial

Published at DZone with permission of Francisco Ribeiro, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}