RabbitUtils.commitIfNecessary(this.channel);
RabbitUtils.commitIfNecessary(this.channel);
public void rollbackAll() { for (Channel channel : this.channels) { if (logger.isDebugEnabled()) { logger.debug("Rolling back messages to channel: " + channel); } RabbitUtils.rollbackIfNecessary(channel); if (this.deliveryTags.containsKey(channel)) { for (Long deliveryTag : this.deliveryTags.get(channel)) { try { channel.basicReject(deliveryTag, this.requeueOnRollback); } catch (IOException ex) { throw new AmqpIOException(ex); } } // Need to commit the reject (=nack) RabbitUtils.commitIfNecessary(channel); } } }
RabbitUtils.commitIfNecessary(this.channel);
public void rollbackAll() { for (Channel channel : this.channels) { if (logger.isDebugEnabled()) { logger.debug("Rolling back messages to channel: " + channel); } RabbitUtils.rollbackIfNecessary(channel); if (this.deliveryTags.containsKey(channel)) { for (Long deliveryTag : this.deliveryTags.get(channel)) { try { channel.basicReject(deliveryTag, this.requeueOnRollback); } catch (IOException ex) { throw new AmqpIOException(ex); } } // Need to commit the reject (=nack) RabbitUtils.commitIfNecessary(channel); } } }
RabbitUtils.commitIfNecessary(this.channel);
RabbitUtils.commitIfNecessary(channel);
RabbitUtils.commitIfNecessary(channel);
private void cleanUpAfterInvoke(@Nullable RabbitResourceHolder resourceHolder, Channel channelToUse, boolean boundHere) { if (resourceHolder != null && boundHere) { // so the channel exposed (because exposeListenerChannel is false) will be closed resourceHolder.setSynchronizedWithTransaction(false); } ConnectionFactoryUtils.releaseResources(resourceHolder); // NOSONAR - null check in method if (boundHere) { // unbind if we bound TransactionSynchronizationManager.unbindResource(this.getConnectionFactory()); if (!isExposeListenerChannel() && isChannelLocallyTransacted()) { /* * commit the temporary channel we exposed; the consumer's channel * will be committed later. Note that when exposing a different channel * when there's no transaction manager, the exposed channel is committed * on each message, and not based on txSize. */ RabbitUtils.commitIfNecessary(channelToUse); } } }
private void cleanUpAfterInvoke(@Nullable RabbitResourceHolder resourceHolder, Channel channelToUse, boolean boundHere) { if (resourceHolder != null && boundHere) { // so the channel exposed (because exposeListenerChannel is false) will be closed resourceHolder.setSynchronizedWithTransaction(false); } ConnectionFactoryUtils.releaseResources(resourceHolder); // NOSONAR - null check in method if (boundHere) { // unbind if we bound TransactionSynchronizationManager.unbindResource(this.getConnectionFactory()); if (!isExposeListenerChannel() && isChannelLocallyTransacted()) { /* * commit the temporary channel we exposed; the consumer's channel * will be committed later. Note that when exposing a different channel * when there's no transaction manager, the exposed channel is committed * on each message, and not based on txSize. */ RabbitUtils.commitIfNecessary(channelToUse); } } }
private void handleAck(long deliveryTag, boolean channelLocallyTransacted) { /* * If we have a TX Manager, but no TX, act like we are locally transacted. */ boolean isLocallyTransacted = channelLocallyTransacted || (isChannelTransacted() && TransactionSynchronizationManager.getResource(this.connectionFactory) == null); try { if (this.ackRequired) { if (this.messagesPerAck > 1) { synchronized (this) { this.latestDeferredDeliveryTag = deliveryTag; this.pendingAcks++; this.lastDeliveryComplete = System.currentTimeMillis(); ackIfNecessary(this.lastDeliveryComplete); } } else if (!isChannelTransacted() || isLocallyTransacted) { getChannel().basicAck(deliveryTag, false); } } if (isLocallyTransacted) { RabbitUtils.commitIfNecessary(getChannel()); } } catch (Exception e) { this.logger.error("Error acking", e); } }
private void handleAck(long deliveryTag, boolean channelLocallyTransacted) { /* * If we have a TX Manager, but no TX, act like we are locally transacted. */ boolean isLocallyTransacted = channelLocallyTransacted || (isChannelTransacted() && TransactionSynchronizationManager.getResource(this.connectionFactory) == null); try { if (this.ackRequired) { if (this.messagesPerAck > 1) { synchronized (this) { this.latestDeferredDeliveryTag = deliveryTag; this.pendingAcks++; this.lastDeliveryComplete = System.currentTimeMillis(); ackIfNecessary(this.lastDeliveryComplete); } } else if (!isChannelTransacted() || isLocallyTransacted) { getChannel().basicAck(deliveryTag, false); } } if (isLocallyTransacted) { RabbitUtils.commitIfNecessary(getChannel()); } } catch (Exception e) { this.logger.error("Error acking", e); } }
private void rollback(long deliveryTag, Exception e) { if (isChannelTransacted()) { RabbitUtils.rollbackIfNecessary(getChannel()); } if (this.ackRequired) { try { if (this.messagesPerAck > 1) { synchronized (this) { if (this.pendingAcks > 0) { sendAck(System.currentTimeMillis()); } } } getChannel().basicNack(deliveryTag, true, ContainerUtils.shouldRequeue(isDefaultRequeueRejected(), e, this.logger)); } catch (IOException e1) { this.logger.error("Failed to nack message", e1); } } if (isChannelTransacted()) { RabbitUtils.commitIfNecessary(getChannel()); } }
private void rollback(long deliveryTag, Exception e) { if (isChannelTransacted()) { RabbitUtils.rollbackIfNecessary(getChannel()); } if (this.ackRequired) { try { if (this.messagesPerAck > 1) { synchronized (this) { if (this.pendingAcks > 0) { sendAck(System.currentTimeMillis()); } } } getChannel().basicNack(deliveryTag, true, ContainerUtils.shouldRequeue(isDefaultRequeueRejected(), e, this.logger)); } catch (IOException e1) { this.logger.error("Failed to nack message", e1); } } if (isChannelTransacted()) { RabbitUtils.commitIfNecessary(getChannel()); } }