You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Gordon Sim (JIRA)" <qp...@incubator.apache.org> on 2009/01/14 11:15:00 UTC

[jira] Assigned: (QPID-1379) Describe, test and show example of using message acquire from c++

     [ https://issues.apache.org/jira/browse/QPID-1379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gordon Sim reassigned QPID-1379:
--------------------------------

    Assignee: Jonathan Robie  (was: Gordon Sim)

Jonathan,

Seems like this might be of interest to you. If not just assign it back to me.

Gordon.

> Describe, test and show example of using message acquire from c++
> -----------------------------------------------------------------
>
>                 Key: QPID-1379
>                 URL: https://issues.apache.org/jira/browse/QPID-1379
>             Project: Qpid
>          Issue Type: Test
>          Components: C++ Client
>    Affects Versions: M3
>            Reporter: Gordon Sim
>            Assignee: Jonathan Robie
>            Priority: Minor
>         Attachments: acquire_example.tgz
>
>
> Attached is a simple example that shows how a subscriber in not-acquired mode can received messages and subsequently acquire them. The producer creates 'tasks' which are processed by one of as many acquirers as you want to have running; each of which will attempt to acquire the task before 'processing' it for a random amount of time.
> Captured here along with some introductory blurb on message acquire (below) for later polishing and inclusion into qpid svn tree/wiki in some form.
> A message is acquired by calling messageAcquire() on the session. This takes a SequenceSet argument which represents a set of message ids that are to be acquired (which may just be a single message).
> E.g.
> SequenceSet ids(message.getId());
> MessageAcquireResult result = session.messageAcquire(ids);
> You need to check that the acquire was successful. The response to messageAcquired is a set of message ids that were successfully acquired. By testing whether that includes the particular message you are interested in, you can determine whether or not the acquire succeeded.
> if (result.getTransfers().contains(message.getId())) {
>     //acquire for that id succeeded
> } else {
>     //that id could not be acquired
> }
> To use message acquire you should have subscribed in not-acquired mode. At present the recommended approach for this is to set the acquire mode to true on the subscription manager.
> E.g.
> SubscriptionManager subscriptions(session);
> subscriptions.setAcquireMode(true);
> subscriptions.subscribe(worker, "task_queue"); 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.