mirror of https://github.com/apache/activemq.git
[AMQ-8397] Add a destination option to sendDuplicateFromStoreToDLQ (#724)
- Default 'true' to match existing behavior - Added counter to DestinationView
This commit is contained in:
parent
f2dbc92743
commit
6a25d654f2
|
@ -102,6 +102,11 @@ public class DestinationView implements DestinationViewMBean {
|
||||||
return destination.getDestinationStatistics().getDispatched().getCount();
|
return destination.getDestinationStatistics().getDispatched().getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getDuplicateFromStoreCount() {
|
||||||
|
return destination.getDestinationStatistics().getDuplicateFromStore().getCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getInFlightCount() {
|
public long getInFlightCount() {
|
||||||
return destination.getDestinationStatistics().getInflight().getCount();
|
return destination.getDestinationStatistics().getInflight().getCount();
|
||||||
|
@ -570,4 +575,8 @@ public class DestinationView implements DestinationViewMBean {
|
||||||
return destination.getDestinationStatistics().getBlockedTime().getTotalTime();
|
return destination.getDestinationStatistics().getBlockedTime().getTotalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSendDuplicateFromStoreToDLQ() {
|
||||||
|
return destination.isSendDuplicateFromStoreToDLQ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,26 @@ public interface DestinationViewMBean {
|
||||||
@MBeanInfo("Number of messages that has been acknowledged (and removed) from the destination.")
|
@MBeanInfo("Number of messages that has been acknowledged (and removed) from the destination.")
|
||||||
long getDequeueCount();
|
long getDequeueCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of duplicate messages that have been paged-in
|
||||||
|
* from the store.
|
||||||
|
*
|
||||||
|
* @return The number of duplicate messages that have been paged-in
|
||||||
|
* from the store.
|
||||||
|
*/
|
||||||
|
@MBeanInfo("Number of duplicate messages that have been paged-in from the store.")
|
||||||
|
long getDuplicateFromStoreCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the config setting to send a duplicate message from store
|
||||||
|
* to the dead letter queue.
|
||||||
|
*
|
||||||
|
* @return The config setting to send a duplicate message from store
|
||||||
|
* to the dead letter queue.
|
||||||
|
*/
|
||||||
|
@MBeanInfo("Config setting to send a duplicate from store message to the dead letter queue.")
|
||||||
|
boolean isSendDuplicateFromStoreToDLQ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of messages that have been acknowledged by network subscriptions from the
|
* Returns the number of messages that have been acknowledged by network subscriptions from the
|
||||||
* destination.
|
* destination.
|
||||||
|
|
|
@ -88,6 +88,7 @@ public abstract class BaseDestination implements Destination {
|
||||||
private boolean advisoryForDelivery;
|
private boolean advisoryForDelivery;
|
||||||
private boolean advisoryForConsumed;
|
private boolean advisoryForConsumed;
|
||||||
private boolean sendAdvisoryIfNoConsumers;
|
private boolean sendAdvisoryIfNoConsumers;
|
||||||
|
private boolean sendDuplicateFromStoreToDLQ = true;
|
||||||
private boolean includeBodyForAdvisory;
|
private boolean includeBodyForAdvisory;
|
||||||
protected final DestinationStatistics destinationStatistics = new DestinationStatistics();
|
protected final DestinationStatistics destinationStatistics = new DestinationStatistics();
|
||||||
protected final BrokerService brokerService;
|
protected final BrokerService brokerService;
|
||||||
|
@ -477,6 +478,14 @@ public abstract class BaseDestination implements Destination {
|
||||||
this.sendAdvisoryIfNoConsumers = sendAdvisoryIfNoConsumers;
|
this.sendAdvisoryIfNoConsumers = sendAdvisoryIfNoConsumers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSendDuplicateFromStoreToDLQ() {
|
||||||
|
return this.sendDuplicateFromStoreToDLQ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSendDuplicateFromStoreToDLQ(boolean sendDuplicateFromStoreToDLQ) {
|
||||||
|
this.sendDuplicateFromStoreToDLQ = sendDuplicateFromStoreToDLQ;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isIncludeBodyForAdvisory() {
|
public boolean isIncludeBodyForAdvisory() {
|
||||||
return includeBodyForAdvisory;
|
return includeBodyForAdvisory;
|
||||||
}
|
}
|
||||||
|
@ -889,11 +898,14 @@ public abstract class BaseDestination implements Destination {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void duplicateFromStore(Message message, Subscription subscription) {
|
public void duplicateFromStore(Message message, Subscription subscription) {
|
||||||
|
destinationStatistics.getDuplicateFromStore().increment();
|
||||||
ConnectionContext connectionContext = createConnectionContext();
|
ConnectionContext connectionContext = createConnectionContext();
|
||||||
getLog().warn("{}{}, redirecting {} for dlq processing", DUPLICATE_FROM_STORE_MSG_PREFIX, destination, message.getMessageId());
|
getLog().warn("{}{}, redirecting {} for dlq processing", DUPLICATE_FROM_STORE_MSG_PREFIX, destination, message.getMessageId());
|
||||||
Throwable cause = new Throwable(DUPLICATE_FROM_STORE_MSG_PREFIX + destination);
|
Throwable cause = new Throwable(DUPLICATE_FROM_STORE_MSG_PREFIX + destination);
|
||||||
message.setRegionDestination(this);
|
message.setRegionDestination(this);
|
||||||
|
if(this.isSendDuplicateFromStoreToDLQ()) {
|
||||||
broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause);
|
broker.getRoot().sendToDeadLetterQueue(connectionContext, message, null, cause);
|
||||||
|
}
|
||||||
MessageAck messageAck = new MessageAck(message, MessageAck.POISON_ACK_TYPE, 1);
|
MessageAck messageAck = new MessageAck(message, MessageAck.POISON_ACK_TYPE, 1);
|
||||||
messageAck.setPoisonCause(cause);
|
messageAck.setPoisonCause(cause);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -245,4 +245,8 @@ public interface Destination extends Service, Task, Message.MessageDestination {
|
||||||
public void clearPendingMessages(int pendingAdditionsCount);
|
public void clearPendingMessages(int pendingAdditionsCount);
|
||||||
|
|
||||||
void duplicateFromStore(Message message, Subscription subscription);
|
void duplicateFromStore(Message message, Subscription subscription);
|
||||||
|
|
||||||
|
boolean isSendDuplicateFromStoreToDLQ();
|
||||||
|
|
||||||
|
void setSendDuplicateFromStoreToDLQ(boolean sendDuplicateFromStoreToDLQ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,6 +394,16 @@ public class DestinationFilter implements Destination {
|
||||||
next.duplicateFromStore(message, subscription);
|
next.duplicateFromStore(message, subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSendDuplicateFromStoreToDLQ() {
|
||||||
|
return next.isSendDuplicateFromStoreToDLQ();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSendDuplicateFromStoreToDLQ(boolean sendDuplicateFromStoreToDLQ) {
|
||||||
|
next.setSendDuplicateFromStoreToDLQ(sendDuplicateFromStoreToDLQ);
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteSubscription(ConnectionContext context, SubscriptionKey key) throws Exception {
|
public void deleteSubscription(ConnectionContext context, SubscriptionKey key) throws Exception {
|
||||||
if (next instanceof DestinationFilter) {
|
if (next instanceof DestinationFilter) {
|
||||||
DestinationFilter filter = (DestinationFilter) next;
|
DestinationFilter filter = (DestinationFilter) next;
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
protected CountStatisticImpl messages;
|
protected CountStatisticImpl messages;
|
||||||
protected PollCountStatisticImpl messagesCached;
|
protected PollCountStatisticImpl messagesCached;
|
||||||
protected CountStatisticImpl dispatched;
|
protected CountStatisticImpl dispatched;
|
||||||
|
protected CountStatisticImpl duplicateFromStore;
|
||||||
protected CountStatisticImpl inflight;
|
protected CountStatisticImpl inflight;
|
||||||
protected CountStatisticImpl expired;
|
protected CountStatisticImpl expired;
|
||||||
protected TimeStatisticImpl processTime;
|
protected TimeStatisticImpl processTime;
|
||||||
|
@ -50,6 +51,7 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
enqueues = new CountStatisticImpl("enqueues", "The number of messages that have been sent to the destination");
|
enqueues = new CountStatisticImpl("enqueues", "The number of messages that have been sent to the destination");
|
||||||
dispatched = new CountStatisticImpl("dispatched", "The number of messages that have been dispatched from the destination");
|
dispatched = new CountStatisticImpl("dispatched", "The number of messages that have been dispatched from the destination");
|
||||||
dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been acknowledged from the destination");
|
dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been acknowledged from the destination");
|
||||||
|
duplicateFromStore = new CountStatisticImpl("duplicateFromStore", "The number of duplicate messages that have been paged-in from the store for this destination");
|
||||||
forwards = new CountStatisticImpl("forwards", "The number of messages that have been forwarded to a networked broker from the destination");
|
forwards = new CountStatisticImpl("forwards", "The number of messages that have been forwarded to a networked broker from the destination");
|
||||||
inflight = new CountStatisticImpl("inflight", "The number of messages dispatched but awaiting acknowledgement");
|
inflight = new CountStatisticImpl("inflight", "The number of messages dispatched but awaiting acknowledgement");
|
||||||
expired = new CountStatisticImpl("expired", "The number of messages that have expired");
|
expired = new CountStatisticImpl("expired", "The number of messages that have expired");
|
||||||
|
@ -68,6 +70,7 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
addStatistic("enqueues", enqueues);
|
addStatistic("enqueues", enqueues);
|
||||||
addStatistic("dispatched", dispatched);
|
addStatistic("dispatched", dispatched);
|
||||||
addStatistic("dequeues", dequeues);
|
addStatistic("dequeues", dequeues);
|
||||||
|
addStatistic("duplicateFromStore", duplicateFromStore);
|
||||||
addStatistic("inflight", inflight);
|
addStatistic("inflight", inflight);
|
||||||
addStatistic("expired", expired);
|
addStatistic("expired", expired);
|
||||||
addStatistic("consumers", consumers);
|
addStatistic("consumers", consumers);
|
||||||
|
@ -124,6 +127,10 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
return dispatched;
|
return dispatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CountStatisticImpl getDuplicateFromStore() {
|
||||||
|
return duplicateFromStore;
|
||||||
|
}
|
||||||
|
|
||||||
public TimeStatisticImpl getProcessTime() {
|
public TimeStatisticImpl getProcessTime() {
|
||||||
return this.processTime;
|
return this.processTime;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +152,7 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
dequeues.reset();
|
dequeues.reset();
|
||||||
forwards.reset();
|
forwards.reset();
|
||||||
dispatched.reset();
|
dispatched.reset();
|
||||||
|
duplicateFromStore.reset();
|
||||||
inflight.reset();
|
inflight.reset();
|
||||||
expired.reset();
|
expired.reset();
|
||||||
blockedSends.reset();
|
blockedSends.reset();
|
||||||
|
@ -158,6 +166,7 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
enqueues.setEnabled(enabled);
|
enqueues.setEnabled(enabled);
|
||||||
dispatched.setEnabled(enabled);
|
dispatched.setEnabled(enabled);
|
||||||
dequeues.setEnabled(enabled);
|
dequeues.setEnabled(enabled);
|
||||||
|
duplicateFromStore.setEnabled(enabled);
|
||||||
forwards.setEnabled(enabled);
|
forwards.setEnabled(enabled);
|
||||||
inflight.setEnabled(enabled);
|
inflight.setEnabled(enabled);
|
||||||
expired.setEnabled(true);
|
expired.setEnabled(true);
|
||||||
|
@ -177,6 +186,7 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
enqueues.setParent(parent.enqueues);
|
enqueues.setParent(parent.enqueues);
|
||||||
dispatched.setParent(parent.dispatched);
|
dispatched.setParent(parent.dispatched);
|
||||||
dequeues.setParent(parent.dequeues);
|
dequeues.setParent(parent.dequeues);
|
||||||
|
duplicateFromStore.setParent(parent.duplicateFromStore);
|
||||||
forwards.setParent(parent.forwards);
|
forwards.setParent(parent.forwards);
|
||||||
inflight.setParent(parent.inflight);
|
inflight.setParent(parent.inflight);
|
||||||
expired.setParent(parent.expired);
|
expired.setParent(parent.expired);
|
||||||
|
@ -192,6 +202,7 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
enqueues.setParent(null);
|
enqueues.setParent(null);
|
||||||
dispatched.setParent(null);
|
dispatched.setParent(null);
|
||||||
dequeues.setParent(null);
|
dequeues.setParent(null);
|
||||||
|
duplicateFromStore.setParent(null);
|
||||||
forwards.setParent(null);
|
forwards.setParent(null);
|
||||||
inflight.setParent(null);
|
inflight.setParent(null);
|
||||||
expired.setParent(null);
|
expired.setParent(null);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class PolicyEntry extends DestinationMapEntry {
|
||||||
private DispatchPolicy dispatchPolicy;
|
private DispatchPolicy dispatchPolicy;
|
||||||
private SubscriptionRecoveryPolicy subscriptionRecoveryPolicy;
|
private SubscriptionRecoveryPolicy subscriptionRecoveryPolicy;
|
||||||
private boolean sendAdvisoryIfNoConsumers;
|
private boolean sendAdvisoryIfNoConsumers;
|
||||||
|
private boolean sendDuplicateFromStoreToDLQ = true;
|
||||||
private DeadLetterStrategy deadLetterStrategy = Destination.DEFAULT_DEAD_LETTER_STRATEGY;
|
private DeadLetterStrategy deadLetterStrategy = Destination.DEFAULT_DEAD_LETTER_STRATEGY;
|
||||||
private PendingMessageLimitStrategy pendingMessageLimitStrategy;
|
private PendingMessageLimitStrategy pendingMessageLimitStrategy;
|
||||||
private MessageEvictionStrategy messageEvictionStrategy;
|
private MessageEvictionStrategy messageEvictionStrategy;
|
||||||
|
@ -241,7 +242,6 @@ public class PolicyEntry extends DestinationMapEntry {
|
||||||
if (isUpdate("maxBrowsePageSize", includedProperties)) {
|
if (isUpdate("maxBrowsePageSize", includedProperties)) {
|
||||||
destination.setMaxBrowsePageSize(getMaxBrowsePageSize());
|
destination.setMaxBrowsePageSize(getMaxBrowsePageSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUpdate("minimumMessageSize", includedProperties)) {
|
if (isUpdate("minimumMessageSize", includedProperties)) {
|
||||||
destination.setMinimumMessageSize((int) getMinimumMessageSize());
|
destination.setMinimumMessageSize((int) getMinimumMessageSize());
|
||||||
}
|
}
|
||||||
|
@ -296,6 +296,9 @@ public class PolicyEntry extends DestinationMapEntry {
|
||||||
if (isUpdate("sendAdvisoryIfNoConsumers", includedProperties)) {
|
if (isUpdate("sendAdvisoryIfNoConsumers", includedProperties)) {
|
||||||
destination.setSendAdvisoryIfNoConsumers(isSendAdvisoryIfNoConsumers());
|
destination.setSendAdvisoryIfNoConsumers(isSendAdvisoryIfNoConsumers());
|
||||||
}
|
}
|
||||||
|
if (isUpdate("sendDuplicateFromStoreToDLQ", includedProperties)) {
|
||||||
|
destination.setSendDuplicateFromStoreToDLQ(isSendDuplicateFromStoreToDLQ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void baseConfiguration(Broker broker, BaseDestination destination) {
|
public void baseConfiguration(Broker broker, BaseDestination destination) {
|
||||||
|
@ -456,6 +459,18 @@ public class PolicyEntry extends DestinationMapEntry {
|
||||||
this.sendAdvisoryIfNoConsumers = sendAdvisoryIfNoConsumers;
|
this.sendAdvisoryIfNoConsumers = sendAdvisoryIfNoConsumers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSendDuplicateFromStoreToDLQ() {
|
||||||
|
return sendDuplicateFromStoreToDLQ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a copy of message to DLQ if a duplicate messages are paged-in from
|
||||||
|
* the messages store
|
||||||
|
*/
|
||||||
|
public void setSendDuplicateFromStoreToDLQ(boolean sendDuplicateFromStoreToDLQ) {
|
||||||
|
this.sendDuplicateFromStoreToDLQ = sendDuplicateFromStoreToDLQ;
|
||||||
|
}
|
||||||
|
|
||||||
public DeadLetterStrategy getDeadLetterStrategy() {
|
public DeadLetterStrategy getDeadLetterStrategy() {
|
||||||
return deadLetterStrategy;
|
return deadLetterStrategy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue