Skip to content

Commit 7a74269

Browse files
Introduce Channel#exchangeUnbindNoWait
1 parent e818064 commit 7a74269

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/com/rabbitmq/client/Channel.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,17 @@ void exchangeDeclareNoWait(String exchange,
466466
*/
467467
Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException;
468468

469+
/**
470+
* Same as {@link Channel#exchangeUnbind(String, String, String, java.util.Map)} but sets no-wait parameter to true
471+
* and retuns nothing (as there will be no response from the server).
472+
* @param destination the name of the exchange to which messages flow across the binding
473+
* @param source the name of the exchange from which messages flow across the binding
474+
* @param routingKey the routine key to use for the binding
475+
* @param arguments other properties (binding parameters)
476+
* @throws java.io.IOException if an error is encountered
477+
*/
478+
void exchangeUnbindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException;
479+
469480
/**
470481
* Actively declare a server-named exclusive, autodelete, non-durable queue.
471482
* The name of the new queue is held in the "queue" field of the {@link com.rabbitmq.client.AMQP.Queue.DeclareOk} result.

src/com/rabbitmq/client/impl/ChannelN.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,19 @@ public Exchange.UnbindOk exchangeUnbind(String destination, String source,
812812
return exchangeUnbind(destination, source, routingKey, null);
813813
}
814814

815+
/** Public API - {@inheritDoc} */
816+
public void exchangeUnbindNoWait(String destination, String source,
817+
String routingKey, Map<String, Object> arguments)
818+
throws IOException {
819+
transmit(new AMQCommand(new Exchange.Unbind.Builder()
820+
.destination(destination)
821+
.source(source)
822+
.routingKey(routingKey)
823+
.arguments(arguments)
824+
.nowait(true)
825+
.build()));
826+
}
827+
815828
/** Public API - {@inheritDoc} */
816829
public Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive,
817830
boolean autoDelete, Map<String, Object> arguments)

src/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ public AMQP.Exchange.UnbindOk exchangeUnbind(String destination, String source,
243243
return delegate.exchangeUnbind(destination, source, routingKey, arguments);
244244
}
245245

246+
public void exchangeUnbindNoWait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException {
247+
delegate.exchangeUnbindNoWait(destination, source, routingKey, arguments);
248+
deleteRecordedExchangeBinding(destination, source, routingKey, arguments);
249+
}
250+
246251
public AMQP.Queue.DeclareOk queueDeclare() throws IOException {
247252
return queueDeclare("", false, true, true, null);
248253
}

test/src/com/rabbitmq/client/test/functional/Nowait.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ public void testExchangeDeclareWithNowait() throws IOException {
2828
}
2929

3030
public void testExchangeBindWithNowait() throws IOException {
31+
String x = generateExchangeName();
32+
try {
33+
channel.exchangeDeclare(x, "fanout", false, false, false, null);
34+
channel.exchangeBind(x, "amq.fanout", "", null);
35+
channel.exchangeUnbindNoWait(x, "amq.fanout", "", null);
36+
} finally {
37+
channel.exchangeDelete(x);
38+
}
39+
}
40+
41+
public void testExchangeUnbindWithNowait() throws IOException {
3142
String x = generateExchangeName();
3243
try {
3344
channel.exchangeDeclareNoWait(x, "fanout", false, false, false, null);

0 commit comments

Comments
 (0)