You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Deb Haldar <de...@yahoo.com.INVALID> on 2016/08/09 23:18:02 UTC

Using two AMQP Links over the same socket

 Hi Folks,
I'm trying to use the C Proton messenger to establish and send data over two AMQP links. While the first link gets established, I don't see the second link getting established.
My code looks like the following below:
bool SendMessage(const char* msgtext, size_t message_size, std::string tenantRoute)
{
 
 pn_message_t* message = pn_message();
 pn_message_clear(message);
 pn_message_set_address(message, tenantRoute.c_str());
 pn_data_t* body = pn_message_body(message); pn_data_put_binary(body, pn_bytes(message_size, msgtext)); pn_message_set_content_type(message,"charset=utf-8");
 pn_message_set_subject(message, "AMQPTest");
 
 //set the timeout of the messenger 
 pn_messenger_set_timeout(messenger, AmqpMessengerTimeout); // wait for a max of two seconds before exit pn_messenger_put(messenger, message); int result = pn_messenger_send(messenger, -1); pn_status_t status = pn_messenger_status(messenger, tracker);
 
 if (status == PN_STATUS_ACCEPTED && !(result < 0))
 {
  sendResult = true;
 }
 else
 {
  sendResult = false;
 } pn_message_free(message);
 message = NULL; return sendResult;
}
Essentially I'm trying to pass a new AMQP link address via tenantroute every time I call this function.Any ideas ?
Thanks,
Deb.

Re: Using two AMQP Links over the same socket

Posted by Deb Haldar <de...@yahoo.com.INVALID>.
Hey Andrew,
Yes, we're using c++ around this code. However, we have customized the io layer to use websockets instead of TCP sockets. There are also platform specific changes which will make it hard to migrate to the c++ API.
Here is our scenario - we need to create two amqp topics on the same websocket\tcpsocket endpoint. 
Instead of trying to set a different message address on same messenger instance , is it more preferable to use two instances of messengers - each one targeting a different message address? 
Just wondering how you guys would tackle this scenario in general where you need to create two amqp links on same endpoint using the C proton API.
Thanks a lot,Deb.




Sent from Yahoo Mail on Android 
 
  On Wed, Aug 10, 2016 at 9:04 AM, Andrew Stitcher<as...@redhat.com> wrote:   On Wed, 2016-08-10 at 15:53 +0000, Deb Haldar wrote:
> Guys, any thoughts on the question below?

I suspect the delay in replying is that no one here is 100% sure
whether you can change the message address and expect messenger to
automatically re-establich a new link, without checking the source
code. That is compounded by the most of the current development work
going into reactive style APIs.

I can tell you are using C++ around this code - is it possible for you
to code this using the reactive C++ API from 0.13 or the beta 0.14?

It would require a little different framework code, but that is an API
that we are currently working on actively.

Andrew

> Thanks,Deb.
> 
> Sent from Yahoo Mail on Android 
>  
>   On Tue, Aug 9, 2016 at 4:18 PM, Deb Haldar<debohaldar@yahoo.com.INV
> ALID> wrote:   Hi Folks,
> I'm trying to use the C Proton messenger to establish and send data
> over two AMQP links. While the first link gets established, I don't
> see the second link getting established.
> My code looks like the following below:
> bool SendMessage(const char* msgtext, size_t message_size,
> std::string tenantRoute)
> {
>  
>  pn_message_t* message = pn_message();
>  pn_message_clear(message);
>  pn_message_set_address(message, tenantRoute.c_str());
>  pn_data_t* body = pn_message_body(message); pn_data_put_binary(body,
> pn_bytes(message_size,
> msgtext)); pn_message_set_content_type(message,"charset=utf-8");
>  pn_message_set_subject(message, "AMQPTest");
>  
>  //set the timeout of the messenger 
>  pn_messenger_set_timeout(messenger, AmqpMessengerTimeout); // wait
> for a max of two seconds before exit pn_messenger_put(messenger,
> message); int result = pn_messenger_send(messenger, -1); pn_status_t
> status = pn_messenger_status(messenger, tracker);
>  
>  if (status == PN_STATUS_ACCEPTED && !(result < 0))
>  {
>   sendResult = true;
>  }
>  else
>  {
>   sendResult = false;
>  } pn_message_free(message);
>  message = NULL; return sendResult;
> }
> Essentially I'm trying to pass a new AMQP link address via
> tenantroute every time I call this function.Any ideas ?
> Thanks,
> Deb.  
  

