Example usage for com.rabbitmq.client Method protocolMethodName

List of usage examples for com.rabbitmq.client Method protocolMethodName

Introduction

In this page you can find the example usage for com.rabbitmq.client Method protocolMethodName.

Prototype

String protocolMethodName();

Source Link

Document

Retrieve the method name

Usage

From source file:org.flockdata.client.amqp.FdRabbitClient.java

License:Apache License

private void openConnection() throws IOException, TimeoutException {
    if (connectionFactory == null)
        initConnectionFactory();/*from   w w  w.  j  a  va2  s  .co m*/

    connection = connectionFactory.newConnection();
    connection.addShutdownListener(cause -> {
        Method reason = cause.getReason();
        if (cause.isHardError()) {
            if (!cause.isInitiatedByApplication()) {
                logger.debug("Hard shutdown initiate - {} {} {}",
                        (reason != null ? reason.protocolMethodName() : "null protocol method"),
                        cause.getReason(), cause.getMessage());
            }
        } else {
            logger.debug("Shutdown initiated - {} {} {}",
                    (reason != null ? reason.protocolMethodName() : "null protocol method"), cause.getReason(),
                    cause.getMessage());
        }
        connection = null;
        connectionFactory = null;
    });

    trackChannel = connection.createChannel();
    logger.debug("{}/{}/{}", configuration.getTrackQueue(), configuration.getFdExchange(),
            configuration.getTrackRoutingKey());
    logger.debug(trackChannel.queueBind(configuration.getTrackQueue(), configuration.getFdExchange(),
            configuration.getTrackRoutingKey(), rabbitConfig.getFdQueueFeatures()).toString());

}