Example usage for com.rabbitmq.client Channel addConfirmListener

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

Introduction

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

Prototype

void addConfirmListener(ConfirmListener listener);

Source Link

Document

Add a ConfirmListener .

Usage

From source file:net.lshift.accent.AccentConfirmPublisher.java

License:Apache License

@Override
public void channelCreated(Channel c) throws IOException {
    // Enable publisher confirmations on channel
    c.confirmSelect();/*from   w w w.  j a  v  a 2  s  .co  m*/

    // Add listeners to allow us to process publisher acks
    c.addConfirmListener(feedbackListener);
}

From source file:org.mule.transport.amqp.DefaultAmqpConfirmsManager.java

License:Open Source License

public void requestConfirm(Channel channel, MuleEvent event) throws Exception {
    if (!handlesConfirms()) {
        return;/*  www .  j ava  2s.  co m*/
    }

    channel.addConfirmListener(new ConfirmListener() {
        public void handleAck(long deliveryTag, boolean multiple) throws IOException {
            confirm(deliveryTag, true);
        }

        public void handleNack(long deliveryTag, boolean multiple) throws IOException {
            confirm(deliveryTag, false);
        }
    });

    channel.confirmSelect();
    long nextSequence = channel.getNextPublishSeqNo();
    pendingConfirms.put(nextSequence, new ConfirmHandler());
    event.setFlowVariable(AmqpConstants.NEXT_PUBLISH_SEQ_NO, nextSequence);

}

From source file:org.mule.transport.amqp.internal.confirm.DefaultConfirmsManager.java

License:Open Source License

public void requestConfirm(Channel channel, MuleEvent event) throws Exception {
    if (!handlesConfirms()) {
        return;/*  w  ww. ja  va 2  s . c  om*/
    }

    channel.addConfirmListener(new ConfirmListener() {
        public void handleAck(long deliveryTag, boolean multiple) throws IOException {
            confirm(deliveryTag, true);
        }

        public void handleNack(long deliveryTag, boolean multiple) throws IOException {
            confirm(deliveryTag, false);
        }
    });

    channel.confirmSelect();
    long nextSequence = channel.getNextPublishSeqNo();
    pendingConfirms.put(nextSequence, new ConfirmHandler());
    event.setFlowVariable(AmqpConnector.MESSAGE_PROPERTY_NEXT_PUBLISH_SEQ_NO, nextSequence);

}

From source file:vn.com.uet.performance.rabbitmq.MulticastParams.java

License:Open Source License

public Producer createProducer(Connection connection, Stats stats, String id) throws IOException {
    Channel channel = connection.createChannel();
    if (producerTxSize > 0)
        channel.txSelect();//from   w  w  w  . j  ava  2 s. c o m
    if (confirm >= 0)
        channel.confirmSelect();
    if (!predeclared || !exchangeExists(connection, exchangeName)) {
        channel.exchangeDeclare(exchangeName, exchangeType);
    }
    final Producer producer = new Producer(channel, exchangeName, id, randomRoutingKey, flags, producerTxSize,
            producerRateLimit, producerMsgCount, minMsgSize, timeLimit, confirm, stats);
    channel.addReturnListener(producer);
    channel.addConfirmListener(producer);
    return producer;
}