Friday, February 27, 2009

Creating AQ JMS Queue

Hi,
In this post i shall give information on creating AQ JMS Queues.
These JMS queues are database persisitant and can be accessed from the JMS Adapter.
Creating a AQ JMS queue has 3 steps:
1)Create a user in the DB: jmsuser/jmsuser
2)Create a queue table
3)Create the queue inside the queue table.

1)Creating the jmsuser :
Log on to Sql from command promt or SQl*plus and Create a user

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;
GRANT EXECUTE ON DBMS_LOB TO jmsuser;
GRANT EXECUTE ON DBMS_JMS_PLSQL TO jmsuser;

2)Creating Queue table
Login to SQL as jmsuser and run the below command

DBMS_AQADM.CREATE_QUEUE_TABLE(Queue_table => 'AQJMSQueueTab',Queue_payload_type => 'SYS.AQ$_JMS_MESSAGE');

3)Creating the AQ JMS queue
Now create a JMS queue inside the above created table and start the queue

DBMS_AQADM.CREATE_QUEUE( 'AQJMSQueue', 'AQJMSQueueTab');
DBMS_AQADM.START_QUEUE('AQJMSQueue');

Now this queue can be accessed from the JMS adapter.

To create a JMS topic create a Queue table with a propetry "multiple_consumer" set to true.
And then create a queue inside this table.

Happy Learning

Regards
Ashwini