thanks a lot. I tried both PRE_ACQUIRED & NOT_ACQUIRED. Is there any performance overhead involved in any of these 2 options? Also i wanted to know whether ACCEPT_MODE_EXPLICIT/ACCEPT_MODE_NONE has any performance overhead? Is there any document available that gives performance overheads of options that we use?
I was trying to declare a durable queue. I did following: : : session.queueDeclare(arg::queue="myqueue", arg::durable=true); : : steps :: ./qpidd -p 5004 --auth no ./my_queue //declares the queues ./my_producer // sends the messages to the queue ./browse // browses the messages now i stop the broker i.e. ctrl+c on the cmd prompt where ./qpidd is running start the broker again i.e. ./qpidd -p 5004 --auth no ./browse //gives error Queue not found Please let me know if i m going wrong anywhere Thanks Gordon Sim wrote: > > ft420 wrote: >> 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. > > Yes, I don't think I like the default acquire mode on the subscription > manager and certainly the get() method ignores it anyway. > >> Please let me know where am i going wrong?? how to use >> ACQUIRE_MODE_PRE_ACQUIRED for peeking/browsing messages?? > > Option 1: browsing using NOT_ACQUIRED > > SubscriptionManager sub(session); > SubscriptionSettings settings; > settings.acquireMode = ACQUIRE_MODE_NOT_ACQUIRED; > LocalQueue incoming; > sub.subscribe(incoming, "myqueue", settings); > .... > for (uint i = 0; i < queueMsgCnt; i++) > { > incoming.get(message); > cout << "Message is " << message.getData() << endl; > } > > Option 2: releasing PRE_ACQUIREd messages: > > SubscriptionManager sub(session); > SubscriptionSettings settings; > settings.acquireMode = ACQUIRE_MODE_PRE_ACQUIRED; > settings.autoAck = 0; > LocalQueue incoming; > Subscription s = sub.subscribe(incoming, "myqueue", settings); > .... > for (uint i = 0; i < queueMsgCnt; i++) > { > incoming.get(message); > cout << "Message is " << message.getData() << endl; > } > s.cancel(); > s.release(s.getUnaccepted());//messages are left on the queue > > (You can use a MessageListener instead of the LocalQueue if you prefer a > push style interface to the pull style above). > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:users-subscr...@qpid.apache.org > > > -- View this message in context: http://n2.nabble.com/send-receive-to-from-remote-machine-tp2507392p2519819.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:users-subscr...@qpid.apache.org