Example usage for com.rabbitmq.client Channel basicQos

List of usage examples for com.rabbitmq.client Channel basicQos

Introduction

In this page you can find the example usage for com.rabbitmq.client Channel basicQos.

Prototype

void basicQos(int prefetchCount, boolean global) throws IOException;

Source Link

Document

Request a specific prefetchCount "quality of service" settings for this channel.

Usage

From source file:com.paxxis.cornerstone.messaging.service.amqp.AMQPServiceBusConnector.java

License:Apache License

public Session createSession() {
    try {/*from   w w w. j  av a  2  s.  co  m*/
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(exchangeName, exchangeType, true);
        //max messages in flight per consumer (false means consumer, true means per channel)
        channel.basicQos(maxMessagesInFlight, false);
        return new AMQPSession(channel, exchangeName, getAcknowledgeMode() == Session.AUTO_ACKNOWLEDGE);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}