Friday, October 7, 2011

How to pass the queue name dynamically to MQ Adapter

Requirement: To pass the queue name dynamically to MQ Adapter from a variable


Use-case: I have a process that is required to enqueue the data in one of the two MQs at runtime based on certain condition using single MQ Adapter. So if the condition is true the data is to be enqueued in queue A else in queue B. However, the payload schema remains the same in both the queues. (using SOA Suite 11.1.1.3)


Solution: Use the jca.mq.ISpec.EnqueueMsgToQ property appearing in the Properties tab of Invoke Activity. Assign the value of the property to the variable name which contains the MQ name.
Passing Queue Name from a variable


Setting the value to this variable will allow you to set the queue name dynamically in the process or from outside the process.


Advantage: MQ Adapter can be loosely coupled and kept in a separate composite which can be called by any caller composite. Also a single MQ Adapter can be used for en-queuing to multiple queues. 

4 comments:

  1. nice blog..

    i have a question neeraj.

    i am getting a payload from JMS Q and i want to assign the jndi name on fly.. dynamically..

    the above blog i got it but.. will we get the jndi name in the payload or we need to assign..

    ReplyDelete
  2. Thanks! Sorry for late reply. But still for others reference, the JNDI name could be either hard-coded (not preferred) in the process based on some switch cases or fetched from a DB to prevent the hard-coding. However, it can not be obtained from the fetched payload message from a Queue.

    ReplyDelete
  3. I have one problem with queue. I have 3 partition north 1,2 and 3 and with config plan i deploy my composite. But i need this : What is name of queue comming to my composit. For example partition 1 user queue1 partition 2 use queue 2 and partition 3 user queue3 but all of queue send message to one my composit. What is queue name 1 ,2 or 3?

    ReplyDelete
  4. I have this requirement in my oracle SOA suite development training but I am in confusion with your post I lean how to deal this.thank you.

    ReplyDelete