Skip Menu |

This queue is for tickets about the Net-RabbitMQ CPAN distribution.

Report information
The Basics
Id: 57291
Status: resolved
Priority: 0/
Queue: Net-RabbitMQ

People
Owner: Nobody in particular
Requestors: daviddcawley [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in:
  • 0.0.1
  • 0.0.2
  • 0.0.3
  • 0.0.4
  • 0.1.0
  • 0.1.1
  • 0.1.2
  • 0.1.3
  • 0.1.4
  • 0.1.5
Fixed in: (no value)



Subject: queue_declare does not return the message and consumer counts
queue_declare() does not currently return the message and consumer counts. These are already available in the amqp_queue_declare_ok_t structure and returned by python libraries. I've attached a sample patch to RabbitMQ.xs that uses PPCODE to manage the stack and return the two unsigned ints. However, I've never delved into xs code before so I'd suggest you reviewing it carefully. It would cause Net-RabbitMQ-0.1.5/t/008_queue_declare.t to fail as the queue_declare would now return a list rather than a scalar. Updating the unit test is trivial but it's could break existing uses of your module. Perhaps only returning the list when passive flag is used would help?
Subject: rabbitmq.patch
*** Net-RabbitMQ-0.1.5/RabbitMQ.xs.orig 2010-05-08 01:36:37.000000000 +0800 --- Net-RabbitMQ-0.1.5/RabbitMQ.xs 2010-05-08 01:38:28.000000000 +0800 *************** *** 1,6 **** --- 1,7 ---- #include "EXTERN.h" #include "perl.h" #include "XSUB.h" + #include <sys/vfs.h> #include "amqp.h" #include "amqp_framing.h" *************** *** 269,275 **** int auto_delete = 1; amqp_table_t arguments = AMQP_EMPTY_TABLE; amqp_bytes_t queuename_b = AMQP_EMPTY_BYTES; ! CODE: if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename); if(options) { int_from_hv(options, passive); --- 270,276 ---- int auto_delete = 1; amqp_table_t arguments = AMQP_EMPTY_TABLE; amqp_bytes_t queuename_b = AMQP_EMPTY_BYTES; ! PPCODE: if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename); if(options) { int_from_hv(options, passive); *************** *** 282,290 **** arguments); amqp_rpc_reply = amqp_get_rpc_reply(); die_on_amqp_error(aTHX_ *amqp_rpc_reply, "Declaring queue"); ! RETVAL = newSVpvn(r->queue.bytes, r->queue.len); ! OUTPUT: ! RETVAL void net_rabbitmq_queue_bind(conn, channel, queuename, exchange, bindingkey, args = NULL) --- 283,292 ---- arguments); amqp_rpc_reply = amqp_get_rpc_reply(); die_on_amqp_error(aTHX_ *amqp_rpc_reply, "Declaring queue"); ! ! XPUSHs(sv_2mortal(newSVpvn(r->queue.bytes,r->queue.len))); ! XPUSHs(sv_2mortal(newSVuv(r->message_count))); ! XPUSHs(sv_2mortal(newSVuv(r->consumer_count))); void net_rabbitmq_queue_bind(conn, channel, queuename, exchange, bindingkey, args = NULL)
That approach breaks BC. I'll need to return different things based on context.
Resolved on github.. next release will include fix (v0.1.10)