@Override public void flushBatched() { _channel.getConnection().setDeferFlush(false); }
@Override protected void doSendInternal(final MessageInstanceConsumer consumer, final MessageInstance entry, final AMQMessage message, final boolean batch) { // put queue entry on a list and then notify the connection to read list. synchronized (getChannel()) { getChannel().getConnection().setDeferFlush(batch); long deliveryTag = getChannel().getNextDeliveryTag(); addUnacknowledgedMessage(entry); getChannel().addUnacknowledgedMessage(entry, deliveryTag, consumer, _usesCredit); sendToClient(consumer, message, entry.getInstanceProperties(), deliveryTag); entry.incrementDeliveryCount(); } } }
@Override protected void doSendInternal(final MessageInstanceConsumer consumer, final MessageInstance entry, final AMQMessage message, final boolean batch) { // if we do not need to wait for client acknowledgements // we can decrement the reference count immediately. // By doing this _before_ the send we ensure that it // doesn't get sent if it can't be dequeued, preventing // duplicate delivery on recovery. // The send may of course still fail, in which case, as // the message is unacked, it will be lost. _txn.dequeue(entry.getEnqueueRecord(), NOOP); try( MessageReference ref = entry.getMessage().newReference()) { InstanceProperties props = entry.getInstanceProperties(); entry.delete(); getChannel().getConnection().setDeferFlush(batch); long deliveryTag = getChannel().getNextDeliveryTag(); sendToClient(consumer, message, props, deliveryTag); } }