com.rabbitmq.client.CancelCallback Java Examples
The following examples show how to use
com.rabbitmq.client.CancelCallback.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RabbitMQTest.java From james-project with Apache License 2.0 | 5 votes |
@Test void rabbitMQShouldSupportTheExclusiveWorkQueueCase() throws Exception { channel1.exchangeDeclare(EXCHANGE_NAME, "direct", DURABLE); channel1.queueDeclare(WORK_QUEUE, DURABLE, !EXCLUSIVE, !AUTO_DELETE, ImmutableMap.of()); channel1.queueBind(WORK_QUEUE, EXCHANGE_NAME, ROUTING_KEY); IntStream.range(0, 10) .mapToObj(String::valueOf) .map(RabbitMQTest.this::asBytes) .forEach(Throwing.<byte[]>consumer( bytes -> channel1.basicPublish(EXCHANGE_NAME, ROUTING_KEY, NO_PROPERTIES, bytes)).sneakyThrow()); String dyingConsumerTag = "dyingConsumer"; ImmutableMap<String, Object> arguments = ImmutableMap.of(); ConcurrentLinkedQueue<Integer> receivedMessages = new ConcurrentLinkedQueue<>(); CancelCallback doNothingOnCancel = consumerTag -> { }; DeliverCallback ackFirstMessageOnly = (consumerTag, message) -> { if (receivedMessages.size() == 0) { receivedMessages.add(Integer.valueOf(new String(message.getBody(), StandardCharsets.UTF_8))); channel2.basicAck(message.getEnvelope().getDeliveryTag(), !MULTIPLE); } else { channel2.basicNack(message.getEnvelope().getDeliveryTag(), !MULTIPLE, REQUEUE); } }; channel2.basicConsume(WORK_QUEUE, !AUTO_ACK, dyingConsumerTag, !NO_LOCAL, EXCLUSIVE, arguments, ackFirstMessageOnly, doNothingOnCancel); awaitAtMostOneMinute.until(() -> receivedMessages.size() == 1); channel2.basicCancel(dyingConsumerTag); InMemoryConsumer fallbackConsumer = new InMemoryConsumer(channel3); channel3.basicConsume(WORK_QUEUE, AUTO_ACK, "fallbackConsumer", !NO_LOCAL, EXCLUSIVE, arguments, fallbackConsumer); awaitAtMostOneMinute.until(() -> countReceivedMessages(fallbackConsumer) >= 1); assertThat(receivedMessages).containsExactly(0); assertThat(fallbackConsumer.getConsumedMessages()).contains(1, 2).doesNotContain(0); }
Example #2
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { return delegate.basicConsume(queue, autoAck, arguments, deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #3
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #4
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #5
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #6
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #7
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #8
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #9
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #10
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #11
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #12
Source File: TestChannel.java From nifi with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { throw new UnsupportedOperationException("This method is not currently supported as it is not used by current API in testing"); }
Example #13
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { return delegate.basicConsume(queue, autoAck, consumerTag, noLocal, exclusive, arguments, deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #14
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { return delegate.basicConsume(queue, autoAck, consumerTag, noLocal, exclusive, arguments, deliverCallback, cancelCallback); }
Example #15
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { return delegate.basicConsume(queue, autoAck, consumerTag, deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #16
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { return delegate.basicConsume(queue, autoAck, consumerTag, deliverCallback, cancelCallback); }
Example #17
Source File: ConsumerWrapper.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
public ConsumerWrapper(DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) { this.deliverCallback = deliverCallback; this.cancelCallback = cancelCallback; this.shutdownSignalCallback = shutdownSignalCallback; }
Example #18
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { return delegate.basicConsume(queue, autoAck, arguments, deliverCallback, cancelCallback); }
Example #19
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { return delegate.basicConsume(queue, autoAck, deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #20
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { return delegate.basicConsume(queue, autoAck, deliverCallback, cancelCallback); }
Example #21
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) throws IOException { return delegate.basicConsume(queue, deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #22
Source File: PoolableChannel.java From jweb-cms with GNU Affero General Public License v3.0 | 4 votes |
@Override public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback) throws IOException { return delegate.basicConsume(queue, deliverCallback, cancelCallback); }
Example #23
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) { return basicConsume(queue, autoAck, consumerTag, noLocal, exclusive, arguments, new ConsumerWrapper(deliverCallback, cancelCallback, shutdownSignalCallback)); }
Example #24
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, boolean noLocal, boolean exclusive, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) { return basicConsume(queue, autoAck, consumerTag, noLocal, exclusive, arguments, deliverCallback, cancelCallback, null); }
Example #25
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) { return basicConsume(queue, autoAck, consumerTag, false, false, Collections.emptyMap(), deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #26
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, String consumerTag, DeliverCallback deliverCallback, CancelCallback cancelCallback) { return basicConsume(queue, autoAck, consumerTag, deliverCallback, cancelCallback, null); }
Example #27
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) { return basicConsume(queue, autoAck, "", false, false, arguments, deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #28
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, Map<String, Object> arguments, DeliverCallback deliverCallback, CancelCallback cancelCallback) { return basicConsume(queue, autoAck, arguments, deliverCallback, cancelCallback, null); }
Example #29
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, boolean autoAck, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) { return basicConsume(queue, autoAck, Collections.emptyMap(), deliverCallback, cancelCallback, shutdownSignalCallback); }
Example #30
Source File: MockChannel.java From rabbitmq-mock with Apache License 2.0 | 4 votes |
@Override public String basicConsume(String queue, DeliverCallback deliverCallback, CancelCallback cancelCallback, ConsumerShutdownSignalCallback shutdownSignalCallback) { return basicConsume(queue, false, deliverCallback, cancelCallback, shutdownSignalCallback); }