Re: Using two AMQP Links over the same socket

Posted by Andrew Stitcher <as...@redhat.com>.
On Wed, 2016-08-10 at 15:53 +0000, Deb Haldar wrote:
> Guys, any thoughts on the question below?

I suspect the delay in replying is that no one here is 100% sure
whether you can change the message address and expect messenger to
automatically re-establich a new link, without checking the source
code. That is compounded by the most of the current development work
going into reactive style APIs.

I can tell you are using C++ around this code - is it possible for you
to code this using the reactive C++ API from 0.13 or the beta 0.14?

It would require a little different framework code, but that is an API
that we are currently working on actively.

Andrew

> Thanks,Deb.
> 
> Sent from Yahoo Mail on Android�
> �
> � On Tue, Aug 9, 2016 at 4:18 PM, Deb Haldar<debohaldar@yahoo.com.INV
> ALID> wrote:���Hi Folks,
> I'm trying to use the C Proton messenger to establish and send data
> over two AMQP links. While the first link gets established, I don't
> see the second link getting established.
> My code looks like the following below:
> bool SendMessage(const char* msgtext, size_t message_size,
> std::string tenantRoute)
> {
> �
> �pn_message_t* message = pn_message();
> �pn_message_clear(message);
> �pn_message_set_address(message, tenantRoute.c_str());
> �pn_data_t* body = pn_message_body(message);�pn_data_put_binary(body,
> pn_bytes(message_size,
> msgtext));�pn_message_set_content_type(message,"charset=utf-8");
> �pn_message_set_subject(message, "AMQPTest");
> �
> �//set the timeout of the messenger�
> �pn_messenger_set_timeout(messenger, AmqpMessengerTimeout); // wait
> for a max of two seconds before exit�pn_messenger_put(messenger,
> message);�int result = pn_messenger_send(messenger, -1);�pn_status_t
> status = pn_messenger_status(messenger, tracker);
> �
> �if (status == PN_STATUS_ACCEPTED && !(result < 0))
> �{
> ��sendResult = true;
> �}
> �else
> �{
> ��sendResult = false;
> �}�pn_message_free(message);
> �message = NULL;�return sendResult;
> }
> Essentially I'm trying to pass a new AMQP link address via
> tenantroute every time I call this function.Any ideas ?
> Thanks,
> Deb.��

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: Using two AMQP Links over the same socket

Posted by Deb Haldar <de...@yahoo.com.INVALID>.
Guys, any thoughts on the question below?
Thanks,Deb.

Sent from Yahoo Mail on Android 
 
  On Tue, Aug 9, 2016 at 4:18 PM, Deb Haldar<de...@yahoo.com.INVALID> wrote:   Hi Folks,
I'm trying to use the C Proton messenger to establish and send data over two AMQP links. While the first link gets established, I don't see the second link getting established.
My code looks like the following below:
bool SendMessage(const char* msgtext, size_t message_size, std::string tenantRoute)
{
 
 pn_message_t* message = pn_message();
 pn_message_clear(message);
 pn_message_set_address(message, tenantRoute.c_str());
 pn_data_t* body = pn_message_body(message); pn_data_put_binary(body, pn_bytes(message_size, msgtext)); pn_message_set_content_type(message,"charset=utf-8");
 pn_message_set_subject(message, "AMQPTest");
 
 //set the timeout of the messenger 
 pn_messenger_set_timeout(messenger, AmqpMessengerTimeout); // wait for a max of two seconds before exit pn_messenger_put(messenger, message); int result = pn_messenger_send(messenger, -1); pn_status_t status = pn_messenger_status(messenger, tracker);
 
 if (status == PN_STATUS_ACCEPTED && !(result < 0))
 {
  sendResult = true;
 }
 else
 {
  sendResult = false;
 } pn_message_free(message);
 message = NULL; return sendResult;
}
Essentially I'm trying to pass a new AMQP link address via tenantroute every time I call this function.Any ideas ?
Thanks,
Deb.