I did following:
connection.open(host, port);
Session session = connection.newSession();
:
:
:
SubscriptionManager sub(session);
sub.setAcquireMode(ACQUIRE_MODE_PRE_ACQUIRED);
for (uint i = 0; i < queueMsgCnt; i++)
{
sub.get(message, "myqueue");
cout << "Message is " << message.getData() << endl;
}
But this get() call on SubscriptionManager object removes message from queue
instead of just peeking/browsing it from queue.
Please let me know where am i going wrong?? how to use
ACQUIRE_MODE_PRE_ACQUIRED for peeking/browsing messages??
Thanks
Gordon Sim wrote:
>
> ft420 wrote:
>> Actually that will not solve my purpose as in my case same application
>> sends
>> out messages with different labels so i want specifically label
>> functionality only...
>
> Thats ok, the producer can send messages with different routing keys
> used for each. The routing key only dictates which consumers get the
> different messages.
>
> Perhaps I am misunderstanding your issue though.
>
>> Also please tel me why are AppId, UserId, CorrelationId & MessageId
>> provided???
>
> AppId is not terribly well defined but could be used to indicate the
> 'application' for which the message was created,
> UserId can be used to indicate the original publishers identity,
> CorrelationId is often used to correlate requests to responses in a two
> way conversation,
> MessageId is simply a unique identifier for a message.
>
>> what about Peek functionality in qpid? my application requires that i
>> just
>> want to read the data from queue without deleting it from the queue. just
>> as
>> peek in MSMQ... getDate() returns then data in queue but also at the same
>> time removes it from the queue...
>
> Yes you can create a subscriber with ACQUIRE_MODE_NOT_ACQUIRED and the
> message will be available for other subscribers. You could also use
> ACQUIRE_MODE_PRE_ACQUIRED which essentially 'locks' the message and then
> simply release the message making it available again.
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project: http://qpid.apache.org
> Use/Interact: mailto:[email protected]
>
>
>
--
View this message in context:
http://n2.nabble.com/send-receive-to-from-remote-machine-tp2507392p2509299.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]