Hi all,

I found the solution (for ActiveMq, with a connector in AMQP, and a
connector with openwire), so I share the solution.
I used the idea of Dominic Evans, so If I want to get a message from a
filter (for example correlationId ), I did this:

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);

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

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_start (msgConsumer);
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);
}

.......

It's works, so thanks to Dominic Evans to give me the begining way.

enjoy











 



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

Reply via email to