Subject: | Missing operation: exchange.delete |
Exchanges can be declared, but not deleted.
I've hacked together a patch that adds this missing operation. It seems
to work for me, but could probably do with considerably more testing. :)
Subject: | add_exchange_delete.patch |
diff -urN Net-RabbitMQ-0.1.5-orig//amqp_api.c Net-RabbitMQ-0.1.5/amqp_api.c
--- Net-RabbitMQ-0.1.5-orig//amqp_api.c 2010-03-30 15:02:46.000000000 +0100
+++ Net-RabbitMQ-0.1.5/amqp_api.c 2010-06-09 16:52:55.246452127 +0100
@@ -136,6 +136,19 @@
return RPC_REPLY(amqp_exchange_declare_ok_t);
}
+amqp_exchange_delete_ok_t *amqp_exchange_delete(amqp_connection_state_t state,
+ amqp_channel_t channel,
+ amqp_bytes_t exchange)
+{
+ amqp_rpc_reply_t *amqp_rpc_reply;
+ amqp_rpc_reply = amqp_get_rpc_reply();
+ *amqp_rpc_reply =
+ AMQP_SIMPLE_RPC(state, channel, EXCHANGE, DELETE, DELETE_OK,
+ amqp_exchange_delete_t,
+ 0, exchange);
+ return RPC_REPLY(amqp_exchange_delete_ok_t);
+}
+
amqp_queue_declare_ok_t *amqp_queue_declare(amqp_connection_state_t state,
amqp_channel_t channel,
amqp_bytes_t queue,
diff -urN Net-RabbitMQ-0.1.5-orig//RabbitMQ.pm Net-RabbitMQ-0.1.5/RabbitMQ.pm
--- Net-RabbitMQ-0.1.5-orig//RabbitMQ.pm 2010-04-22 16:45:59.000000000 +0100
+++ Net-RabbitMQ-0.1.5/RabbitMQ.pm 2010-06-09 16:39:26.186420132 +0100
@@ -90,6 +90,12 @@
auto_delete => $boolean, #default 1
}
+=item exchange_delete($channel, $exchange)
+
+C<$channel> is a channel that has been opened with C<channel_open>.
+
+C<$exchange> is the name of the exchange to be deleted.
+
=item queue_declare($channel, $queuename, $options)
C<$channel> is a channel that has been opened with C<channel_open>.
diff -urN Net-RabbitMQ-0.1.5-orig//RabbitMQ.xs Net-RabbitMQ-0.1.5/RabbitMQ.xs
--- Net-RabbitMQ-0.1.5-orig//RabbitMQ.xs 2010-04-22 01:06:16.000000000 +0100
+++ Net-RabbitMQ-0.1.5/RabbitMQ.xs 2010-06-09 16:46:36.102429505 +0100
@@ -254,6 +254,18 @@
amqp_rpc_reply = amqp_get_rpc_reply();
die_on_amqp_error(aTHX_ *amqp_rpc_reply, "Declaring exchange");
+void
+net_rabbitmq_exchange_delete(conn, channel, exchange)
+ Net::RabbitMQ conn
+ int channel
+ char *exchange
+ PREINIT:
+ amqp_rpc_reply_t *amqp_rpc_reply;
+ CODE:
+ amqp_exchange_delete(conn, channel, amqp_cstring_bytes(exchange));
+ amqp_rpc_reply = amqp_get_rpc_reply();
+ die_on_amqp_error(aTHX_ *amqp_rpc_reply, "Deleting exchange");
+
SV *
net_rabbitmq_queue_declare(conn, channel, queuename, options = NULL, args = NULL)
Net::RabbitMQ conn