Using Message Selector w/JMSCorrelationID causes auto-commit

I'm using the following code to create a session with transactions enabled:
Session session = connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
String messageSelector = "JMSCorrelationID = 'myid'";
QueueReceiver receiver = session.createReceiver(ioQueue, messageSelector);
When I call receiver.receiveNoWait(), it retrieves the message, but automatically commits it. If I call session.rollback() directly afterward, I don't get any exceptions, but the message is completely removed from the queue (as if I had committed it).
If I use the same exact code with an empty message selector (""), the rollback works fine all the time.
Does anyone have any idea why? I'm using MQ v5.3 on W2k.
Thanks!
Jeff

use CLIENT_ACKNOWLEDGE
Session session = connection.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);
);//Session.AUTO_ACKNOWLEDGE);
from the spec:
CLIENT_ACKNOWLEDGE - With this option, a client acknowledges a
message by calling the message�s acknowledge method. Acknowledging a
consumed message automatically acknowledges the receipt of all messages
that have been delivered by its session.
AUTO_ACKNOWLEDGE - With this option, the session automatically
acknowledges a client�s receipt of a message when it has either successfully
returned from a call to receive or the MessageListener it has called to process
the message successfully returns.

Similar Messages

  • Problem using Message-Selector

    Hi,
    out client-application subscribe to a JMS-topic on OC4J (9.0.3) using the following code
    TopicConnectionFactory oConnectionFactory = (TopicConnectionFactory) ctx.lookup("jms/MyTopicConnectionFactory");
    oConnection = oConnectionFactory.createTopicConnection();
    oTopicSession = oConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    Topic topic = (Topic)ctx.lookup("jms/MyTopic");
    TopicSubscriber sub = oTopicSession.createSubscriber(topic);
    Everything works fine.
    But when we replace the last line to use Message-Selectors
    TopicSubscriber sub = oTopicSession.createSubscriber(topic,"username = 'abc'",false);
    we get the following (strange) error (which occurs at excactly that line)
    javax.jms.InvalidDestinationException: Invalid topic
    The topic can't be invalid, because we could subscribe without Message-Selector. Do I have to modify the topic at the JMS-Configuration? Any ideas?
    Thanks,
    Gilbert

    Hi Gilbert,
    The way I've done it is by defining the rule when creating the subscriber in the database (thru DBMS_AQ). The following document might give you some insight.
    http://otn.oracle.com/pls/db92/db92.show_toc?partno=a96587&remark=drilldown&word=DBMS_AQ
    HTH.

  • How to use Message Selector in BPEL

    Hi all
    I´m using a JMS Adapter to consume messages from a JMS queue (a JMS adapter which create the BPEL instance when a message arrives).
    The process must select messages which meet certain criterias, so I´m using Message Selector to filter the messages and only pick up the ones who interest me .
    But I am not able to get it to work.
    I want JMS adapter to consume messages based on field "MessageID" =1006 in my message.
    So in my message selector I wrote MessageID =1006
    But its not picking up message.Kindly help what am i doing wrong.
    Thanks in advance.
    Karan

    yes it is the message producer who should set the property
    see http://download.oracle.com/javaee/6/api/javax/jms/Message.html the various setXXXProperty(name, value)
    once the message is on the queue, I am not aware of a way to change its properties, unless by consuming it and reposting it modified...
    well if you are really desperate you can write a MDB who consumes all messages without a given property and repost them WITH the property.... better if reposting to a different queue to avoid trouble...

  • Message selector on JMSCorrelationID?

    I am wondering how to do a selective get on a queue using the JMSCorrelationID field. I can set my own fields for message selectors fine, but I wanted to standardize on this field for simplicity; is there a straightforward way of doing this?

    You can be safe from the overwritten field if you make sure that you use the exact format that JMS uses forthe field,
    i.e. "ID:<24 bytes>".
    If you pass a string of "1234" you should do a search on the receive queue for "ID:313233340000000000000000000000000000000000000000".
    Now what I'm trying to figure out is if there is a way to wildcard the
    match. I setup mine to have a unique code in front (the string "1234" in case you were curious) then I hash the workstation id, message number, user number and iteration into a unique number (I hope), append that to the above and then pad it out with the right number of zeroes. the problem is other people are also testing in the same queues. After I do my testing I want to clear the queues of just my messages without touching anyone elses (especially the error queue, a lot of junk is left there), or to be able to browse the queues only seeing my messages.
    (for the record I'm doing this in Load Runner to control how many users are sending messages and to measure response times).

  • 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 .

  • Message Selector and Setting JMS Header Properties PL/SQL Enqueue

    Currently I am attempting to use the Message selector functionality. I just know know exactly how we need to set the property in PL/SQL when enqueuing. I also want to verify the syntax that I should use in the event that I am doing this incorrectly...
    The code I am using to test the enqueue is
    declare
    enqueue_options dbms_aq.enqueue_options_t;
    message_properties dbms_aq.message_properties_t;
    message_handle RAW(16);
    agent sys.aq$_agent := sys.aq$_agent('', null, null);
    message sys.aq$_jms_text_message;
    recipients DBMS_AQ.aq$_recipient_list_t;
    BEGIN
    message := sys.aq$_jms_text_message.construct;
    message.set_text('<ORDER><HEADER_ID>16992531</HEADER_ID></ORDER>');
    message.header.set_string_property('bamfilter','ORDER_ENTRY');
    dbms_aq.enqueue(queue_name => 'XX_OM_MONITOR_Q',
    enqueue_options => enqueue_options,
    message_properties => message_properties,
    payload => message,
    msgid => message_handle);
    COMMIT;
    END;
    we have tried a few other methods, but still to no avail...
    the syntax I believe for the selector in the ems should be bamfilter='ORDER_ENTRY'
    Any help would be great.
    The DB the Queue is locate is on 10g if that makes any difference...

    Yes
    I am able to specify JMS Header and JMS Properties when producing a message. However I am not able to user "Message Selector" to filter messages based on JMS Properties information when consuming messages.
    In the link you provide, there is an example on how to use Message Selector:
    # (a copy from the link)
    Message Selector
    ...for example, you can enter logic, such as:
    * JMSType = 'car' AND color = 'blue' AND weight > 2500
    * Country in ('UK', 'US', 'France')
    I believe the example with "Country" is exactly what I need, but I can´t get it work.
    I create the same example above, setting a property named "Country" in the JMSHeader, sending the message to a JMS Queue (BPEL Process #1) and try to comsume it on the Message Selector (BPEL Process#2), but JMSAdapter never consumes the message.
    Thanks for your help.

  • JMS Header: JMS Properties and Message Selector

    Hi all
    I´m using a JMS Adapter to consume messages from a JMS queue (a JMS adapter which create the BPEL instance when a message arrives).
    The process must select messages which meet certain criterias, so I´m using Message Selector to filter the messages and only pick up the ones who interest me (If click on the "help" button on JDeveloper Wizard in the page you define Message Selector, you can see an example on how doing this).
    So how can I select messages using values placed on JMS Properties, in the Message Selector?
    For example, I set in the JMS Header:
    JMSInboundHeadersAndProperties
    --------JMSInboundProperties
    ----------------Property
    -----------------------name = 'Country'
    -----------------------value = 'Brazil'
    The JMSAdapter must consume only messages that "Country" = "Brazil".
    Thanks in advance.
    Menezes

    Yes
    I am able to specify JMS Header and JMS Properties when producing a message. However I am not able to user "Message Selector" to filter messages based on JMS Properties information when consuming messages.
    In the link you provide, there is an example on how to use Message Selector:
    # (a copy from the link)
    Message Selector
    ...for example, you can enter logic, such as:
    * JMSType = 'car' AND color = 'blue' AND weight > 2500
    * Country in ('UK', 'US', 'France')
    I believe the example with "Country" is exactly what I need, but I can´t get it work.
    I create the same example above, setting a property named "Country" in the JMSHeader, sending the message to a JMS Queue (BPEL Process #1) and try to comsume it on the Message Selector (BPEL Process#2), but JMSAdapter never consumes the message.
    Thanks for your help.

  • AQ Adapter with message selector rule

    Hi,
    I'm doing a B2B11g implementation on AS2. Incoming messages are processed using the AQ adapter. Now I have several (about 8) AQ-adapter implementations on the IP_IN_QUEUE that select messages using a message-selector-rule based on the DocumentType. So each SOAComposite dequeues and processes the appropriate document.
    This works fine, but I'm looking for any performance recommendations on this.
    What is the impact on CPU for example using message selector rules? Any do's and don'ts on this?
    Thanks in advance.
    Regards,
    Martien

    http://download.oracle.com/docs/cd/B14099_19/integrate.1012/b25307/adptr_aq.htm#CJAEIACG

  • Question about Message Selector

    Dear all,
    I have implemented a JAVA progrram which will sent 10 JMS messages into AQ sequentially, and then use another JAVA client which will get JMS message from the AQ.
    I found out that if i use Message Selector to get message from AQ, the message will NOT be read from the queue by enqueue_time, how can i get the jms message from AQ by message selector that can preserve the enqueue_time order?

    Have you got a lot of MTA?
    Because you can create one rule by MTA...
    Example:
    In message filter:
    verylongbloke sayed how do that...
    and in content filter:
    rule1: if (header("X-IP") == "^1.1.1.1$") { alt-mailhost ("[1.1.1.1]"); }
    rule1: if (header("X-IP") == "^1.1.1.2$") { alt-mailhost ("[1.1.1.2]"); }
    It's not very sexy but it works fine...
    unfortunately, we can't use variable for alt-mailhost action... or I don't know how :)
    regards..

  • Many topics vs message selectors

    Hi all,
    I have read that Sun recommends using many topics instead of message selectors. The problem in my case is that I need to provide communication between many similar objects (many = probably thousands of them). The simplest solution would be to have one topic and use message selectors, but taking the Sun recommendation into account, I was thinking about creating many topics instead. Can anyone provide me with some information whether there is a limit put on topic number or some recommendation on balancing the number of topics/message selectors? Or maybe I should do some performance tests on my own? The AS I use is Sun Java System Application Server Platform Edition 8.1.
    Thanks for any information!

    Hi all,
    I have read that Sun recommends using many topics instead of message selectors. The problem in my case is that I need to provide communication between many similar objects (many = probably thousands of them). The simplest solution would be to have one topic and use message selectors, but taking the Sun recommendation into account, I was thinking about creating many topics instead. Can anyone provide me with some information whether there is a limit put on topic number or some recommendation on balancing the number of topics/message selectors? Or maybe I should do some performance tests on my own? The AS I use is Sun Java System Application Server Platform Edition 8.1.
    Thanks for any information!

  • 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

  • I have two Iphones with different email addresses sharing one Apple ID. Will that cause problems with using messaging and FaceTime?

    I have two Iphones 5 with different email addresses sharing one Apple ID account.Both are using IOS 8.
    I would like to set up a new Apple Id for one of the phones and remove it from the old account.
    If I do that, can I move all of the purchased apps and songs to the new Apple account?
    Also, will sharing one Apple ID account with two devices cause problems with using messaging and FaceTime?

    Sharing an iCloud account between two devices can be done without causing issues with iMessage and FaceTime, just go into Settings for each of these functions and designate separate points of contact (i.e. phone number only, or phone number and unique email address).  While that works, you'll then face the problem where a phone call to one iPhone will ring both if on the same Wi-Fi network -- but again, that can be avoided by changing each phone's settings.
    Rather than do all that, don't fight it -- use separate IDs for iCloud.  You can still use a common ID for iTunes purchases (the ID for purchases and iCloud do not have to be the same) or you can use Family Sharing to share purchases from a primary Apple account.

  • How to use timestamp based dynamic message selector?

    Is it possible with message selector to issue query like statement that
    weill fetch any messages that have header timestamp older than "now" + 3 hrs.
    In SQL you would say something like:
    where timestamp <= sysdate + (180/1440)
    Please let ne know.
    Thank you,
    Edmon

    hi edmon,
    to my knowledge dynamically evalutaed expressions like this are not supported by any of the JMS vendors. messageselectors are in SQL92 format and the only dynamic part in them is the contents of the message properties and headers.
    So, you're out of luck with what you want to do (e.g., remove expired messages from a destination when they havent' been consumed within a time threshold??) but i could see two possible solutions:
    1) You could use time-to-live (TTL) on the sender side. Messages that are on the destination beyond their TTL would be placed onto a dead message queue (DMQ) from where you could consume them for further processing. DMQ is not a standard-JMS feature but supported by a few vendorrs (e.g., JBoss, ArjunaMS).
    2) You could use Message-driven Services (MDS) for more elaborate server-side message processing. MDS has been pioneered by ArjunaMS but is also available with a few other JMS vendors.
    Hope that helps!
    Kind regards,
    Thomas.

  • WL 7 Message Bridges using the selector.

    We are trying to use a WL7 Message Bridge to bring select messages from WL6.
              We are trying to implement the Selector part of the Bridge. Does anyone
              know if this functionality actually works? And if it does work is the format
              of the Selector the same as in a MDB message-selector part of the
              ejb-jar.xml file?
              Thanks,
              John
              

              As far as we know, the selector part of the bridge works.
              The format of the selector is the same as JMS selector defined
              in JMS specification, which is the same as in MDB message-selector
              element of ejb-jar.xml file.
              Dongbo
              John Favre wrote:
              >
              > We are trying to use a WL7 Message Bridge to bring select messages from WL6.
              > We are trying to implement the Selector part of the Bridge. Does anyone
              > know if this functionality actually works? And if it does work is the format
              > of the Selector the same as in a MDB message-selector part of the
              > ejb-jar.xml file?
              >
              > Thanks,
              > John
              

  • Trouble using JMS Message Selector and DCJMSMessageProperty0

    Hello Experts!
    My scenario is Mainframe => MQ => JMS Adapter => XI => SAP
    My MQ channel is communicating fine to XI and I've set the JMS adapter to JMS Compliant.
    I have multiple message types with consistent headers but varying data layouts that I need to route to different mapping objects. So it seems the best solution for this is JMS Message Selector based on reading a header value from one of the dynamic message properties.
    I've read SAP Notes and SAP Library and SDN Wiki articles about this configuration and I think its possible.
    http://help.sap.com/saphelp_nw04s/helpdata/en/10/b1b4c8575a6e47954ad63438d303e4/frameset.htm
    Note 856346 - J2EE JMS Adapter: Frequently Asked Questions (FAQ)
    Note 1086303 - XI JMS Adapter and IBM Websphere MQ: FAQ
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/usage%252bof%252bmessage%252bselector%252bfor%252bjms%252bsender%252badapter
    My mainframe sends an MQ message that includes some extra header information like
    field: ApplType  VALUE: 000000002                                              
    field: ApplName    VALUE: MIS056O          
    I configured my Communication Channel to set Adapter-Specific Message Attributes and also Additional JMS Message Properties to include ApplType and ApplName.
    However, I can only see some of the standard JMS header items such as CorrelationID, none of the additional ones.
    In RWB I see "JMS property 'ApplType' that corresponds to dynamic header 'DCJMSMessageProperty0' is missing from JMS message 'ID:f2f0f0f9f0f4f2f1f0f9f1f5f5f3f7f44040404040404040'; consequently it cannot be added to XI message 'e136a6e8-8580-4adc-2007-9ccab93f1ef4' as a dynamic header"
    Can anyone with some experience doing this help me see if I'm missing a trick somewhere? How can I see where this information is being dropped? Could it be when MQ is handing to JMS?
    Many thanks,
    Aaron

    After sifting through some IBM documentation I found that the PutApplName field actually maps to JMS name JMSXAppID. So after adding this to my Additional JMS Message Properties list I get the dynamic JMS message property I need for sorting out the messages.
    http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzaw.doc/uj25450_.htm

