Tuesday, August 17, 2010

Creating JMS Queue/Topic Connection Factory

Create JMSUSER User

The script below creates the JMSUSER database user (which will be used for queue access for this scenario). The commands must run with a user that has system privileges on the designated database (e.g. SYSTEM).

DROP USER jmsuser CASCADE;
CREATE USER jmsuser IDENTIFIED BY jmsuser;
GRANT CONNECT, RESOURCE,
AQ_ADMINISTRATOR_ROLE, AQ_USER_ROLE to
jmsuser;
GRANT EXECUTE ON DBMS_AQADM TO jmsuser;
GRANT EXECUTE ON DBMS_AQ TO jmsuser;

Creating JMS Queues

This script creates and starts the JMS queues that will be used to function as the source and destination, respectively, for the JMS messages being transferred from Siebel. This script should be executed as the JMSUSER created above.

BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE
(Queue_table => 'jmsuser.JMSDEMO_QUEUE_TABLE',
Queue_payload_type =>'SYS.AQ$_JMS_TEXT_MESSAGE',
compatible =>'8.1.0');
DBMS_AQADM.CREATE_QUEUE (Queue_name
=> 'jmsuser.JMSDEMO_QUEUE,
Queue_table =>'jmsuser.JMSDEMO_QUEUE_TABLE');
DBMS_AQADM.START_QUEUE (Queue_name =>
'jmsuser.JMSDEMO_QUEUE);
END;


Creating JMS Topic

This script creates and starts the JMS queues that will be used to function as the source and destination, respectively, for the JMS messages being transferred from Siebel. This script should be executed as the JMSUSER created above.

BEGIN
DBMS_AQADM.CREATE_QUEUE_TABLE
(Queue_table => 'jmsuser.JMSDEMO_QUEUE_TABLE',
Queue_payload_type =>'SYS.AQ$_JMS_TEXT_MESSAGE',
multiple_consumers=>true,compatible =>'8.1.0');
DBMS_AQADM.CREATE_QUEUE (Queue_name
=> 'jmsuser.JMSDEMO_TOPIC',
Queue_table =>'jmsuser.JMSDEMO_QUEUE_TABLE');
DBMS_AQADM.START_QUEUE (Queue_name =>
'jmsuser.JMSDEMO_TOPIC');
END;

Configure the Application Server for OJMS

Configure the OJMS provider within the resource-provider element in the global application.xml file (in $SOA_HOME/ j2ee/<OC4J container>/config/).

It is possible to configure the resource provider with a URL property.

The following demonstrates a URL configuration:
Add below XML Tag before <imported-shared-libraries> tag in the file: $ORACLE_HOME/j2ee/<<oc4j container>>/config/application.xml

**For OJMS Topic/Queue**

<resource-provider class="oracle.jms.OjmsContext" name="JMSAQ">
<description>Resource provider for the JMSAQ database</description>
<property name="url" value="jdbc:oracle:thin:jmsuser/jmsuser@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(LOAD_BALANCE = no)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = XE)))"/>
</resource-provider>

**For OJMS Queue/Topic **

<resource-provider class="oracle.jms.OjmsContext" name="JMSAQueue">
<description>Resource provider for the JMSAQ database</description>
<property name="url" value="jdbc:oracle:thin:jmsuser/jmsuser@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(LOAD_BALANCE = no)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = XE)))"/>
</resource-provider>

**For JMS Topic Connection Factory Creation from EM Console **

Configure JMS Adapter Details in Oracle SOA server

Below steps need to be done in all BPEL, ESBR and ESBD oc4j instances from enterprise manager console

1. Log in to enterprise manager console, http://<as server control host>:<port>/em
2. Click on BPEL or ESBR or ESBD oc4j instance
3. Go to ApplicationsChange the view to ‘Standalone Resource Adapters’
4. Click on ‘JMS Adapter’ and then ‘Connection Factories’ tab
5. Click on ‘Create’


6. Click on ‘Continue‘
7. Enter the below details

JNDI Location : eis/Jms/JMSAQ
acknowledgeMode : AUTO_ACKNOWLEDGE
connectionFactoryLocation java:comp/resource/JMSAQ/TopicConnectionFactories/JMSAQConnFact
isTopic : True
isTransacted : True
Password : <<JMS User Password )>>
Username : JMSUSER
 Delete all other details in the text boxes in the screen which are not mentioned in the above table. (Connection Pooling  No Connection Pool)



8. Click on Finish


**For JMS Queue Connection Factory Creation from EM Console **

Configure JMS Adapter Details in Oracle SOA server

1.Log in to enterprise manager console, http://<as server control host>:<port>/em
2.Click on BPEL or ESBR or ESBD oc4j instance
3.Go to ApplicationsChange the view to ‘Standalone Resource Adapters’
4.Click on ‘JMS Adapter’ and then ‘Connection Factories’ tab
5.Click on ‘Create’



6.Click on ‘Continue‘
7.Enter the below details

JNDI Location : eis/Jms/JMSAQueue
acknowledgeMode : AUTO_ACKNOWLEDGE
connectionFactoryLocation java:comp/resource/JMSAQueue/QueueConnectionFactories/JMSAQueueConnFact
isTopic : False
isTransacted : True
password : <<JMS User Password )>>
username : JMSUSER

Delete all other details in the text boxes in the screen which are not mentioned in the above table. (Connection Pooling  No Connection Pool)


8.Click on Finish


**For JMS Queue Connection Factory Creation from backend **

In the oc4j-ra.xml file (in $SOA_HOME/ j2ee/<OC4J container>/applicationdeployments/
default/JmsAdapter/), add the following code segments:

<connector-factory location="eis/jms/<QueueConnectionName>" connector-name="JmsAdapter">
<config-property name="connectionFactoryLocation" value="
java:comp/resource/JMSAQueue/QueueConnectionFactories/JMSAQueueConnFact " />
<config-property name="factoryProperties" value="" />
<config-property name="acknowledgeMode" value="AUTO_ACKNOWLEDGE" />
<config-property name="isTopic" value="false" />
<config-property name="isTransacted" value="true" />
<config-property name="username" value="jmsuser" />
<config-property name="password" value="jmsuser" />
</connector-factory>


**For JMS Topic Connection Factory Creation from backend **

In the oc4j-ra.xml file (in $SOA_HOME/ j2ee/<OC4J container>/applicationdeployments/
default/JmsAdapter/), add the following code segments:

<connector-factory location="eis/jms/<QueueConnectionName>" connector-name="JmsAdapter">
<config-property name="connectionFactoryLocation" value="
java:comp/resource/JMSAQ/TopicConnectionFactories/JMSAQConnFact " />
<config-property name="factoryProperties" value="" />
<config-property name="acknowledgeMode" value="AUTO_ACKNOWLEDGE" />
<config-property name="isTopic" value="true" />
<config-property name="isTransacted" value="true" />
<config-property name="username" value="jmsuser" />
<config-property name="password" value="jmsuser" />
</connector-factory>

Restart the OC4J container concerned before running the test to clear the current container cache.