Publish/Subscribe Client Acknowledgements!?

Hi all.
Im experimenting with the simplePublishSubscribe example from sun's JMS tutorial, trying to understand how the acknowledgements work when in CLIENT_ACKNOWLEDGEMENT mode.
So I set the above mode for the session and run the example without any message.acknowledgment() 's. So now after the the publish message have been delivered to the subscriber, without being acknowledged from the client, running topicSession.recover() should result in all the previous messages being redelivered to the client as they have not been acknowledged and therefore not deleted from the topic.
However after trying this it would seem that not messages are redelivered to the client!? Any advice on this scenario. It is important since the application we are designing relies on client acknowledgements in an asyncronous mode.
Thanks
(PS...i have search the forum and nnot found a definitive answer to this problem)

Hi,
The following code should work as you expect:
session = connection.createTopicSession(false,Session.CLIENT_ACKNOWLEDGE);
subscriber = session.createSubscriber( topic );
message = subscriber.receive();
mID = message.getJMSMessageID();
session.recover();
message = subscriber.receive();
newMID = message.getJMSMessageID();
if( ! mID.equals( newMID ) )
     //fail!!!
Arnaud
http://www.arjuna.com

Similar Messages

  • Publish Subscribe Server with Filters

    Has anyone managed to get the WebLogic Server 10.3 HTTP Publish/Subscribe server to work with message filters?
    With a message filter configured, running with the Sun JVM I see errors of the following type (JRockit gives an error at the same point but it has less information) when I send a message via JMS:
    <02-Sep-2008 10:43:23 o'clock BST> <Warning> <HTTP Pubsub Server JMS support> <BEA-2152103> <Error occurs when retrieving message from JMS topic.
    weblogic.jms.common.JMSException: [JMSClientExceptions:055115]Error deserializing an object
    at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:190)
    at com.bea.httppubsub.jms.internal.TopicListener.fetchBayeuxMessageFromJmsMessage(TopicListener.java:97)
    at com.bea.httppubsub.jms.internal.TopicListener.onMessage(TopicListener.java:70)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4547)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:4233)
    Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: com.bea.httppubsub.bayeux.messages.DeliverEventMessage
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    Truncated. see log file for complete stacktrace
    My filter is not being invoked (I just throw an exception in the filter and I've also tried setting a breakpoint there in debug mode and neither get hit).
    My weblogic-pubsub contains the following:
    <wlps:message-filter>
    <wlps:message-filter-name>myFilter</wlps:message-filter-name>
    <wlps:message-filter-class>pubsubtest.filters.SecurityFilter</wlps:message-filter-class>
    </wlps:message-filter>
    <wlps:channel>
    <wlps:channel-pattern>/abc/**</wlps:channel-pattern>
    <wlps:jms-handler-name>abcJmsHandler</wlps:jms-handler-name>
         <wlps:message-filter>myFilter</wlps:message-filter>
    </wlps:channel>
    The class name is definitely correct because the app fails to publish entirely if it is not. I have the pubsub library referenced in my weblogic.xml and it works without the filter so that suggests that the pubsub server is deployed.
    Anyone have any ideas?
    -Shaun

    I'm not familiar with HTTP pub/sub.
    My one guess is that the server is attempting to deserialize an Object that's embedded within a JMS Object message, but the classpath is missing required classes in order to instantantiate the Object. In which case the solution is to ensure that the classpath includes any classes that might be embedded within the message object.
    If this doesn't help, can you post the full stack trace? The posted stack trace is truncated but the full trace should be in the log, as per the message "Truncated. see log file for complete stacktrace".
    Tom

  • Stomp: client acknowledge error message

    Using OpenMQ 4.4 b04, I try to use client acknowledge.
    I have found that the broker expects not only the message Id but also the subscription id.
    If I use the subscription id which is in the message header and add it to the ACK Stomp frame, the broker displays these lines in the log file:
    javax.jms.JMSException: Ack a message[ID:297-192.168.178.21(c1:a1:82:3f:f4:72)-1
    731-1239293602031] that is not found in subscriber[{F90F7D8E-843A-4EBB-BA15-23B2
    0F732060}]
            at com.sun.messaging.bridge.service.stomp.StompSubscriberSession.ack(Sto
    mpSubscriberSession.java:175)
            at com.sun.messaging.bridge.service.stomp.StompProtocolHandler.onACK(Sto
    mpProtocolHandler.java:643)
            at com.sun.messaging.bridge.service.stomp.StompProtocolFilter.execute(St
    ompProtocolFilter.java:123)
            at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultPro
    tocolChain.java:136)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.jav
    a:103)
            at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.jav
    a:89)
            at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextT
    ask.java:67)
            at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.
    java:57)
            at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
            at java.util.concurrent.FutureTask.run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)Which special headers are expected by the broker in a ACK frame? If the Stomp frame does not contain a subscription header, the error log gives some hints which mention a "/subscription-to/" header:
    WARNUNG: No subscription header specified, ACK all non-transacted subscription i
    ds with prefix /subscription-to/ for message ID:409-192.168.178.21(b3:dd:75:42:f
    :91)-1781-1239294021718
    09.04.2009 18:20:30
    SCHWERWIEGEND: ACK failed: Can't determine subscriber to ack message ID:409-192.
    168.178.21(b3:dd:75:42:f:91)-1781-1239294021718. Please specify subscription hea
    der

    It's the STOMP ACK 'subscription' header. STOMP client should always specify a subscription header on ACK besides message-id header.
    The exception you saw is a bug in ACK message for client ack mode. The client mode ACK problem has been fixed in build5.
    MESSAGE
    index:0
    content-length:10
    destination:/queue/q0
    subscription:sub2
    timestamp:1239309779559
    redelivered:false
    priority:4
    expires:0
    message-id:ID:7-10.5.81.239(80:17:42:1e:c5:e7)-55202-1239309779559
    Message #0
    ACK
    message-id:ID:7-10.5.81.239(80:17:42:1e:c5:e7)-55202-1239309779559
    subscription:sub2

  • XControl publish subscribe?

    Hi all
    I'm trying to implement a publish subscribe messaging pattern using XControls and LVOOP.
    I have various XControls which represent different views of the state of an object.
    I want all my XControl (clients) to be updated when the object (publisher) changes its state.
    I've achieved this sort of functionality before using VI's running in sub-panels that wait on a user event created by the publisher.
    I gather dynamic events are not available with XControls, so have tried to create a list of XControl clients that could be notified by a XControl method call.
    I've found a way of notifying individual clients by creating a method that fires the Display State ability but really want to manage all the XControls as a collection.
    An array can't seem to store references for the XControls as each is a different type.
    I've also tried using a Data Value Reference for each XControl reference hoping that this generic type could be stored in an array but no joy.
    The only way I've found is for the main vi to register for the publisher user event and then call the notification method of each XControl explicitly.  This messes up the main vi and is not an elegant solution.
    Does anyone know a way of achieving my desired functionality?
    Thanks in advance for any responses!
    Phill
    Solved!
    Go to Solution.

    Thanks tst
    I have attached a little sample of what I thought might be nice.
    I am building a P&I diagram out of DSC elements.
    The valve will ultimatly get more properties like OPC tags, names etc.
    I thought to attach the pipes to it so they get automatically activated, when the valve turns on.
    But I guess that would require some extra programming anyway because there will be two endpoints on the sides of the pipe to control a flow.
    Casting to more generic, even only a control, is obviously not possible. 
    Hierarchy for Xctrl is also not provided, no inheritence.
    Is there any another way to have a class with a Control style FP ?
    I am still at the beginning of the project so I have more options to think of......
    Gabi
    7.1 -- 2013
    CLA
    Attachments:
    Valve.zip ‏149 KB

  • Asynchronous Publish Subscribe with Session.Client_Acknowledge

    Is it possible to do Asynchronous Publish Subscribe with Session.Client_Acknowledge in JMS? If no, then is there any way to acknowledge each message in an Asynchronous Publish Subscribe application?
    Any code samples will be helpful..
    Thanks in Advance,
    Jo

    CLIENT_ACKNOWLEDGE does work in asynchronous mode.
    I am using Sonic MQ. The sending session is created with CLIENT_ACKNOWLEDGE, in my onMessage(), I am testing the acknowledgement as:
    if ( 1 == 2) msg.acknowledge();
    else {
    Thread.sleep(1000);
    sendsession.recover();
    Since the condition is never true, the message is never acknowledged by the receiver and stays in the queue all the time.
    The confusing point: If you don't call the recover() function and your receiver is running, there would be no more messages to consume. As for SonicMQ, refreshing the Explorer will also show the number of messages in the queue is 0. However, if you Ctrl-C your receiver or call the sendsession.recover(), then you'll find out that the messsages are still in the queue by running the receiving program again or refreshing the queue.
    However, the behavior of this may be vendor-dependent. I am just happy that Sonic MQ is doing what I expect.

  • Need to "publish/subscribe" my Contacts info like we could in Addressbook. Any ideas?

    Being a LONG TIME Mac User (yes, I owned a Lisa in the early 80’s and it still runs!)  I have lived thru the transition from OS 6 and 7, then 8, 9 and finally the upgrade to OSX and thru its incarnations up to my current Maverick (aka OS 10.9.4).  I am no stranger to changes on the Mac OS.  But the new Contacts file within iCloud has me lost. For many years my spouse and I would cross share portions of our personal AddressBook using that softwares publish/subscribe function. It worked great! I could have a list of his relatives/names/phones/addresses in case I needed them - and he had the same for me. With a glance he could see that my sisters middle name was Louise and she hated it. Useful info for when she was being icy to him on a phone call. <grin> We had the shared groups identified as coming from my AddressBook or his, and we could share subgroups or the entire thing as we might choose. 
    When we went to iCloud and now Maverick, there is no longer a way to share the contact info short of buying the Apple Server software and setting up our own server in house. While I might be able to justify doing so, it is a huge hassle for a very small gain in our case. So that is a last-resort solution, so far.
    I would again like to be able to share portions (groups/or sub-groups) of my contact database files with specific individuals, using something like a publish/subscribe feature that would require both parties to agree to the sharing and then once that was done, it should implement automatically and update every time an items is changed, added, deleted on the owners main copy of Contacts.  Ideally this would work thru iCloud and its “push update” function.  But just to have it working is the goal here. I really do not care HOW it works.
    Ive searched, even called a buddy who works the Genius Bar at my local Apple Store. So far, no one seems to have any suggestion other than the aforementioned Maverick Server idea.  Frankly with three computers, two printers, a few iPads and iPhones, and a couple of Apple TVs in the house, I am hard pressed to justify the time and energy running a server would require.  There has to be a better way to do this. If friends can push their Contact Info to their Android Phones, I should be able to share my Contact files with my spouse!  Thanks for your thoughts/suggestions/and hopefully for a solution.

    Is the disk cache and the memory cache enabled?
    You can check these prefs on the about:config page.
    * http://kb.mozillazine.org/browser.cache.disk.enable
    * http://kb.mozillazine.org/browser.cache.memory.enable
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    Your More system details list shows two outdated Flash plugins that you should remove and update to Flash 10.1 r102 or at least remove 10.0 r45 and wait until your distribution offers a 10.1 r102 update.
    # Shockwave Flash 10.0 r45
    # Shockwave Flash 10.1 r85
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/

  • MDOP 2013: App-V 5 SP2 Application Publishing and Client Interaction Guide Now Available

    Hello App-V forum users,
    Do you want to understand the details of how App-V publishes and runs applications? See
    this Springboard Series blog post, which describes the newly available App-V 5 SP2 Application Publishing and Client Interaction Guide.
    Enjoy!
    -Tony
    IT Pro Audience Manager for Web Forums

    Hello,
    I am truely confused by how you are attempting to achieve things.
    1. The Office 2013 package is only supported if deployed globally
    2. AppLocker is the way to restrict users from starting different applications
    3. Office 2013 is not supported to be published to users
    It seems you have issues with #3. Which is not supported. I am not saying it "doesn't" work, but considering you have issues with it - perhaps we can start by not doing it?
    Ok, so what do we have left;
    Per your statement, Office 2013 is published globally. Ergo, all shortcuts and applications should be available to all users.
    Is this true?
    Nicke Källén | The Knack| Twitter:
    @Znackattack

  • The Publish-Subscribe Notification latency in OCI is 5 seconds

    I have an OCI application where I register a callback to receive publish-subscribe notifications from an Oracle queue.
    The problem that I have is that I am receiving messages every 5 seconds intervals (the callback is called every 5 seconds if there are messages in the queue).
    It looks like that there is a process that is monitoring the database queue every 5 seconds. Is there a way to change that behavior?.
    I am getting the same behavior in Windows and Linux systems.
    This is the PL/SQL code that I am executing to create the database queue:
    DECLARE
    subscriber sys.aq$_agent;
    BEGIN
    DBMS_AQADM.CREATE_QUEUE_TABLE(
    QUEUE_TABLE=>'TestUser."TestTable_msg_table"',
    MULTIPLE_CONSUMERS => TRUE,
    QUEUE_PAYLOAD_TYPE =>'RAW');
    DBMS_AQADM.CREATE_QUEUE(
    QUEUE_NAME=>'TestUser."TestTable_queue"',
    QUEUE_TABLE=>'TestUser."TestTable_msg_table"');
    DBMS_AQADM.START_QUEUE('TestUser."TestTable_queue"');
    subscriber := sys.aq$_agent('AGENT', null, null);
    DBMS_AQADM.ADD_SUBSCRIBER(
    QUEUE_NAME=> 'TestUser."TestTable_queue"',
    SUBSCRIBER => subscriber,
    DELIVERY_MODE => DBMS_AQ.BUFFERED);
    END;
    CREATE OR REPLACE TRIGGER TestUser."TestTable_changes"
    AFTER DELETE OR INSERT OR UPDATE ON TestUser."TestTable"
    FOR EACH ROW
    DECLARE
    enq_ct dbms_aq.enqueue_options_t;
    msg_prop dbms_aq.message_properties_t;
    enq_msgid raw(16);
    userdata raw(100);
    BEGIN
    enq_ct.visibility := DBMS_AQ.IMMEDIATE;
    enq_ct.delivery_mode := DBMS_AQ.BUFFERED;
    msg_prop.delay := DBMS_AQ.NO_DELAY;
    DBMS_AQ.ENQUEUE('TestUser."TestTable_queue"',enq_ct, msg_prop,userdata,enq_msgid);
    END;
    This is the OCI code that I am executing to register for changes into the queue:
    /* Allocate subscription */
    OCIHandleAlloc((dvoid *)hEnv,(dvoid **)&hSub,
              (ub4) OCI_HTYPE_SUBSCRIPTION,
              (size_t) 0, (dvoid **) 0);
    OCIAttrSet((dvoid *)hSub, (ub4) OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) subName, (ub4) strlen(subName),
    (ub4) OCI_ATTR_SUBSCR_NAME, hError);
    /* Subscription callback */
    OCIAttrSet((dvoid *)hSub,(ub4)OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) onTableChange, (ub4) 0,
    (ub4) OCI_ATTR_SUBSCR_CALLBACK, hError);
    /* Set subscription context */
    OCIAttrSet((dvoid *) tblInfo, (ub4) OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) 0, (ub4) 0,
    (ub4) OCI_ATTR_SUBSCR_CTX, hError);
    /* Set subscription namespace */
    OCIAttrSet((dvoid *) hSub, (ub4) OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) &subNamespace, (ub4) 0,
    (ub4) OCI_ATTR_SUBSCR_NAMESPACE, hError);
    /* Begining Registration for subscription */
    OCISubscriptionRegister(hSvc,&hSub,1,hError,OCI_DEFAULT);
    Thanks

    This has come up before. No definitive solution but a purge of the queue is worth a try:
    see=> Re: Dequeing happens only every 5 Seconds

  • Memory Leak in Publish-Subscribe Notification

    I am using publish-subscribe notification for async-notification on LINUX( ORACLE 8.1.7). Before doing it, I read a document(OCI Programmer!/s Guide) about publish-subscribe notification(chap.9).
    I created Queue(AQ) in database and registered callback function using 'OCISubscriptionRegister()'.
    All operations are done succesfully , but when OCISubscriptionRegister() is called, memory leak seems to occur. I check up the memory leak using LINUX system call( 'top' and 'vmstat' ).
    Does anyone have any idea or experience of this problem?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Lee Sung-won ([email protected]):
    Thanks for your reply..
    I have something to ask you. where can I get a document listing the bug?<HR></BLOCKQUOTE>
    null

  • Publish/Subscribe

    hi,
    i want to try out publish/subscribe, but i dono where to start with and how to go abt. can anyone advise me like the softwares and tools i can use, what do i study for that would be very much useful.
    thanks in advance !

    I am not sure about 8i, but if you use Oracle9i, then administration of AQ is included in Enterprise Manager.
    However you cannot see there the content of messages on the queue; just the number of messages in individual states.
    Anyhow, I would advice you to move to Oracle 9i, if you can; queues have some fine new features there.
    Radek

  • Publish subscribe with XI

    How do u do publish subscribe with XI? I dont see that in XI as opposed to webMethods or TIBCO. Any thoughts?
    gayatri

    Hi,
    To my knowledge XI dose'nt work on the principle of Publish and Subscribe. XI is Message Driven rather then Event driven. But still we can make even driven message processing but that dose'nt fall under Publish and Subscribe.
    Regards,
    Prakash

  • Publish subscribe model with plsql

    Hi,
    I did not find any sample that shows how to use the publish subscribe model with plsql.
    Enqueueing is possible and know how to do it, but how can I subscribe to a topic with plsql.
    All samples I found are for Java JMS.
    Thanks
    Günther

    Hello,
    I have assumed you are using 10.2
    There are examples in
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14257/toc.htm
    about using multi-consumer queues/topics. There are demos in $ORACLE_HOME/rdbms/demo if you have installed the companion cd.
    Thanks
    Peter

  • Entity Object Publish/Subscribe Events Wizard

    Hi,
    I'm interested in knowing how exactly works the Entity Objects Publish/Subscribe Events, anybody could help me? Redirecting me to any doc web page, pdf, .... or maybe telling me a little bit more that I can imagine about how it works.
    Thanks in advanced.

    Repost for a better format, sorry...
    I did a quick test on Departments and Employees tables in HR schema.
    1, Added CommissionChangeEvent as published event for Employees entity. Set the new commission value (Number) as parameter. These are the generated methods:
    * Adds <code>l</code> as an event listener for the event CommissionChangeEvent
    public void addCommissionChangeEventListener(JboEventListener l)
    ((EmployeesDefImpl)getDefinitionObject()).addCommissionChangeEventListener(l);
    * Removes <code>l</code> as an event listener for event CommissionChangeEvent
    public void removeCommissionChangeEventListener(JboEventListener l)
    ((EmployeesDefImpl)getDefinitionObject()).removeCommissionChangeEventListener(l);
    * Publishes the event named CommissionChangeEvent
    public void CommissionChangeEvent()
    ((EmployeesDefImpl)getDefinitionObject()).publishCommissionChangeEventEvent(createCommissionChangeEventEventData());
    * Creates event data method for event CommissionChangeEvent
    public JboEventObject createCommissionChangeEventEventData()
    JboEventObject eo = new JboEventObject(this, "CommissionChangeEvent");
    try
    eo.put(new String("CommissionPct"), getAttribute("CommissionPct"));
    catch(Exception ex)
    ex.printStackTrace();
    return eo;
    2, Change setCommissionPct method as this:
    * Sets <code>value</code> as the attribute value for CommissionPct
    public void setCommissionPct(Number value)
    setAttributeInternal(COMMISSIONPCT, value);
    System.out.println("From EmplyeesImpl.java, Commission Pct is being changed. Firing the event...");
    //fire event
    CommissionChangeEvent();
    System.out.println("Event fired from EmplyeesImpl.java on department ID: " + this.getDepartmentId());
    3, Created a method in DepartmentsImpl.java like this:
    public void eventFired(Number theNewPct)
    System.out.println("In departmentsImpl: event fired with param: " + theNewPct + " on department id: " + this.getDepartmentId());
    4, In Entity editor, set enentFired method as to be invoked on event.
    Here's the output when change commission:
    From EmplyeesImpl.java, Commission Pct is being changed. Firing the event...
    In departmentsImpl: event fired with param: 0.5 on department id: 100
    Event fired from EmplyeesImpl.java on department ID: 100
    Looks like this is a nice inter-entity communication mechanism. It can pass paramter and recognize FK link correctly. Not sure whether it can be used to interact with external message queue, though...
    Charles

  • Multiple listeners don't work for publish subscribe?

    We wrote a publish/subscribe system based on JMS. It works fine so long as there is only one subscriber/listener. Normally this listener resides in the ejb space. Once we introduce another listener (e.g. by running another java program on the same host), the
              original listener STOPPED receiving messages -- is this a WLS bug ?
              

    Well pub/sub wouldn't be pub/sub unless it allowed for multiple
              subscribers.
              I think that 6.1SP2 had problems with certain combinations of listeners,
              in particular MDB and non-MDB. (Not sure.)
              What is your version and service-pack level?
              kin wrote:
              > We wrote a publish/subscribe system based on JMS. It works fine so long as there is only one subscriber/listener. Normally this listener resides in the ejb space. Once we introduce another listener (e.g. by running another java program on the same host), the
              > original listener STOPPED receiving messages -- is this a WLS bug ?
              

  • Publish/subscribe pattern in PI

    Hi,
    I have a doubt about Web Services.
    Is it possible to apply a publish/subscribe pattern in PI? that is to say, a service generates a message and keep it in a queue, so that one o more systems can subscribe to that queue for consuming the service asynchronously?
    If so, how could it be configured?
    Thanks in advance,
    Samantha.

    Samantha,
    The new version of PI 7.3, that is not available yet, you have this feature for JMS.
    Please check out this link: [What are the new service bus-based  capabilities for SAP NetWeaver  Process Integration 7.3 ?|https://websmp107.sap-ag.de/~sapidb/011000358700001199312010E.pdf]
    Best regards,
    JN

Maybe you are looking for