Maybe you are looking for

  • I can't seem to run a hardware diagnostics on my MacBook Pro.

    I recently had an issue with the Wi-Fi hardware on my MacBook.  I wasn't able to view any local networks.  Instead, the menu option stated that there was an issue with my wireless hardware.  I resterted my MacBook and the issue persisted.  My compute

  • Error while  Asset settlement

    as i have transferred last year internal order balance to the new internal order in this year. and when i was running th Ko88 for AUC to main asset settlemnt it gave me below error. <b>Error during acquisition transfer: Depr. area does not exist Mess

  • My screen on my iPhone 5 is broken, somebody please help!

    I really need somebody's help, the scene on my iPhone has gone blank and stopped working. I can tell that my phone is on because when I flip the volume switch it'll vibrate, me when I screen shot or change it, it'll make a sound. Also when I have the

  • File Name in Java Map

    Hello, I want to add the time stamp in the file name in JAVA map. Actually we are directly writing the file on to the file system from Java map and also giving its output to other map. So we need when we write the file on the file system the file nam

  • Acrobat vs Livecyle - which is better for making accessible PDF's

    I am having a very hard time making my PDF accessible. The source program I use to create my document is InDesign 5.5. I convert to PDF and am attempting to tag it using Acrobat X. I tried tagging my form using the articles panel in InDesign but it d