We have one inbound and one outbound queue in our database!
Now, we have to create another message content to send to IBM MQ series, so it's just an outbound messages (No incoming message!)
For the exsisting two queues we have the Message Gateway in place!
I was wondering if i can use the same outbound queue table and Message Gateway infrastructure to send another message payload (contect) to the IBM MQ.
Do you think it's possible?
Any more info just let me know!
Many thanks for your help!
normally, you define one AQ queue for one IBM MQ queue using the message gateway. That is a standard AQ configuration.
Now you want to define the same AQ queue for two different MQ queues. This is indeed possible, although it is a little bit tricky.
Here a short summary of the steps:
First of all you need a distinction in the queue payload type ( DBMS_AQADM.CREATE_QUEUE_TABLE => QUEUE_PAYLOAD_TYPE ).
This could be an object type (e.g. with a column like queue_id). Using the message gateway you have to define your configuration
using DBMS_MGWADM.REGISTER_FOREIGN_QUEUE etc. Here you have to define your subscribers via DBMS_MGWADM.ADD_SUBSCRIBER.
For this you work with transformations ( DBMS_TRANSFORM.CREATE_TRANSFORMATION ):
you specify which queue_id (from your queue_payload_type) corresponds to which MQ queue.
Result: calling DBMS_AQ.ENQUEUE for the same AQ but with different queue_id's the splitting will be executed automatically for two different MQ queues.
Many thanks for your detailed explanation!
" normally, you define one AQ queue for one IBM MQ queue using the message gateway. That is a standard AQ configuration"
If that's the standard, i also prefer to follow the standards and i think i should create a seperate queue table for this purpose including adding new queue,subscriber and....
But the problems is that it's the first time i working with AQ so i'm just wondering about the steps i should take!
I have somehow created the trigger for enqueuing the messages , so now i should create the others!
Since we already have the message gateway as our so called queue infrastructure, i'm gonna use that and not the DBlink!
How much of the Message Gateway set up you think i can re-use? (you know , the changes in the listener, tnsnames and libararies are all in place so i think that's a good point!)
Can i use our exsisting message gateway configuration?
(I guess at some point my new queue table should be mapped to that IBM MQ queue ? )
Do you think if I send my code , you might have time to look at it?
if you are a beginner concerning AQ it would be easier to configure a completely new AQ queue for MQ transport.
>Can i use our exsisting message gateway configuration?
You can reuse your AQ / MQ setup. In principle you can copy the basic code for your existing AQ.
Only the configuration data for your MQ setup is perhaps different (i.e. Queue Manager, Host, Channel, Port etc.),
if you don't want to use special / new functionalities.
>Do you think if I send my code , you might have time to look at it?
Yes, this would be possible.
first of all I could not detect something strange or even incorrect - perfect !
To your questions:
>1. have i defind this correct? "multiple_consumers => TRUE);"
Yes, this is correct. You have to define this in order to use MGW.
>2. I have omitted :gv_mq_inbound_log_queue :='ORACLE.002'; part because i don't have any incoming message to oracle, i just send messages in my case! >Is that correct?
Yes, this is also correct. Since your are transporting data from an AQ to MQ this in an outbound queue. An inbound queue would be
the other way round. You have configured your MQ as an remote queue ( sys.mgw_property('MQ_openOptions', '16') ).
You should clarify this again with your MQ administration group if this is correct. You cannot know this at this point.
The alternative would be a local queue ( value = 2066 ).
You did not show the part for enqueue. This should be something like:
v_message_text := p_message_text.GETCLOBVAL(); -- using XMLTYPE as payload type
v_text_body := SYS.MGW_TEXT_VALUE_T(NULL, v_message_text);
v_payload := SYS.MGW_BASIC_MSG_T(v_header, v_text_body, NULL);
DBMS_AQ.ENQUEUE(queue_name => p_queue_name,
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => v_payload,
msgid => v_msgid);
>3. The last one, do you think i'll reach my goal with all these code? Is there anything you think might be missing or..?
Yes, you will reach your goal using this code. Try it and tell me what happened.