Example usage for com.rabbitmq.client ReturnListener handleReturn

List of usage examples for com.rabbitmq.client ReturnListener handleReturn

Introduction

In this page you can find the example usage for com.rabbitmq.client ReturnListener handleReturn.

Prototype

void handleReturn(int replyCode, String replyText, String exchange, String routingKey,
            AMQP.BasicProperties properties, byte[] body) throws IOException;

Source Link

Usage

From source file:org.apache.nifi.amqp.processors.TestChannel.java

License:Apache License

private void discard(final String exchange, final String routingKey, boolean mandatory,
        final BasicProperties props, final byte[] body) {
    // NO ROUTE. Invoke return listener async
    for (final ReturnListener listener : returnListeners) {
        this.executorService.execute(new Runnable() {
            @Override/*w  w w  .  j  a  v  a 2  s .c o m*/
            public void run() {
                try {
                    listener.handleReturn(-9, "Rejecting", exchange, routingKey, props, body);
                } catch (Exception e) {
                    throw new IllegalStateException("Failed to send return message", e);
                }
            }
        });
    }
}