Package org.apache.activemq
Class ActiveMQMessageAuditNoSync
- java.lang.Object
-
- org.apache.activemq.ActiveMQMessageAuditNoSync
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ActiveMQMessageAudit
public class ActiveMQMessageAuditNoSync extends Object implements Serializable
Provides basic audit functions for Messages without sync- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_WINDOW_SIZEstatic intMAXIMUM_PRODUCER_COUNT
-
Constructor Summary
Constructors Constructor Description ActiveMQMessageAuditNoSync()Default Constructor windowSize = 2048, maximumNumberOfProducersToTrack = 64ActiveMQMessageAuditNoSync(int auditDepth, int maximumNumberOfProducersToTrack)Construct a MessageAudit
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()intgetAuditDepth()longgetLastSeqId(ProducerId id)intgetMaximumNumberOfProducersToTrack()booleanisDuplicate(String id)checks whether this messageId has been seen before and adds this messageId to the listbooleanisDuplicate(Message message)Checks if this message has been seen beforebooleanisDuplicate(MessageReference message)Checks if this message has been seen beforebooleanisDuplicate(MessageId id)Checks if this messageId has been seen beforebooleanisInOrder(String id)Check the message id is in orderbooleanisInOrder(Message msg)Check the message is in orderbooleanisInOrder(MessageReference message)Check the MessageId is in orderbooleanisInOrder(MessageId id)Check the MessageId is in orderbooleanisModified()Returns if the Audit has been modified since last check, this method does not reset the modified flag.booleanmodified()Reads and returns the current modified state of the Audit, once called the state is reset to false.voidrollback(String id)voidrollback(MessageReference message)mark this message as being receivedvoidrollback(MessageId id)mark this message as being receivedvoidsetAuditDepth(int auditDepth)voidsetMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack)voidsetModified(boolean modified)
-
-
-
Field Detail
-
DEFAULT_WINDOW_SIZE
public static final int DEFAULT_WINDOW_SIZE
- See Also:
- Constant Field Values
-
MAXIMUM_PRODUCER_COUNT
public static final int MAXIMUM_PRODUCER_COUNT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ActiveMQMessageAuditNoSync
public ActiveMQMessageAuditNoSync()
Default Constructor windowSize = 2048, maximumNumberOfProducersToTrack = 64
-
ActiveMQMessageAuditNoSync
public ActiveMQMessageAuditNoSync(int auditDepth, int maximumNumberOfProducersToTrack)Construct a MessageAudit- Parameters:
auditDepth- range of ids to trackmaximumNumberOfProducersToTrack- number of producers expected in the system
-
-
Method Detail
-
getAuditDepth
public int getAuditDepth()
- Returns:
- the auditDepth
-
setAuditDepth
public void setAuditDepth(int auditDepth)
- Parameters:
auditDepth- the auditDepth to set
-
getMaximumNumberOfProducersToTrack
public int getMaximumNumberOfProducersToTrack()
- Returns:
- the maximumNumberOfProducersToTrack
-
setMaximumNumberOfProducersToTrack
public void setMaximumNumberOfProducersToTrack(int maximumNumberOfProducersToTrack)
- Parameters:
maximumNumberOfProducersToTrack- the maximumNumberOfProducersToTrack to set
-
isDuplicate
public boolean isDuplicate(Message message) throws JMSException
Checks if this message has been seen before- Parameters:
message-- Returns:
- true if the message is a duplicate
- Throws:
JMSException
-
isDuplicate
public boolean isDuplicate(String id)
checks whether this messageId has been seen before and adds this messageId to the list- Parameters:
id-- Returns:
- true if the message is a duplicate
-
isDuplicate
public boolean isDuplicate(MessageReference message)
Checks if this message has been seen before- Parameters:
message-- Returns:
- true if the message is a duplicate
-
isDuplicate
public boolean isDuplicate(MessageId id)
Checks if this messageId has been seen before- Parameters:
id-- Returns:
- true if the message is a duplicate
-
rollback
public void rollback(MessageReference message)
mark this message as being received- Parameters:
message-
-
rollback
public void rollback(MessageId id)
mark this message as being received- Parameters:
id-
-
rollback
public void rollback(String id)
-
isInOrder
public boolean isInOrder(Message msg) throws JMSException
Check the message is in order- Parameters:
msg-- Returns:
- true if the id is in order
- Throws:
JMSException
-
isInOrder
public boolean isInOrder(String id)
Check the message id is in order- Parameters:
id-- Returns:
- true if the id is in order
-
isInOrder
public boolean isInOrder(MessageReference message)
Check the MessageId is in order- Parameters:
message-- Returns:
- true if the id is in order
-
isInOrder
public boolean isInOrder(MessageId id)
Check the MessageId is in order- Parameters:
id-- Returns:
- true if the id is in order
-
getLastSeqId
public long getLastSeqId(ProducerId id)
-
clear
public void clear()
-
isModified
public boolean isModified()
Returns if the Audit has been modified since last check, this method does not reset the modified flag. If the caller needs to reset the flag in order to avoid serializing an unchanged Audit then its up the them to reset it themselves.- Returns:
- true if the Audit has been modified.
-
setModified
public void setModified(boolean modified)
-
modified
public boolean modified()
Reads and returns the current modified state of the Audit, once called the state is reset to false. This method is useful for code the needs to know if it should write out the Audit or otherwise execute some logic based on the Audit having changed since last check.- Returns:
- true if the Audit has been modified since last check.
-
-