/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
private boolean redeliveryExceeded(MessageDispatch md) { try { return session.getTransacted() && redeliveryPolicy != null && redeliveryPolicy.isPreDispatchCheck() && redeliveryPolicy.getMaximumRedeliveries() != RedeliveryPolicy.NO_MAXIMUM_REDELIVERIES && md.getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries() // redeliveryCounter > x expected after resend via brokerRedeliveryPlugin && md.getMessage().getProperty("redeliveryDelay") == null; } catch (Exception ignored) { return false; } }
@Override public Response processMessageDispatch(MessageDispatch md) throws Exception { waitForTransportInterruptionProcessingToComplete(); ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId()); if (dispatcher != null) { // Copy in case a embedded broker is dispatching via // vm:// // md.getMessage() == null to signal end of queue // browse. Message msg = md.getMessage(); if (msg != null) { msg = msg.copy(); msg.setReadOnlyBody(true); msg.setReadOnlyProperties(true); msg.setRedeliveryCounter(md.getRedeliveryCounter()); msg.setConnection(ActiveMQConnection.this); msg.setMemoryUsage(null); md.setMessage(msg); } dispatcher.dispatch(md); } else { LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers); } return null; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
} else if (md.getMessage() == null) { return null; } else if (consumeExpiredMessage(md)) { } else if (redeliveryExceeded(md)) { LOG.debug("{} received with excessive redelivered: {}", getConsumerId(), md); posionAck(md, "Dispatch[" + md.getRedeliveryCounter() + "] to " + getConsumerId() + " exceeds redelivery policy limit:" + redeliveryPolicy); if (timeout > 0) { timeout = Math.max(deadline - System.currentTimeMillis(), 0);
@Override public Response processMessageDispatch(MessageDispatch md) throws Exception { waitForTransportInterruptionProcessingToComplete(); ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId()); if (dispatcher != null) { // Copy in case a embedded broker is dispatching via // vm:// // md.getMessage() == null to signal end of queue // browse. Message msg = md.getMessage(); if (msg != null) { msg = msg.copy(); msg.setReadOnlyBody(true); msg.setReadOnlyProperties(true); msg.setRedeliveryCounter(md.getRedeliveryCounter()); msg.setConnection(ActiveMQConnection.this); msg.setMemoryUsage(null); md.setMessage(msg); } dispatcher.dispatch(md); } else { LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers); } return null; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
synchronized (unconsumedMessages.getMutex()) { if (!unconsumedMessages.isClosed()) { if (this.info.isBrowser() || !session.connection.isDuplicate(this, md.getMessage())) { if (listener != null && unconsumedMessages.isRunning()) { if (redeliveryExceeded(md)) { posionAck(md, "listener dispatch[" + md.getRedeliveryCounter() + "] to " + getConsumerId() + " exceeds redelivery policy limit:" + redeliveryPolicy); return; LOG.error("{} Exception while processing message: {}", getConsumerId(), md.getMessage().getMessageId(), e); md.setRollbackCause(e); if (isAutoAcknowledgeBatch() || isAutoAcknowledgeEach() || session.isIndividualAcknowledge()) { if (!unconsumedMessages.isRunning()) { session.connection.rollbackDuplicate(this, md.getMessage());
@Override public Response processMessageDispatch(MessageDispatch md) throws Exception { waitForTransportInterruptionProcessingToComplete(); ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId()); if (dispatcher != null) { // Copy in case a embedded broker is dispatching via // vm:// // md.getMessage() == null to signal end of queue // browse. Message msg = md.getMessage(); if (msg != null) { msg = msg.copy(); msg.setReadOnlyBody(true); msg.setReadOnlyProperties(true); msg.setRedeliveryCounter(md.getRedeliveryCounter()); msg.setConnection(ActiveMQConnection.this); msg.setMemoryUsage(null); md.setMessage(msg); } dispatcher.dispatch(md); } else { LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers); } return null; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
@Override public void rollback(LocalTransactionId txnId) throws Exception { synchronized (outbound) { LOG.trace("Rolling back {} messages for redelivery. ", dispatchedInTx.size()); for (Delivery delivery : dispatchedInTx) { // Only settled deliveries should be re-dispatched, unsettled deliveries // remain acquired on the remote end and can be accepted again in a new // TX or released or rejected etc. MessageDispatch dispatch = (MessageDispatch) delivery.getContext(); dispatch.getMessage().setTransactionId(null); if (delivery.remotelySettled()) { dispatch.setRedeliveryCounter(dispatch.getRedeliveryCounter() + 1); outbound.addFirst(dispatch); } } dispatchedInTx.clear(); } }
@Override public Response processMessageDispatch(MessageDispatch md) throws Exception { waitForTransportInterruptionProcessingToComplete(); ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId()); if (dispatcher != null) { // Copy in case a embedded broker is dispatching via // vm:// // md.getMessage() == null to signal end of queue // browse. Message msg = md.getMessage(); if (msg != null) { msg = msg.copy(); msg.setReadOnlyBody(true); msg.setReadOnlyProperties(true); msg.setRedeliveryCounter(md.getRedeliveryCounter()); msg.setConnection(ActiveMQConnection.this); msg.setMemoryUsage(null); md.setMessage(msg); } dispatcher.dispatch(md); } else { LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers); } return null; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
@Override public void rollback(LocalTransactionId txnId) throws Exception { synchronized (outbound) { LOG.trace("Rolling back {} messages for redelivery. ", dispatchedInTx.size()); for (Delivery delivery : dispatchedInTx) { // Only settled deliveries should be re-dispatched, unsettled deliveries // remain acquired on the remote end and can be accepted again in a new // TX or released or rejected etc. MessageDispatch dispatch = (MessageDispatch) delivery.getContext(); dispatch.getMessage().setTransactionId(null); if (delivery.remotelySettled()) { dispatch.setRedeliveryCounter(dispatch.getRedeliveryCounter() + 1); outbound.addFirst(dispatch); } } dispatchedInTx.clear(); } }
@Override public Response processMessageDispatch(MessageDispatch md) throws Exception { waitForTransportInterruptionProcessingToComplete(); ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId()); if (dispatcher != null) { // Copy in case a embedded broker is dispatching via // vm:// // md.getMessage() == null to signal end of queue // browse. Message msg = md.getMessage(); if (msg != null) { msg = msg.copy(); msg.setReadOnlyBody(true); msg.setReadOnlyProperties(true); msg.setRedeliveryCounter(md.getRedeliveryCounter()); msg.setConnection(ActiveMQConnection.this); md.setMessage(msg); } dispatcher.dispatch(md); } return null; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
private boolean redeliveryExceeded(MessageDispatch md) { try { return session.getTransacted() && redeliveryPolicy != null && redeliveryPolicy.isPreDispatchCheck() && redeliveryPolicy.getMaximumRedeliveries() != RedeliveryPolicy.NO_MAXIMUM_REDELIVERIES && md.getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries() // redeliveryCounter > x expected after resend via brokerRedeliveryPlugin && md.getMessage().getProperty("redeliveryDelay") == null; } catch (Exception ignored) { return false; } }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
private boolean redeliveryExceeded(MessageDispatch md) { try { return session.getTransacted() && redeliveryPolicy != null && redeliveryPolicy.isPreDispatchCheck() && redeliveryPolicy.getMaximumRedeliveries() != RedeliveryPolicy.NO_MAXIMUM_REDELIVERIES && md.getRedeliveryCounter() > redeliveryPolicy.getMaximumRedeliveries() // redeliveryCounter > x expected after resend via brokerRedeliveryPlugin && md.getMessage().getProperty("redeliveryDelay") == null; } catch (Exception ignored) { return false; } }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }