Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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.

· Integration Zone ·
Free Resource

How to Transform Your Business in the Digital Age: Learn how organizations are re-architecting their integration strategy with data-driven app integration for true digital transformation.

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>
        </parameter>
</transportReceiver>


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"
       name="AQProxyService"
       transports="oracleaq"
       startOnLoad="true">
   <description/>
   <target>
      <inSequence>
         <log level="full"/>
      </inSequence>
      <outSequence/>
      <faultSequence/>
   </target>
   <parameter name="transport.jms.DestinationType">queue</parameter>
   <parameter name="transport.jms.Destination">QUEUE_NAME</parameter>
   <parameter name="transport.jms.ContentType">
      <rules xmlns="">
         <jmsProperty>contentType</jmsProperty>
         <default>application/xml</default>
      </rules>
   </parameter>
   <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
</proxy>


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.

Make your mark on the industry’s leading annual report. Fill out the State of API Integration 2019 Survey and receive $25 to the Cloud Elements store.

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

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}