@Override public com.rabbitmq.client.AMQP.Confirm.SelectOk confirmSelect() throws IOException { return this.delegate.confirmSelect(); }
@Override public com.rabbitmq.client.AMQP.Confirm.SelectOk confirmSelect() throws IOException { return this.delegate.confirmSelect(); }
@Override public void confirmSelect() throws IOException { delegate.confirmSelect(); }
@Override protected Channel provideChannel() throws IOException { Channel channel = super.provideChannel(); channel.confirmSelect(); return channel; } }
@Override public void confirmSelect(Handler<AsyncResult<Void>> resultHandler) { forChannel( resultHandler, channel -> { channel.confirmSelect(); channelConfirms = true; return null; }); }
private void enablePublisherConfirms() throws EventDeliveryException { try { rmqChannel.confirmSelect(); } catch (IOException ex) { logger.error("Error enabling Publisher confirmations: {}", ex.toString()); closeRabbitMQConnection(); throw new EventDeliveryException(ex.toString()); } }
private boolean publishAndAck(PublishCallback callback) throws Exception { requireNonNull(callback, "callback must be defined."); boolean res = false; synchronized (channel) { channel.confirmSelect(); callback.callback(channel); res = channel.waitForConfirms(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Publish with confirmation a message from channel {}: {}", channel.getChannelNumber()); } } return res; }
@Override public CompletableFuture<BenchmarkProducer> createProducer(String topic) { Channel channel = null; try { channel = connection.createChannel(); channel.exchangeDeclare(topic, BuiltinExchangeType.FANOUT); channel.confirmSelect(); } catch (IOException e) { e.printStackTrace(); } return CompletableFuture.completedFuture(new RabbitMqBenchmarkProducer(channel, topic, config.messagePersistence)); }
private Channel doCreateBareChannel(ChannelCachingConnectionProxy connection, boolean transactional) { Channel channel = connection.createBareChannel(transactional); if (this.publisherConfirms || this.simplePublisherConfirms) { try { channel.confirmSelect(); } catch (IOException e) { logger.error("Could not configure the channel to receive publisher confirms", e); } } if ((this.publisherConfirms || this.publisherReturns) && !(channel instanceof PublisherCallbackChannelImpl)) { channel = new PublisherCallbackChannelImpl(channel, getChannelsExecutor()); } if (channel != null) { channel.addShutdownListener(this); } return channel; // NOSONAR - Simple connection throws exception }
private Channel doCreateBareChannel(ChannelCachingConnectionProxy connection, boolean transactional) { Channel channel = connection.createBareChannel(transactional); if (this.publisherConfirms || this.simplePublisherConfirms) { try { channel.confirmSelect(); } catch (IOException e) { logger.error("Could not configure the channel to receive publisher confirms", e); } } if ((this.publisherConfirms || this.publisherReturns) && !(channel instanceof PublisherCallbackChannelImpl)) { channel = new PublisherCallbackChannelImpl(channel, getChannelsExecutor()); } if (channel != null) { channel.addShutdownListener(this); } return channel; // NOSONAR - Simple connection throws exception }
private <T> void forChannel(Handler<AsyncResult<T>> resultHandler, ChannelHandler<T> channelHandler) { if (connection == null || channel == null) { resultHandler.handle(Future.failedFuture("Not connected")); return; } if (!channel.isOpen()) { try { //TODO: Is this the best thing ? // change log.debug("channel is close, try create Channel"); channel = connection.createChannel(); if(channelConfirms) channel.confirmSelect(); } catch (IOException e) { log.debug("create channel error"); resultHandler.handle(Future.failedFuture(e)); } } vertx.executeBlocking(future -> { try { T t = channelHandler.handle(channel); future.complete(t); } catch (Throwable t) { future.fail(t); } }, resultHandler); }
try { if (confirm) { channel.confirmSelect();
try { if (confirm) { channel.confirmSelect();
try { if (confirm) { channel.confirmSelect();
try { if (confirm) { channel.confirmSelect();
channel.confirmSelect();
channel.confirmSelect();
private void publishToRabbitMQ(final AMQP.BasicProperties properties, final byte[] body) throws IOException { // remove the OVERRIDE header so it does not propagate String exchangeName = (String) message.removeHeader(RabbitMQConstants.EXCHANGE_OVERRIDE_NAME); // If it is BridgeEndpoint we should ignore the message header of EXCHANGE_OVERRIDE_NAME if (exchangeName == null || endpoint.isBridgeEndpoint()) { exchangeName = endpoint.getExchangeName(); } else { LOG.debug("Overriding header: {} detected sending message to exchange: {}", RabbitMQConstants.EXCHANGE_OVERRIDE_NAME, exchangeName); } Boolean mandatory = camelExchange.getIn().getHeader(RabbitMQConstants.MANDATORY, endpoint.isMandatory(), Boolean.class); Boolean immediate = camelExchange.getIn().getHeader(RabbitMQConstants.IMMEDIATE, endpoint.isImmediate(), Boolean.class); LOG.debug("Sending message to exchange: {} with CorrelationId: {}", exchangeName, properties.getCorrelationId()); if (isPublisherAcknowledgements()) { channel.confirmSelect(); } if (endpoint.isGuaranteedDeliveries()) { basicReturnReceived = false; channel.addReturnListener(guaranteedDeliveryReturnListener); } try { channel.basicPublish(exchangeName, routingKey, mandatory, immediate, properties, body); if (isPublisherAcknowledgements()) { waitForConfirmation(); } } finally { if (endpoint.isGuaranteedDeliveries()) { channel.removeReturnListener(guaranteedDeliveryReturnListener); } } }
/** * Migrates the channel's configuration to the given {@code channel}. */ private void migrateConfiguration(Channel channel) throws Exception { channel.setDefaultConsumer(delegate.getDefaultConsumer()); if (flowBlocked) channel.flowBlocked(); if (basicQos != null) basicQos.invoke(channel); if (confirmSelect) channel.confirmSelect(); if (txSelect) channel.txSelect(); synchronized (shutdownListeners) { for (ShutdownListener listener : shutdownListeners) channel.addShutdownListener(listener); } for (ConfirmListener listener : confirmListeners) channel.addConfirmListener(listener); for (FlowListener listener : flowListeners) channel.addFlowListener(listener); for (ReturnListener listener : returnListeners) channel.addReturnListener(listener); }
/** * Migrates the channel's configuration to the given {@code channel}. */ private void migrateConfiguration(Channel channel) throws Exception { channel.setDefaultConsumer(delegate.getDefaultConsumer()); if (flowBlocked) channel.flowBlocked(); if (basicQos != null) basicQos.invoke(channel); if (confirmSelect) channel.confirmSelect(); if (txSelect) channel.txSelect(); synchronized (shutdownListeners) { for (ShutdownListener listener : shutdownListeners) channel.addShutdownListener(listener); } for (ConfirmListener listener : confirmListeners) channel.addConfirmListener(listener); for (FlowListener listener : flowListeners) channel.addFlowListener(listener); for (ReturnListener listener : returnListeners) channel.addReturnListener(listener); }