qpid-proton mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xavier <xaviermillie...@eaton.com>
Subject RE: CorrelationId
Date Wed, 10 Dec 2014 14:47:25 GMT
Here the right code
//Doing this one time
pn_messenger_t* msgConsumer= pn_messenger(NULL);
pn_messenger_set_timeout (msgConsumer, 1000);
pn_messenger_set_blocking (msgConsumer, true);
pn_messenger_set_incoming_window (msgConsumer, 1);

// Doing this more time
pn_link_t* link;
pn_messenger_subscribe(msgConsumer,
"amqp://127.0.0.1:5672/queue://myqueue");
link = pn_messenger_get_link(msgConsumer,
("amqp://127.0.0.1:5672/queue://myqueue").c_str(), false);
pn_link_open(link);

pn_terminus_t* terminus = pn_link_source(link);
pn_data_t* data = pn_terminus_filter (terminus);
/* Map creation with selector*/
std::string selector = "jms-selector";
pn_data_put_map(data);
pn_data_enter(data);;
pn_data_put_symbol(data, pn_bytes(selector.size(), selector.c_str()));
// Described of the JMS_SELECTOR line 1262
std::string filter = "JMSCorrelationID='12346789'";
pn_data_put_described(data);
pn_data_enter(data);
pn_data_put_string(data, pn_bytes(6, "string"));
pn_data_put_string(data, pn_bytes(filter.size(), filter.c_str()));
pn_data_exit(data);

pn_messenger_recv(msgConsumer, -1);
if (pn_messenger_incoming(msgConsumer))
{
      // The message is arrived
      pn_message_t* message = pn_message();
      pn_messenger_get(msgConsumer, message);
      .....
      .....
      pn_message_free(message);
}
pn_link_close(link);



--
View this message in context: http://qpid.2158936.n2.nabble.com/CorrelationId-tp7614606p7617333.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.

Mime
View raw message