Class LargeServerMessageImpl
- java.lang.Object
-
- org.apache.activemq.artemis.api.core.RefCountMessage
-
- org.apache.activemq.artemis.core.message.impl.CoreMessage
-
- org.apache.activemq.artemis.core.persistence.impl.journal.LargeServerMessageImpl
-
- All Implemented Interfaces:
ICoreMessage,Message,ReplicatedLargeMessage,CoreLargeServerMessage,LargeServerMessage
public final class LargeServerMessageImpl extends CoreMessage implements CoreLargeServerMessage
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.artemis.core.message.impl.CoreMessage
address, BODY_OFFSET, buffer, BUFFER_HEADER_SPACE, durable, endOfBodyPosition, memoryEstimate, messageID, messageIDPosition, priority, properties, timestamp, type, writableBuffer
-
Fields inherited from interface org.apache.activemq.artemis.api.core.Message
BYTES_TYPE, DEFAULT_TYPE, EMBEDDED_TYPE, HDR_ACTUAL_EXPIRY_TIME, HDR_BRIDGE_DUPLICATE_ID, HDR_CONTENT_TYPE, HDR_DUPLICATE_DETECTION_ID, HDR_GROUP_ID, HDR_GROUP_SEQUENCE, HDR_INGRESS_TIMESTAMP, HDR_LARGE_BODY_SIZE, HDR_LARGE_COMPRESSED, HDR_LAST_VALUE_NAME, HDR_ORIG_MESSAGE_ID, HDR_ORIG_ROUTING_TYPE, HDR_ORIGINAL_ADDRESS, HDR_ORIGINAL_QUEUE, HDR_PREFIX, HDR_ROUTE_TO_ACK_IDS, HDR_ROUTE_TO_IDS, HDR_ROUTING_TYPE, HDR_SCALEDOWN_TO_IDS, HDR_SCHEDULED_DELIVERY_TIME, HDR_VALIDATED_USER, INTERNAL_PROPERTY_NAMES_PREDICATE, LARGE_EMBEDDED_TYPE, MAP_TYPE, memoryOffset, OBJECT_TYPE, STREAM_TYPE, TEXT_TYPE
-
-
Constructor Summary
Constructors Constructor Description LargeServerMessageImpl(byte type, long id, StorageManager storageManager, SequentialFile fileCopy)LargeServerMessageImpl(LargeServerMessageImpl copy, TypedProperties properties, SequentialFile fileCopy, long newID)Copy constructorLargeServerMessageImpl(StorageManager storageManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBytes(byte[] bytes)voidaddBytes(ActiveMQBuffer bytes, boolean initialHeader)static MessagecheckLargeMessage(Message message, StorageManager storageManager)This will check if a regular message needs to be converted as large messagevoidclearPendingRecordID()Messagecopy()It will generate a new instance of the message encode, being a deep copy, new properties, new everythingMessagecopy(long newID)It will generate a new instance of the message encode, being a deep copy, new properties, new everythingvoiddecode(ActiveMQBuffer buffer1)voiddeleteFile()voidencode(ActiveMQBuffer buffer1)voidensureFileExists(boolean toOpen)SequentialFilegetAppendFile()This will return the File suitable for appending the messageintgetBodyBufferSize()Returns the length in bytes of the body buffer.longgetBodySize()intgetEncodeSize()Returns the size of the encoded message.LargeBodygetLargeBody()LargeBodyReadergetLargeBodyReader()intgetMemoryEstimate()longgetPendingRecordID()longgetPersistentSize()This is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking If a normal message it will be the encoded message size If a large message it will be encoded message size + large message body sizeActiveMQBuffergetReadOnlyBodyBuffer()Returns a new Buffer slicing the current Body.StorageManagergetStorageManager()longgetWholeMessageSize()Return an estimate of the size of the message on the wire.booleanhasPendingRecord()booleanisLargeMessage()booleanisServerMessage()We are really interested if this is a LargeServerMessage.voidreferenceOriginalMessage(Message original, SimpleString originalQueue)protected voidreleaseComplete()voidreleaseResources(boolean sync, boolean sendEvent)Close the files if openedvoidsetPaged()We have to copy the large message content in case of DLQ and paged messages For that we need to pre-mark the LargeMessage with a flag when it is pagedvoidsetPendingRecordID(long pendingRecordID)voidsetStorageManager(StorageManager storageManager)MessagetoMessage()StringtoString()voidvalidateFile()-
Methods inherited from class org.apache.activemq.artemis.core.message.impl.CoreMessage
checkEncode, clearInternalProperties, containsProperty, containsProperty, decodeHeadersAndProperties, encode, encodeHeadersAndProperties, getAddress, getAddressSimpleString, getAnnotation, getBodyBuffer, getBodyInputStream, getBooleanProperty, getBooleanProperty, getBuffer, getByteProperty, getByteProperty, getBytesProperty, getBytesProperty, getCorrelationID, getDataBuffer, getDoubleProperty, getDoubleProperty, getDuplicateProperty, getEndOfBodyPosition, getExpiration, getFloatProperty, getFloatProperty, getGroupID, getGroupSequence, getHeadersAndPropertiesEncodeSize, getIntProperty, getIntProperty, getLastValueProperty, getLongProperty, getLongProperty, getMessageID, getObjectProperty, getObjectProperty, getOwner, getPersister, getPersistSize, getPriority, getProperties, getPropertyNames, getProtocolName, getReplyTo, getRoutingType, getScheduledDeliveryTime, getShortProperty, getShortProperty, getSimpleStringProperty, getSimpleStringProperty, getStringBody, getStringProperty, getStringProperty, getTimestamp, getType, getUserID, getValidatedUserID, hasScheduledDeliveryTime, initBuffer, internalSetMessageID, isDurable, messageChanged, moveHeadersAndProperties, persist, putBooleanProperty, putBooleanProperty, putByteProperty, putByteProperty, putBytesProperty, putBytesProperty, putCharProperty, putCharProperty, putDoubleProperty, putDoubleProperty, putFloatProperty, putFloatProperty, putIntProperty, putIntProperty, putLongProperty, putLongProperty, putObjectProperty, putObjectProperty, putShortProperty, putShortProperty, putStringProperty, putStringProperty, putStringProperty, receiveBuffer, receiveBuffer_1X, reloadPersistence, removeAnnotation, removeProperty, removeProperty, searchProperty, sendBuffer, sendBuffer_1X, setAddress, setAddress, setBuffer, setCorrelationID, setDurable, setExpiration, setGroupID, setGroupID, setGroupSequence, setLastValueProperty, setMessageID, setOwner, setPriority, setReplyTo, setRoutingType, setScheduledDeliveryTime, setTimestamp, setType, setUserID, setUserID, setValidatedUserID, toCompositeData, toCore, toCore
-
Methods inherited from class org.apache.activemq.artemis.api.core.RefCountMessage
debugRefs, debugString, durableDown, durableUp, getDurableCount, getParentRef, getRefCount, getUsage, getUserContext, refDown, refUp, setParentRef, setUserContext, usageDown, usageUp
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.api.core.ICoreMessage
toMap
-
Methods inherited from interface org.apache.activemq.artemis.core.server.LargeServerMessage
addBytes, getMessageID
-
Methods inherited from interface org.apache.activemq.artemis.api.core.Message
acceptsConsumer, copy, durableDown, durableUp, getAnnotationString, getBrokerProperty, getConnectionID, getDuplicateIDBytes, getDurableCount, getExtraBytesProperty, getIngressTimestamp, getObjectPropertyForFilter, getRefCount, getUsage, getUserContext, isExpired, putExtraBytesProperty, reencode, refDown, refUp, rejectConsumer, removeExtraBytesProperty, setAnnotation, setBrokerProperty, setConnectionID, setIngressTimestamp, setUserContext, toMap, toPropertyMap, toPropertyMap, usageDown, usageUp
-
Methods inherited from interface org.apache.activemq.artemis.core.replication.ReplicatedLargeMessage
setDurable, setMessageID
-
-
-
-
Constructor Detail
-
LargeServerMessageImpl
public LargeServerMessageImpl(StorageManager storageManager)
-
LargeServerMessageImpl
public LargeServerMessageImpl(LargeServerMessageImpl copy, TypedProperties properties, SequentialFile fileCopy, long newID)
Copy constructor- Parameters:
properties-copy-fileCopy-
-
LargeServerMessageImpl
public LargeServerMessageImpl(byte type, long id, StorageManager storageManager, SequentialFile fileCopy)
-
-
Method Detail
-
toMessage
public Message toMessage()
- Specified by:
toMessagein interfaceLargeServerMessage
-
checkLargeMessage
public static Message checkLargeMessage(Message message, StorageManager storageManager) throws Exception
This will check if a regular message needs to be converted as large message- Throws:
Exception
-
getBodySize
public long getBodySize() throws ActiveMQException- Throws:
ActiveMQException
-
getStorageManager
public StorageManager getStorageManager()
- Specified by:
getStorageManagerin interfaceLargeServerMessage
-
isServerMessage
public boolean isServerMessage()
Description copied from interface:ICoreMessageWe are really interested if this is a LargeServerMessage.- Specified by:
isServerMessagein interfaceICoreMessage- Overrides:
isServerMessagein classCoreMessage- Returns:
-
getPendingRecordID
public long getPendingRecordID()
- Specified by:
getPendingRecordIDin interfaceReplicatedLargeMessage
-
clearPendingRecordID
public void clearPendingRecordID()
- Specified by:
clearPendingRecordIDin interfaceReplicatedLargeMessage
-
hasPendingRecord
public boolean hasPendingRecord()
- Specified by:
hasPendingRecordin interfaceReplicatedLargeMessage
-
setPendingRecordID
public void setPendingRecordID(long pendingRecordID)
- Specified by:
setPendingRecordIDin interfaceReplicatedLargeMessage- Parameters:
pendingRecordID-
-
setPaged
public void setPaged()
Description copied from interface:LargeServerMessageWe have to copy the large message content in case of DLQ and paged messages For that we need to pre-mark the LargeMessage with a flag when it is paged- Specified by:
setPagedin interfaceLargeServerMessage
-
addBytes
public void addBytes(byte[] bytes) throws Exception- Specified by:
addBytesin interfaceLargeServerMessage- Specified by:
addBytesin interfaceReplicatedLargeMessage- Throws:
Exception- See Also:
LargeServerMessage.addBytes(byte[])
-
addBytes
public void addBytes(ActiveMQBuffer bytes, boolean initialHeader) throws Exception
- Specified by:
addBytesin interfaceLargeServerMessage- Throws:
Exception
-
getEncodeSize
public int getEncodeSize()
Description copied from interface:MessageReturns the size of the encoded message.- Specified by:
getEncodeSizein interfaceMessage- Overrides:
getEncodeSizein classCoreMessage
-
getWholeMessageSize
public long getWholeMessageSize()
Description copied from interface:MessageReturn an estimate of the size of the message on the wire. for LargeMessages this will contain whatever is needed to encode properties and the body size of large messages. For AMQP this will return the whole body size of the message as the body will contain all the data including properties.- Specified by:
getWholeMessageSizein interfaceMessage- Returns:
-
encode
public void encode(ActiveMQBuffer buffer1)
-
decode
public void decode(ActiveMQBuffer buffer1)
-
getLargeBodyReader
public LargeBodyReader getLargeBodyReader()
- Specified by:
getLargeBodyReaderin interfaceICoreMessage- Specified by:
getLargeBodyReaderin interfaceLargeServerMessage- Overrides:
getLargeBodyReaderin classCoreMessage
-
releaseComplete
protected void releaseComplete()
- Overrides:
releaseCompletein classRefCountMessage
-
getReadOnlyBodyBuffer
public ActiveMQBuffer getReadOnlyBodyBuffer()
Description copied from interface:ICoreMessageReturns a new Buffer slicing the current Body.- Specified by:
getReadOnlyBodyBufferin interfaceICoreMessage- Overrides:
getReadOnlyBodyBufferin classCoreMessage
-
getBodyBufferSize
public int getBodyBufferSize()
Description copied from interface:ICoreMessageReturns the length in bytes of the body buffer.- Specified by:
getBodyBufferSizein interfaceICoreMessage- Overrides:
getBodyBufferSizein classCoreMessage
-
isLargeMessage
public boolean isLargeMessage()
- Specified by:
isLargeMessagein interfaceMessage- Overrides:
isLargeMessagein classCoreMessage
-
deleteFile
public void deleteFile() throws Exception- Specified by:
deleteFilein interfaceLargeServerMessage- Specified by:
deleteFilein interfaceReplicatedLargeMessage- Throws:
Exception- See Also:
LargeServerMessage.deleteFile()
-
getMemoryEstimate
public int getMemoryEstimate()
- Specified by:
getMemoryEstimatein interfaceMessage- Overrides:
getMemoryEstimatein classCoreMessage
-
releaseResources
public void releaseResources(boolean sync, boolean sendEvent)Description copied from interface:LargeServerMessageClose the files if opened- Specified by:
releaseResourcesin interfaceLargeServerMessage- Specified by:
releaseResourcesin interfaceReplicatedLargeMessage- See Also:
LargeServerMessage.releaseResources(boolean,boolean)
-
referenceOriginalMessage
public void referenceOriginalMessage(Message original, SimpleString originalQueue)
- Specified by:
referenceOriginalMessagein interfaceMessage
-
setStorageManager
public void setStorageManager(StorageManager storageManager)
- Specified by:
setStorageManagerin interfaceLargeServerMessage
-
copy
public Message copy()
Description copied from interface:MessageIt will generate a new instance of the message encode, being a deep copy, new properties, new everything- Specified by:
copyin interfaceMessage- Overrides:
copyin classCoreMessage
-
getLargeBody
public LargeBody getLargeBody()
- Specified by:
getLargeBodyin interfaceLargeServerMessage
-
copy
public Message copy(long newID)
Description copied from interface:MessageIt will generate a new instance of the message encode, being a deep copy, new properties, new everything- Specified by:
copyin interfaceMessage- Overrides:
copyin classCoreMessage
-
getAppendFile
public SequentialFile getAppendFile() throws ActiveMQException
Description copied from interface:LargeServerMessageThis will return the File suitable for appending the message- Specified by:
getAppendFilein interfaceLargeServerMessage- Returns:
- Throws:
ActiveMQException
-
getPersistentSize
public long getPersistentSize() throws ActiveMQExceptionDescription copied from interface:MessageThis is the size of the message when persisted on disk which is used for metrics tracking Note that even if the message itself is not persisted on disk (ie non-durable) this value is still used for metrics tracking If a normal message it will be the encoded message size If a large message it will be encoded message size + large message body size- Specified by:
getPersistentSizein interfaceMessage- Overrides:
getPersistentSizein classCoreMessage- Returns:
- Throws:
ActiveMQException
-
toString
public String toString()
- Overrides:
toStringin classCoreMessage
-
validateFile
public void validateFile() throws ActiveMQException- Specified by:
validateFilein interfaceLargeServerMessage- Throws:
ActiveMQException
-
ensureFileExists
public void ensureFileExists(boolean toOpen) throws ActiveMQException- Throws:
ActiveMQException
-
-