Deleting queues doesn't cut connection?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Deleting queues doesn't cut connection?

Haster
Hi there.
I have below problem:
I connect to rabbitmq server, and start loop of reading messages from some queue.
After that I kill this queue on server -> but select function on socket doesn't return any errors.
And If I create this queue again - I won't receive any messages (I try push messages to queue from WEB interface)
So how can I process this situation?
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Michael Klishin-2
Haster:

> I connect to rabbitmq server, and start loop of reading messages from some
> queue.

Can you post your code? Do you use a loop with basic.get or subscribe
for server-pushed deliveries using basic.consume?

> After that I kill this queue on server -> but select function on socket
> doesn't return any errors.

Removing a queue does not close the connection.

> And If I create this queue again - I won't receive any messages (I try push
> messages to queue from WEB interface)

This may mean a channel exception that your client or app code somehow
swallows. See RabbitMQ log, all channel exceptions will be logged there.
--
MK


_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

signature.asc (506 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Simon MacMullen-2
On 16/08/13 13:51, Michael Klishin wrote:
>> >After that I kill this queue on server -> but select function on socket
>> >doesn't return any errors.
> Removing a queue does not close the connection.

Quite. This is what http://www.rabbitmq.com/consumer-cancel.html is for.
Haster, does your client support that?

Cheers, Simon

--
Simon MacMullen
RabbitMQ, Pivotal
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Haster
This post was updated on .
In reply to this post by Michael Klishin-2
Michael, thanks for reply.
I subscribe for server-pushed deliveries using basic.consume method.
Loop of reading is something like belowЖ
  int wait(int fd, int timeout_msec)
  {
    fd_set fds;
    fd_set errfd;
    struct timeval tv;

    FD_ZERO(&fds);
    FD_SET(fd, &fds);

    FD_ZERO(&errfd);
    FD_SET(fd, &errfd);

    tv.tv_sec  = timeout_msec / 1000;
    tv.tv_usec = 1000 * (timeout_msec % 1000); //mksec

    int rc = select(fd + 1, &fds, NULL, &errfd, &tv);

    if(rc == -1)
      return SELECT_ERROR;
    else if(rc == 0)
      return TIMEOUT;
    if(FD_ISSET(fd, &errfd))
      return FDSET_ERROR;
    return READY;
  }

  RabbitMQMessage *RabbitMQQueueImpl::recv(int timeout) throw(RabbitMQException) {
    amqp_connection_state_t conn = connection.getConnection();
    std::string temp;
    std::auto_ptr<RabbitMQMessageImpl> message(new RabbitMQMessageImpl(conn, autoAck ? NULL : channel, 0, 0, 0));

    while (true) {
      amqp_maybe_release_buffers(conn);
     
      if (!amqp_data_in_buffer(conn) && !amqp_frames_enqueued(conn)) {
        switch (wait(connection.getfd(), timeout)) {
          case READY:
            break;
          case SELECT_ERROR:
          case FDSET_ERROR:
            throw RabbitMQException(-1, "Connection error");
          case TIMEOUT:
            return NULL;
          default:
            throw RabbitMQException(-1, "Unexpected");
        }
      }

      amqp_maybe_release_buffers(conn);

      amqp_frame_t frame;
      int result = amqp_simple_wait_frame(conn, &frame);

      if (result < 0) {
        return NULL;
      }
...
reading packet

The problem is that in function wait I always go to timeout branch
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Haster
In reply to this post by Simon MacMullen-2
Simon,
As I understand when queue is deleting from server? rabbitmq send to client basic.cancel. Is it right?
(My english isn't enough to clear understand those text)

I use rabbitmq-c library in my project and as I know there is no support of any callback functions (I use 0.3.0 version)
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Michael Klishin-2
In reply to this post by Haster
Haster:

> I subscribe for server-pushed deliveries using basic.consume method.

In such case, you need to handle consumer cancellation notifications
[1].

> Loop of reading is something like below

Unfortunately, I'm not familiar with librabbitmq-c and the C++ library
built on top of it to tell how to use consumer cancellation notifications
and if they support it at all.

1. http://www.rabbitmq.com/consumer-cancel.html
--
MK


_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

signature.asc (506 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Haster
Michael and Simon, thanks for answers.

I understand that I have to realize some mechanism to handle basic.cancel from server
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Chris-3
Hi Haster,

The rabbitmq-c library does support consumer cancel notifications.  I recommend you check out this thread:


-Chris


On Fri, Aug 16, 2013 at 9:40 AM, Haster <[hidden email]> wrote:
Michael and Simon, thanks for answers.

I understand that I have to realize some mechanism to handle basic.cancel
from server



--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Deleting-queues-doesn-t-cut-connection-tp28872p28880.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss


_______________________________________________
rabbitmq-discuss mailing list
[hidden email]
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Deleting queues doesn't cut connection?

Haster
Chris,
thanks a lot for information. i will investigate it.