Skip to content

Commit 0909039

Browse files
Introduce Channel#exchangeBindNowait
1 parent e224af8 commit 0909039

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

src/com/rabbitmq/client/Channel.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,17 @@ void exchangeDeclareNowait(String exchange,
418418
*/
419419
Exchange.BindOk exchangeBind(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException;
420420

421+
/**
422+
* Like {@link Channel#exchangeBind(String, String, String, java.util.Map)} but sets nowait parameter
423+
* to true and returns void (as there will be no response from the server).
424+
* @param destination the name of the exchange to which messages flow across the binding
425+
* @param source the name of the exchange from which messages flow across the binding
426+
* @param routingKey the routine key to use for the binding
427+
* @param arguments other properties (binding parameters)
428+
* @throws java.io.IOException if an error is encountered
429+
*/
430+
void exchangeBindNowait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException;
431+
421432
/**
422433
* Unbind an exchange from an exchange, with no extra arguments.
423434
* @see com.rabbitmq.client.AMQP.Exchange.Bind

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,20 @@ public Exchange.BindOk exchangeBind(String destination, String source,
763763
.getMethod();
764764
}
765765

766+
/** Public API - {@inheritDoc} */
767+
public void exchangeBindNowait(String destination,
768+
String source,
769+
String routingKey,
770+
Map<String, Object> arguments) throws IOException {
771+
transmit(new AMQCommand(new Exchange.Bind.Builder()
772+
.destination(destination)
773+
.source(source)
774+
.routingKey(routingKey)
775+
.arguments(arguments)
776+
.nowait(true)
777+
.build()));
778+
}
779+
766780
/** Public API - {@inheritDoc} */
767781
public Exchange.BindOk exchangeBind(String destination, String source,
768782
String routingKey) throws IOException {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ public AMQP.Exchange.BindOk exchangeBind(String destination, String source, Stri
218218
return ok;
219219
}
220220

221+
public void exchangeBindNowait(String destination, String source, String routingKey, Map<String, Object> arguments) throws IOException {
222+
delegate.exchangeBindNowait(destination, source, routingKey, arguments);
223+
recordExchangeBinding(destination, source, routingKey, arguments);
224+
}
225+
221226
public AMQP.Exchange.UnbindOk exchangeUnbind(String destination, String source, String routingKey) throws IOException {
222227
return exchangeUnbind(destination, source, routingKey, null);
223228
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,15 @@ public void testExchangeDeclareWithNowait() throws IOException {
2626
channel.exchangeDelete(x);
2727
}
2828
}
29+
30+
public void testExchangeBindWithNowait() throws IOException {
31+
String x = generateExchangeName();
32+
try {
33+
channel.exchangeDeclareNowait(x, "fanout", false, false, false, null);
34+
channel.exchangeBindNowait(x, "amq.fanout", "", null);
35+
} finally {
36+
channel.exchangeDelete(x);
37+
}
38+
}
39+
2940
}

0 commit comments

Comments
 (0)