qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Huston" <shus...@riverace.com>
Subject Question on use of qpid::messaging::Receiver objects
Date Tue, 29 Jun 2010 20:23:08 GMT
I'm working on some code that sends messages to a topic exchange. I
create a Receiver to get messages by key. When I use
Receiver::fetch(Message, Duration) all appears ok; when I use
Session::nextReceiver I never get a message. Here is some lines copied
out of the real code to show usage:

  qpid::messaging::Connection connection (broker_url_);
  connection.open ();
  session = connection.createSession();
  sender = session.createSender("amq.topic");
  qpid::messaging::Message msg (content, length);
  std::string dest ("a.b.c", 5);
  msg.setSubject (dest);

  ...  In the receiving part ...
  std::string addr = "amq.topic/" + "a.b.#";
  receivers.push_back (session.createReceiver(addr));
#if 1
  // This next couple of lines works...
  qpid::messaging::Message message;
  if (receivers[0].fetch (message, qpid::messaging::Duration::SECOND *
   { // do something - this works }
   // This does not work. nextReceiver() doesn't ever return true
   qpid::messaging::Receiver r;
   if (session.nextReceiver (r, qpid::messaging::Duration::SECOND * 1))
       qpid::messaging::Message message = r.fetch();
       // do something

Is this a bug in my code, or in Qpid? If mine, what's the difference
from fetching a message on a specific receiver and getting the next
receiver then its message?


Steve Huston, Riverace Corporation
Total Lifecycle Support for Your Networked Applications

Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org

View raw message