This discussion is archived
6 Replies Latest reply: Oct 28, 2013 5:43 AM by HeSi9466 RSS

Use the same Queue table to send two different messages?!

HeSi9466 Newbie
Currently Being Moderated

Hi,

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!

 


  • 1. Re: Use the same Queue table to send two different messages?!
    user648708 Explorer
    Currently Being Moderated

    Hello,

     

    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.

     

     

    Kind regards,

     

     

    WoG

  • 2. Re: Use the same Queue table to send two different messages?!
    HeSi9466 Newbie
    Currently Being Moderated

    Hi,

     

    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?

     

    Thanks!

     

    / Hesam

  • 3. Re: Use the same Queue table to send two different messages?!
    user648708 Explorer
    Currently Being Moderated

    Hello Hesam,

     

    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.

     

    Kind regards,

    WoG

  • 4. Re: Use the same Queue table to send two different messages?!
    HeSi9466 Newbie
    Currently Being Moderated

    Hi WoG,

     

    Thanks for your answer!

    I will send my code for both creating the MGW staff and also the Queues here for you to look at!

    Thanks again for the help!

     

    Regards

     

    / Hesam

  • 5. Re: Use the same Queue table to send two different messages?!
    user648708 Explorer
    Currently Being Moderated

    Hello Hesam,

     

    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:

     

    BEGIN

       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.

     

     

    Kind regards,

    WoG

  • 6. Re: Use the same Queue table to send two different messages?!
    HeSi9466 Newbie
    Currently Being Moderated

    Hi WoG,

     

    Gradually i executed the scripts and it worked great!

    There was no error and the messages were transfer to the MQ in Websphere!

     

    Many thanks for your sincere help!

     

    / Hesam

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points