Multiple queue receivers with disjoint message selectors - portable?

Hi all,
I was wondering whether an application that uses multiple queue receivers with disjoint message selectors would be portable across different JMS providers.
I fear it's not - at least the spec clearly states that the implementation of message delivery to multiple receivers is provider specific, and I couldn't find any comment that this would be different with disjoint selectors. But I wanted to check with you - maybe I missed anything?
What could be an alternative then (in case you want to avoid multiple queues)? Using a topic with durable subscribers?
Regards,
Sabine

Hi Nimo,
accepted - as long as the JMS spec requires the JMS provider to support multiple receivers. And that's exactly the point where I'm not sure...
Literally it states:
"For PTP, JMS does not specify the semantics of concurrent QueueReceivers for the same queue; however, JMS does not prohibit a provider from supporting this."
The formulation "does not prohibit" makes me think that JMS allows providers also not to support this, for example, to throw an exception when a second consumer is created for the same queue, or not to serve it at all with messages as long as the first consumer is active. Not that I think it would be a very useful implementation - I just want to know if it would be possible. In that case, the application would not be portable.
Regards,
Sabine

Similar Messages

  • Behaviour of multiple queue receivers on same queue

    I have been trying to find out what exactly the jms specification states about having multiple queue receivers registered on the same queue. Some books and people say that one is only supposed to register one queue receiver per queue, if this is the case then one might as well use one topic subscriber per topic (what is the utiliy of a queue then).
    I believe that one is allowed to register multiple queue receivers on a queue, and a message will only be consumed by exactly one and only one queue receiver, thus allowing for true parallel processing. This is the behaviour I have observed when using jms on both JBoss and Weblogic (and apparantly is the same on Websphere).
    I have looked at the formal JMS spec from sun and they dont make it clear what the behaviour of multiple queue receivers on queue is. Can somebody PLEASE help me clear this up.

    The behaviour is undefined by the spec. Here is what it says:
    "Although it is possible to have two sessions with a QueueReceiver for the same queue, JMS does not define how messages are distributed between the QueueReceivers."
    However, multiple receivers on a single queue is a very popular design pattern. A typically pattern is to use the queue as a worklist and for work items to be posted to the queue. There is then a collection of workers who are registered as queue receivers picking out their work items from the queue. These workers are processing in parallel and as the workload increases you respond by add more workers.
    This pattern is usable where message ordering is not important and that the workers are stateless.
    Steve

  • Want to add multiple idoc type with single message type.

    Hi Gurus,
    I have a problem. I want to add multiple idoc type with single message type in WE20.
    How we can do this in WE20 or is there any other way to do that?
    Please help me.
    Thanks in advance.
    Srimanta.

    hi,
    basically in partner profile i.e. in we20 , we add details to the receiver / sender port that we have created using we21.
    so what exactly we do in that is that we first use the message type for those idocs that we have created.
    now based on those message type we create a process code. now this is the reason why you cannot apply several message types with the same name in we20... as process code is unque for each message type.
    so thats why you can only assign the same message name to several idocs in we82 and then in we20 define the process code for that message type.
    it will solve your problem.
    hope this will help you!!!
    Thanks & regards,
    punit raval.

  • Synchronous operation with a message selector possible?

    I have a situation where the following condition exists:
    - a number of servlet threads (1-n) will post to request to an external asynchronous system with a unique id.
    - the external system will post the responses to a JMS queue.
    - my servlet threads need to receive their - and only their message from the queue
    - my servlet threads need to have timeout
    The problem is, I need the selectivity of a message selector, but also the timeout of a .receive() method.
    I have considered filtering the responses in each onMessage event, but this will not scale well when many responses exist.
    Any recommendations will be appreciated.

    I think I answered my own question. I was confusing a MessageSelector with a MessageListener - two different animals....
    I was able to implement the pub/sub with the following syntax:
    /* the publisher would put the transaction_id (unique id) in the
    JMSCorrelationID field in the message header. */
    message.setJMSCorrelationID(transaction_id);          
    /* The subscriber will only receive messages that match this trans ID. This will be accomplished by adding the following MessageSelector clause to the subscriber session:*/
    String selector = "JMSCorrelationID = '"+transaction_id+"'";
    subscriber = subscriberSession.createSubscriber(topic,selector,true);
    "Astitva" , thanks for the help!

  • How to handle multiple inbound interfaces with WSDL messages

    Hi All,
    We have a synchronous: Abap Proxy -> XI -> WebService Scenario. The webservice has multiple SoapActions e.g. SearchForProduct_WithX, SearchForProduct_WithY each with different message types. We have tried to use the receiver determination to send the request to the correct soapaction using conditions e.g. if field X in the request is populated use SearchForProduct_WithX action/message.
    But when we run it through the proxy we get this error:
      <CODE>IF_DETERMINATION.TOO_MANY_IIFS_CASE_BE</CODE>
      <ERRORTEXT>Multiple inbound interfaces not supported for synchronous calls</ERRORTEXT>
    Does anybody know how we can get around this or how best to deal with the multiple soap actions per wsdl situation.

    Hi Yaghya,
    We have used conditions in the Interface Determination. Interestingly if we use an HTTP sender adapter we can use this configuration ... but once we try and use ABAP proxies we get the previous error.
    Another related question ... when we use the http adapter we get a connection time out exception. Same thing happens if we try and use the wsdl tester at /wsnavigator but we can open the wsdl through the browser. Any idea on this one?
    Thanks for all your help.

  • Multiple event receivers with a list

    Hi All,
    If there are two item event receivers attached with a list and event is cancelled by event receiver that trigger first, will second event receiver be invoked? As per my understanding that second event receiver will not be invoked.
    I have a requirement where in case first event receiver cancel the event, second event recever should still be invoked.
    do anyone has any idea aroound it?
    Regards Amit

    Hi, Amit KM.
    http://msdn.microsoft.com/en-us/library/gg749858.aspx
    Notice the following details:
    Synchronous event receivers are called in sequential order based on the sequence number specified during event binding. This applies to both Before and After synchronous events.
    Asynchronous After event receiver threads are initiated in sequential order based on the sequence number. However, there is no guarantee that they will finish in that same order.
    An asynchronous After event can start at any time after its associated user action is performed. It may start before, at the same time as, or after the Web request is completed.
    After a user initiates an action in the SharePoint user interface, and before SharePoint Foundation executes the user action, the synchronous Before events are raised. If there are multiple synchronous Before events, they are raised in the order specified
    by their sequence number. Similarly, synchronous After events are raised after SharePoint Foundation executes the user action. These, too, are raised in the order specified by sequence number. As you can see, all synchronous events are processed in the same
    thread as that in which the user action occurs.
    Asynchronous After events, however, are processed on secondary threads.
    So you're completely right that if the first event receiver has cancelled the operation, the second event receiver will never been executed.
    In your case if you want second event receiver(B) to be invoked regardless of the first event receivers'
    (A) result you can easily swap the sequence numbers for those event receivers.
    Event Receiver Sequence          
    The event receiver sequence specifies the order in which an event receiver is executed in cases where an event triggers multiple event receivers. For example, if you have two
    ItemAdded event receivers bound to the same list (one from Assembly "1" and the other from Assembly "2"), the event receiver that is bound with a lower sequence number is executed first. A practical example is adding an event receiver to a
    system list that already has a system event receiver bound to it. In that case, you assign the new event receiver a higher sequence number.
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Receivers ListUrl="Lists/Tasks">
    <Receiver>
    <Assembly>MyReceiverAssembly, Version=1.0.0.0, Culture=Neutral,
    PublicKeyToken=12e5e5525fb3d28a</Assembly>
    <Class>MyReceiverAssembly.MyReceiverClass</Class>
    <Type>ItemAdded</Type>
    <Name>My ItemAdded Event Receiver</Name>
    <Synchronization>Synchronous</Synchronization>
    <SequenceNumber>1000</SequenceNumber>
    </Receiver>
    </Receivers>
    </Elements>
    LinkedIn Profile
    SharePoint Advanced Visibility Options project
    SharePoint Managed Metadata Claims Provider project

  • Querying messages with message selectors

    I have been looking at the JMS 1.1 spec and do not see anything that helps durable subscribers change queries without losing prior messages. If I create a durable subscription with no message selector I receive all messages for the subscribed topic. If I change the durable subscription to use a message selector (for example, "JMSPriority = 9", when I call any of the TopicSubscriber receive calls I lose all previous messages which don't match the selector. Is there any way around this?

    Ok. I get what you mean now.
    The problem lies in that you double-change the selector.
    This, in my opinion (which isn't worth much) calls for a different angle on this problem.
    Consider the following:
    a) do you absolutely have to have a topic? can't you use a queue (and use a queuebrowser) ?
    b) if you must use a topic - can you create two subscribers - one that gets all the messages, and
    another onw that only gets those with priority=7?
    c) it is bad practice to change the selector of the subscriber at runtime. If you do (as you do) - you are bound to lose messages on the second switch over.
    d) can't you just subscribe to all the messages on the same subscriber, and check upon arrival what to do with the message according to the priority?
    Now, you probably think - hey, this is silly. But regard this : you are using the selector in a way that was not foreseen (on a topic) by the spec. Why is that? because you want, with the same subscriber, to have two receiving channels (one for regular messages, and then one for "special" messages) - this is not done with one subscriber. This is done with two operating simultaneously.
    I mean - if you decide you don't want to rely on the JMS provider to hand you the higher priority messages first - that's ok, but you can't blame it for not holding messages that you don't want any more..
    Nimo.

  • Multiple queue vs single queue - peformance

    Hi All,
    Could pls throw some light on the following design.
    Currenty, We have more than 100 queues and for each there is a different MDB to receive the message.Now, somehow we made a single instance of same MDB listen to all these queues by looking at the input message. The requiement now is, is it possible to club all the queues into single queue as it's asynchronous messaging. The receiver may also try write into the same queue at the end of message processing.If so, how would be performance. Is this performance better than having multiple queues?.
    The message are expecting to be 25 k/day in the queue. And we are using Weblogic server.
    Please let me know if you need more details.
    Thanks
    Srinath

    You could try to use selectors to assign messages to particular MDBs. This way you off load some of the work on the broker but selectors by their nature usually have an impact on broker's performance. It all depends on your application, your expectations, size and the rate of your messages, how long it takes to process them on the client side. There is no simple answer in this case. You would have to test some scenarios to come up with a best solution that fits your requirements. Having said that I personally believe that some degree of partitioning of your queue could be beneficial. On a heavily loaded system it may increase the concurrency of the system and its resilience, particularly if you place the queues in different brokers. Try to imagine your broker as if it was a DB server with just one table (I'm not sure if this is the best analogy but I can't think about anything else at the moment).

  • Experiences using the JMS Message Selector

    I am using a JMS Adapter Sender Communication Channel and try to select the messages I want to consume with the Message Selector. My first attempts all failed - I am not sure if the syntax I am using is correct or if anything else has to be set up to use the Message Selector.
    My sample was to enter the following into the field for Message Selector:
    JMSCorrelationID = '123456789012345678901234'
    I also tried the following variations:
    JMSCorrelationID = "123456789012345678901234"
    JMSCorrelationID = 'ID:123456789012345678901234'
    JMSCorrelationID = "ID:123456789012345678901234"
    but none of them were successful.
    Anybody got that feature to work yet and can help me...
    regards,
    peter

    Now I found it out finally...
    JMSCorrelationID = 'ID:41727469636c655570646174656400000000000000000000'
    where ID: is obviously added by JMS? XI? don't know... and the actually id is in Hex...
    can anybody enlighten me on the details?
    regards
    Peter

  • Single queue: concurrent processing of messages in multiple consumers

    Hi,
    I am new to jms . The goal is to  process messages concurrently from a queue in an asynchronous listener's onMessage method  by attaching a listener instance to multiple consumer's with each consumer using its own session and running in a separate thread, that way the messages are passed on to the different consumers for concurrent processing. 
    1) Is it ossible to process messsages concurrently from a single queue by creating multiple consumers ?
    2)  I came up with the below code, but would like to get your thoughts on whether the below code looks correct for what I want to accomplish.  
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Properties;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageConsumer;
    import javax.jms.MessageListener;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import com.walmart.platform.jms.client.JMSConnectionFactory;
    public class QueueConsumer implements Runnable, MessageListener {
      public static void main(String[] args) {
       // Create an instance of the client
        QueueConsumer consumer1 = new QueueConsumer();
        QueueConsumer consumer2 = new QueueConsumer();
        try {
        consumer1.init("oms","US.Q.CHECKOUT-ORDER.1.0.JSON");   //US.Q.CHECKOUT-ORDER.1.0.JSON   is the queue name
        consumer2.init("oms","US.Q.CHECKOUT-ORDER.1.0.JSON");
        }catch( JMSException ex ){
        ex.printStackTrace();
        System.exit(-1);
        // Start the client running
        Thread newThread1 = new Thread(consumer1);
        Thread newThread2 = new Thread(consumer1);
        newThread1.start();newThread2.start();
        InputStreamReader aISR = new InputStreamReader(System.in);
              char aAnswer = ' ';
              do {
                  try {
      aAnswer = (char) aISR.read();
    catch (IOException e)
      // TODO Auto-generated catch block
      e.printStackTrace();
    } while ((aAnswer != 'q') && (aAnswer != 'Q'));
              newThread1.interrupt();
              newThread2.interrupt();
              try {
      newThread1.join();newThread2.join();
      } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
              System.out
      .println("--------------------exiting main thread------------------------"+Thread.currentThread().getId());
            System.exit(0);
    // values will be read from a resource properties file
    private static String connectionFactoryName = null;
    private static String queueName = null;
    // thread safe object ref
      private static ConnectionFactory qcf = null;
      private static Connection queueConnection = null;
    // not thread safe
      private Session ses = null;
      private Destination queue = null;
      private MessageConsumer msgConsumer = null;
      public static final Logger logger = LoggerFactory
      .getLogger(QueueConsumer.class);
      public QueueConsumer() {
      super();
      public void onMessage(Message msg) {
      if (msg instanceof TextMessage) {
      try {
      System.out
      .println("listener is "+Thread.currentThread().getId()+"--------------------Message recieved from queue is ------------------------"
      + ((TextMessage) msg).getJMSMessageID());
      } catch (JMSException ex) {
      ex.printStackTrace();
      public void run() {
      // Start listening
      try {
      queueConnection.start();
      } catch (JMSException e) {
      e.printStackTrace();
      System.exit(-1);
      while (!Thread.currentThread().isInterrupted()) {
      synchronized (this) {
      try {
      wait();
      } catch (InterruptedException ex) {
      break;
      * This method is called to set up and initialize the necessary Session,
      * destination and message listener
      * @param queue2
      * @param factoryName
      public void init(String factoryName, String queue2) throws JMSException {
      try {
      qcf = new JMSConnectionFactory(factoryName);
      /* create the connection */
      queueConnection = qcf.createConnection();
      * Create a session that is non-transacted and is client
      * acknowledged
      ses = queueConnection.createSession(false,
      Session.CLIENT_ACKNOWLEDGE);
      queue = ses.createQueue(queue2);
      logger.info("Subscribing to destination: " + queue2);
      msgConsumer = ses.createConsumer(queue);
      /* set the listener  */
      msgConsumer.setMessageListener(this);
      System.out.println("Listening on queue " +queue2);
      } catch (Exception e) {
      e.printStackTrace();
      System.exit(-1);
      private static void setConnectionFactoryName(String name) {
      connectionFactoryName = name;
      private static String getQueueName() {
      return queueName;
      private static void setQueueName(String name) {
      queueName = name;

    Hi Mark,
    if the messages are sent with quality of service EO (=exactly once) you can add queues.
    From documentation:
    Netweaver XI -> Runtime -> Processing xml messages -> Queues for asynchronous message processing
    ...For incoming messages you set the parameter EO_INBOUND_PARALLEL from the Tuning category.
    If more than one message is sent to the same receiver, use the configuration parameter EO_OUTBOUND_PARALLEL of the Tuning category to process messages simultaneously in different queues.
    Transaction: SXMB_ADM
    Regards
    Holger

  • JMS Sender Adapter EOIO with different messages in Queue to RFC

    Dear Colleague,
    In one of my scenarios i am using JMS Sender Adapter and Websphere MQ series.
    In my MQ Series Queue i get different Messages with Different Structures.
    for e.g in my MQ Series Queue Q1 i have M1, M2, M3 coming in Order.
    Now i need to doa  Mapping of M1 to a Standard BAPI  B1 call through RFC at the reciever side.
    Now i need to doa  Mapping of M2 to a Standard BAPI B2 call through RFC at the reciever side.
    Now i need to doa  Mapping of M3 to a Standard BAPI B3 call through RFC at the reciever side.
    We are aware that on Receiver side we can have multiple Recievr Determinations.so i can send it to 3 different BAPIs.
    Question:
    But how do i split the Messges which are coming out of MQ series Q from JMS to 3 different Mapping Structures as we knwo that we do not 'Multiple Sender Interface Determinations' from Determined based on the Message which is coming in.
    Hope i have been clear in making myself understand about the problem given above.
    I have alos given below the same in a bit Graphical Form.
    MQ Series --> M3, M2, M1(Messages) --> JMS Adapte(EOIO) --> M1(Message) -> RFC -> B1(Bapi)
                                                             --> JMS Adapte(EOIO) --> M2(Message) -> RFC -> B2(Bapi)
                                                             --> JMS Adapte(EOIO) --> M3(Message) -> RFC -> B3(Bapi)
    Is it possible to achieve the above result. Answers fo the solution are most welcome. These can be also from the new Netweaver Release Versions. If we have the solution to these in New version we will implment the New Netweaver Releases.
    Thanks & Warm Regards
    Venugopal

    Dear Kai,
    if i have 3 MQ series Queues then how are we going to maintain the flow of the Messages in the same order in which has come into MQ series queues.
    this mesans to say that all the Message come in Parallel out from JMS or MQ side and will be mapped onto Reciever side.
    But in my case i wil need to have M1 first M2 second and M3 third.
    This means to say that M1 recived and acknowledged then M2 should come and acknowledged and then M3 should be acknowledged.
    How this will be possible with your solution of making 3 MQ series Queues.
    Please do let me know.
    Thanks
    Venugopal

  • How can a JMS adapter be configured in BPEL to consume messages from multiple queues ?

    How can a JMS adapter be configured in BPEL to consume messages from multiple queues ?

    If you want to use JMS with AQ as datastore then there is some configuration you need to do to enable this. This is outside SOA Suite per sa, e.g. no adapter required.
    If you want to connect to the AQ direct then use the AQ adapter.
    this blog may be of some help understand the configuration
    http://biemond.blogspot.com/2008/01/oracle-jms-with-esb-and-bpel.html
    cheers
    James

  • A basic query with respect to using Message Selectors in JMS

    Hi
    When i am going MEssage Selectors topic in web , it seems very confusing for me .
    I have written a simple JMS Application based on Weblogic as my Queue .
    I have two Java Files one for Message Producer and another file acting as Message Consumer using MDB
    I have a basic TextMessage with some header properties in my Producer file .
    Please tell me in what file should i put MessageSelector ??.
    Thanks for reading .
    Please clarify my query on this .

    Thank you very much .
    I found the code of a MDB making useage of a Selector .
    *<message-driven>*
    *     <message-selector>shirtType = 'polo'</message-selector>*
    *     </message-driven>*
    Assume that i written a MDB that listens to particular type of Messages (Polo in this case ) .
    Please tell me what happens to other messages in the Queue that were never listened by the MDB .
    Thank you .

  • Http to Abap Proxy communication with multiple queues generation in Recevr

    Dear SDNs,
    I need some help in the following scenario, appreciate your suggestions and help .
    I am receiving the messages from sender to PI on http posting, from PI  I am sending the message to SAP system using receiver xi communication channel ( receiver is abap proxy).
    Sender will send the messages in QOS=EOIO, QUEueID=XXXt_100 etc  parameters, when large volumes cases, it is getting delayed to process it using a single queue.
    We are thinking to dynamically  generate multiple queues in PI and send the same queue ids to receiver SAP system to process all the messages quickly in SAP System also.
    Help /Clarifications needed:
    1. XI receiver communication channel in  pi  does not provide any options to generate dynamic queue id based on payload content (using dynamic configuration) and sent it to SAP.
    2. Module Tab in receiver communication channel also got disabled to add  custom adapter modules, can we add custome adapter module on xi receiver channel to generate dynamic queue id ?
    Really appreciate your immediate help and suggestions.
    Thanks.
    Suraj.

    Dear Praveen,
    Thanks lot for the immediate reply, we need to use EOIO, as the messages need to be processed in the same order we send and receive, there is no flexibility in QOS=EOIO, Appreciate if there is any other thoughts?
    Thanks In Advance.
    Suraj.

  • Send the same   message to two receivers with some  time difference..

    Hi
      I want to send the same message to Two receivers  with the slight time difference.. becuase  but not at the same time.. if the same time means.. just we can  specify the two receivers in the one receiver determination..
       but  if i want to send the   same message to Two  reveivers with the time difference means..(after sending the  message to first receiver.. after  some time gap.. i need to send the  message to second receiver..
      this type of scenarios how can we do.. is it possible to do with out BPM...  please suggest me the solution..
    Thanks
    Jain .P

    Hi Jain,
    With BPM you can easily do it.
    i am giving you the steps:
    1)first add a receive strep to get your message
    2)then, put a receiver determination step with a multiline receiver container element assigned to its Receivers property.
    3)then, put a block in dynamic mode(ie. ForEach/ParForEach mode) and assign the multiline receiver container element to its multiline element and assign a simple(single line) receiver container element to its current line property.
    4) add a send step within the block, choose Receivers List in its Receiver From property and choose the current line receiver element in its Receivers property.
    5) then add a wait step in the BPM, in its type select Wait Specified Time Period and then mention the duration in your desired time unit.
    **Reward points if helpful...
    --Sankar Choudhury

Maybe you are looking for