blob: f657cf008c025fb947bcb79f0942fcbeab174739 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ActiveMQ</title>
<link rel="icon" type="image/png" href="/assets/img/favicon.png">
<link rel="stylesheet" href="/css/main.css">
<script defer src="/js/fontawesome-all.min.js" integrity="sha384-rOA1PnstxnOBLzCLMcre8ybwbTmemjzdNlILg8O7z1lUkLXozs4DHonlDtnE7fpc"></script>
<script src="/js/jquery.slim.min.js" integrity="sha384-5AkRS45j4ukf+JbWAfHL8P4onPA9p0KwwP7pUdjSQA3ss9edbJUJc/XcYAiheSSz"></script>
<script src="/js/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"></script>
<script src="/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light fixed-top">
<div class="container">
<!-- <a class="navbar-brand mr-auto" href="#"><img style="height: 50px" src="assets/img/apache-feather.png" /></a> -->
<a class="navbar-brand mr-auto" href="/"><img src="/assets/img/activemq_logo_black_small.png" style="height: 50px"/></a>
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="ml-auto collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link active" href="/news">News</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDropdownComponents" data-target="#" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Components<span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-center" aria-labelledby="navbarDropdownComponents">
<div class="row">
<div class="col-12">
<ul class="multi-column-dropdown">
<li class="nav-item"><a class="dropdown-item" href="/components/classic">ActiveMQ Classic</a></li>
<li class="nav-item"><a class="dropdown-item" href="/components/artemis/">ActiveMQ Artemis</a></li>
<li class="nav-item"><a class="dropdown-item" href="/components/nms">NMS Clients</a></li>
<li class="nav-item"><a class="dropdown-item" href="/components/cms">CMS Client</a></li>
</ul>
</div>
</div>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDropdownCommunity" data-target="#" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Community<span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-center multi-column columns-1" aria-labelledby="navbarDropdownCommunity">
<div class="row">
<div class="col-12">
<ul class="multi-column-dropdown">
<li class="nav-item"><a class="dropdown-item" href="/contact">Contact Us</a></li>
<li class="nav-item"><a class="dropdown-item" href="/contributing">Contribute</a></li>
<li class="nav-item"><a class="dropdown-item" href="/issues">Report Issues</a></li>
<li class="nav-item"><a class="dropdown-item" href="/support">Get Support</a></li>
</ul>
</div>
</div>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDropdownTeam" data-target="#" href="" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><img src="/assets/img/feather.png" style="height:20px">Apache<span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-center multi-column columns-1" aria-labelledby="navbarDropdownTeam">
<div class="row">
<div class="col-sm-12">
<ul class="multi-column-dropdown">
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org">The Apache Software Foundation</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/licenses/">License</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
<li class="nav-item"><a class="dropdown-item" href="/security-advisories">Security</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://www.apache.org/events/current-event">Events</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://people.apache.org/phonebook.html?pmc=activemq">PMC & Committers</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://whimsy.apache.org/board/minutes/ActiveMQ.html">Board Reports</a></li>
<li class="nav-item"><a class="dropdown-item" href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy Policy</a></li>
</ul>
</div>
</div>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div class="page-title-classic">
<div class="container">
<h1>JMS Bridge With Oracle AQ</h1>
</div>
</div>
<div class="container" >
<div class="row" style="margin-top: 30px">
<div class="col-12 classic">
<p><a href="using-activemq-classic">Using ActiveMQ Classic</a> &gt; <a href="user-submitted-configurations">User Submitted Configurations</a> &gt; <a href="jms-bridge-with-oracle-aq">JMS Bridge With Oracle AQ</a></p>
<h3 id="example-of-a-configuration-that-shows-how-to-connect-to-oracle-aq-queues-and-topics">Example of a configuration that shows how to connect to Oracle AQ queues and topics.</h3>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;beans&gt;
&lt;!-- Allows us to use system properties as variables in this configuration file --&gt;
&lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/&gt;
&lt;broker useJmx="true" persistent="false" xmlns="http://activemq.org/config/1.0"
brokerName="localhost" dataDirectory="${activemq.base}/data" &gt;
&lt;/broker&gt;
&lt;camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring"&gt;
&lt;!-- Dependencies: ojdbc.jar and aqjms.jar must be in the activemq lib directory --&gt;
&lt;!-- this camel route will read incoming messages from Oracle --&gt;
&lt;route&gt;
&lt;from uri="oracleQueue:queue:ORACLE_QUEUE"&gt;
&lt;to uri="activemq:queue:queue.inboundOracleAQqueue" &gt;
&lt;/route&gt;
&lt;route&gt;
&lt;!-- NOTE: I have had success with a topic using ActiveMQ Classic 5.3, but not 5.1 --&gt;
&lt;from uri="oracleTopic:topic:ORACLE_TOPIC"&gt;
&lt;to uri="activemq:queue:queue.inboundOracleAQtopic" &gt;
&lt;/route&gt;
&lt;!-- these camel routes will log the messages to the console .... replace them with something more useful!! --&gt;
&lt;route&gt;
&lt;from uri="activemq:queue:queue.inboundOracleAQqueue" &gt;
&lt;to uri="log:oracleAQ.inbound.got_a_queue_message?level=ERROR"&gt;
&lt;/route&gt;
&lt;route&gt;
&lt;from uri="activemq:queue:queue.inboundOracleAQtopic" &gt;
&lt;to uri="log:oracleAQ.inbound.got_a_topic_message?level=ERROR"&gt;
&lt;/route&gt;
&lt;/camelContext&gt;
&lt;!-- without the following bean instantiation, we will get an oracle.jms.AQjmsException with each and every received message --&gt;
&lt;bean id="requiredBeanForOracleAq" class="org.apache.activemq.ActiveMQConnectionFactory" /&gt;
&lt;bean id="connectionFactoryOracleAQQueue" class="oracle.jms.AQjmsFactory" factory-method="getQueueConnectionFactory"&gt;
&lt;constructor-arg index="0"&gt;
&lt;value&gt;jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST ....... (SERVICE_NAME = myDbService)))&lt;/value&gt;
&lt;/constructor-arg&gt;
&lt;constructor-arg index="1" type="java.util.Properties"&gt;
&lt;value&gt;&lt;/value&gt;
&lt;/constructor-arg&gt;
&lt;/bean&gt;
&lt;bean id="connectionFactoryOracleAQTopic" class="oracle.jms.AQjmsFactory"
factory-method="getQueueConnectionFactory"&gt;
&lt;constructor-arg index="0"&gt;
&lt;value&gt;jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST ....... (SERVICE_NAME = myDbService)))&lt;/value&gt;
&lt;/constructor-arg&gt;
&lt;constructor-arg index="1" type="java.util.Properties"&gt;
&lt;value&gt;&lt;/value&gt;
&lt;/constructor-arg&gt;
&lt;/bean&gt;
&lt;bean id="oracleQueueCredentials" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter"&gt;
&lt;property name="targetConnectionFactory"&gt;
&lt;ref bean="connectionFactoryOracleAQQueue"&gt;
&lt;/property&gt;
&lt;property name="username"&gt;
&lt;value&gt;foo&lt;/value&gt;
&lt;/property&gt;
&lt;property name="password"&gt;
&lt;value&gt;bar&lt;/value&gt;
&lt;/property&gt;
&lt;/bean&gt;
&lt;bean id="oracleTopicCredentials" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter"&gt;
&lt;property name="targetConnectionFactory"&gt;
&lt;ref bean="connectionFactoryOracleAQTopic"&gt;
&lt;/property&gt;
&lt;property name="username"&gt;
&lt;value&gt;foo&lt;/value&gt;
&lt;/property&gt;
&lt;property name="password"&gt;
&lt;value&gt;bar&lt;/value&gt;
&lt;/property&gt;
&lt;/bean&gt;
&lt;bean id="oracleQueue" class="org.apache.camel.component.jms.JmsComponent"&gt;
&lt;property name="connectionFactory" ref="oracleQueueCredentials"&gt;
&lt;/bean&gt;
&lt;bean id="oracleTopic" class="org.apache.camel.component.jms.JmsComponent"&gt;
&lt;property name="connectionFactory" ref="oracleTopicCredentials"&gt;
&lt;/bean&gt;
&lt;/beans&gt;
</code></pre></div></div>
<p>If you run in an OSGi environment such as <a href="http://servicemix.apache.org">ServiceMix 4</a> then take a look at <a href="http://servicemix.396122.n5.nabble.com/ServiceMix-4-2-Camel-OracleAQ-td421214.html#a421214">this discussion</a> how to install the OracleAQ Client in the OSGi container.</p>
<h4 id="oracle-sql-code">Oracle SQL code</h4>
<p>You may need to setup OracleAQ, and here is a sample code</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE( queue_table =&gt; 'queue_message_table', queue_payload_type =&gt; 'SYS.AQ$_JMS_TEXT_MESSAGE');
END;
BEGIN
DBMS_AQADM.CREATE_QUEUE( queue_name =&gt; 'ORACLE_QUEUE', queue_table =&gt; 'queue_message_table');
END;
BEGIN
DBMS_AQADM.START_QUEUE(queue_name =&gt; 'ORACLE_QUEUE');
END;
</code></pre></div></div>
<p>You can also find more information about OracleAQ and using JMS at: <a href="http://docs.oracle.com/cd/B13789_01/server.101/b10785/jm_exmpl.htm">http://docs.oracle.com/cd/B13789_01/server.101/b10785/jm_exmpl.htm</a></p>
</div>
</div>
</div>
</div>
<div class="row sitemap">
<div class="col-sm-12">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-3">
<div >
<img class="float-left" style="max-height: 100px" src="/assets/img/activemq_logo_white_vertical_small.png"/>
</div>
</div>
<div style="text-align: center; margin-bottom: 0px; margin-top: 30px; font-size: 65%" class="col-sm-6">
<p><a href="https://www.apache.org/foundation/marks/list/">Apache, ActiveMQ, Apache ActiveMQ</a>, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. Copyright &copy; 2024, The Apache Software Foundation. Licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License 2.0</a>.</p>
</div>
<div class="col-sm-3">
<div >
<a href="https://www.apache.org"><img class="float-right" style="margin-top: 10px; max-height: 80px" src="/assets/img/apache-logo-small.png"/></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>