Class ClientLargeMessageImpl
- java.lang.Object
-
- org.apache.activemq.artemis.api.core.RefCountMessage
-
- org.apache.activemq.artemis.core.message.impl.CoreMessage
-
- org.apache.activemq.artemis.core.client.impl.ClientMessageImpl
-
- org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl
-
- All Implemented Interfaces:
ClientMessage,ICoreMessage,Message,ClientLargeMessageInternal,ClientMessageInternal
public final class ClientLargeMessageImpl extends ClientMessageImpl implements ClientLargeMessageInternal
ClientLargeMessageImpl is only created when receiving large messages.At the time of sending a regular Message is sent as we won't know the message is considered large until the buffer is filled up or the user set a streaming.
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.artemis.core.client.impl.ClientMessageImpl
REPLYTO_HEADER_NAME
-
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 ClientLargeMessageImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckCompletion()This can be optionally used to verify if the entire message has been received.voiddiscardBody()Discard unused packets (used on large-message)ActiveMQBuffergetBodyBuffer()The buffer to write the body.intgetBodySize()Returns the size (in bytes) of this message's bodyintgetEncodeSize()Returns the size of the encoded message.LargeMessageControllergetLargeMessageController()longgetLargeMessageSize()booleanisLargeMessage()voidretrieveExistingData(ClientMessageInternal clMessage)voidsaveToOutputStream(OutputStream out)Saves the content of the message to the OutputStream.voidsetLargeMessageController(LargeMessageController controller)voidsetLargeMessageSize(long largeMessageSize)ClientLargeMessageImplsetOutputStream(OutputStream out)Sets the OutputStream that will receive the content of a message received in a non blocking way.booleanwaitOutputStreamCompletion(long timeMilliseconds)Wait the outputStream completion of the message.-
Methods inherited from class org.apache.activemq.artemis.core.client.impl.ClientMessageImpl
acknowledge, copy, getBodyInputStream, getDeliveryCount, getFlowControlSize, getLargeBodyReader, individualAcknowledge, isCompressed, onReceipt, putBooleanProperty, putBooleanProperty, putByteProperty, putByteProperty, putBytesProperty, putBytesProperty, putCharProperty, putCharProperty, putDoubleProperty, putDoubleProperty, putFloatProperty, putFloatProperty, putIntProperty, putIntProperty, putLongProperty, putLongProperty, putObjectProperty, putObjectProperty, putShortProperty, putShortProperty, putStringProperty, putStringProperty, putStringProperty, setBodyInputStream, setDeliveryCount, setDurable, setExpiration, setFlowControlSize, setPriority, setUserID, toString, writeBodyBufferBytes, writeBodyBufferString
-
Methods inherited from class org.apache.activemq.artemis.core.message.impl.CoreMessage
checkEncode, clearInternalProperties, containsProperty, containsProperty, copy, decodeHeadersAndProperties, encode, encodeHeadersAndProperties, getAddress, getAddressSimpleString, getAnnotation, getBodyBufferSize, getBooleanProperty, getBooleanProperty, getBuffer, getByteProperty, getByteProperty, getBytesProperty, getBytesProperty, getCorrelationID, getDataBuffer, getDoubleProperty, getDoubleProperty, getDuplicateProperty, getEndOfBodyPosition, getExpiration, getFloatProperty, getFloatProperty, getGroupID, getGroupSequence, getHeadersAndPropertiesEncodeSize, getIntProperty, getIntProperty, getLastValueProperty, getLongProperty, getLongProperty, getMemoryEstimate, getMessageID, getObjectProperty, getObjectProperty, getOwner, getPersistentSize, getPersister, getPersistSize, getPriority, getProperties, getPropertyNames, getProtocolName, getReadOnlyBodyBuffer, getReplyTo, getRoutingType, getScheduledDeliveryTime, getShortProperty, getShortProperty, getSimpleStringProperty, getSimpleStringProperty, getStringBody, getStringProperty, getStringProperty, getTimestamp, getType, getUserID, getValidatedUserID, hasScheduledDeliveryTime, initBuffer, internalSetMessageID, isDurable, isServerMessage, messageChanged, moveHeadersAndProperties, persist, receiveBuffer, receiveBuffer_1X, reloadPersistence, removeAnnotation, removeProperty, removeProperty, searchProperty, sendBuffer, sendBuffer_1X, setAddress, setAddress, setBuffer, setCorrelationID, setGroupID, setGroupID, setGroupSequence, setLastValueProperty, setMessageID, setOwner, setReplyTo, setRoutingType, setScheduledDeliveryTime, setTimestamp, setType, 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, releaseComplete, 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.client.ClientMessage
acknowledge, getBodyInputStream, getDeliveryCount, individualAcknowledge, putBooleanProperty, putBooleanProperty, putByteProperty, putByteProperty, putBytesProperty, putBytesProperty, putCharProperty, putCharProperty, putDoubleProperty, putDoubleProperty, putFloatProperty, putFloatProperty, putIntProperty, putIntProperty, putLongProperty, putLongProperty, putShortProperty, putShortProperty, putStringProperty, setBodyInputStream, setDeliveryCount, writeBodyBufferBytes, writeBodyBufferString
-
Methods inherited from interface org.apache.activemq.artemis.core.client.impl.ClientMessageInternal
getFlowControlSize, getProperties, isCompressed, onReceipt, setFlowControlSize
-
Methods inherited from interface org.apache.activemq.artemis.api.core.ICoreMessage
getBodyBufferSize, getBuffer, getDataBuffer, getEndOfBodyPosition, getHeadersAndPropertiesEncodeSize, getLargeBodyReader, getReadOnlyBodyBuffer, getType, isServerMessage, moveHeadersAndProperties, receiveBuffer_1X, sendBuffer_1X, setBuffer, setType, toMap
-
Methods inherited from interface org.apache.activemq.artemis.api.core.Message
acceptsConsumer, clearInternalProperties, containsProperty, containsProperty, copy, copy, copy, durableDown, durableUp, getAddress, getAddressSimpleString, getAnnotation, getAnnotationString, getBooleanProperty, getBooleanProperty, getBrokerProperty, getByteProperty, getByteProperty, getBytesProperty, getBytesProperty, getConnectionID, getCorrelationID, getDoubleProperty, getDoubleProperty, getDuplicateIDBytes, getDuplicateProperty, getDurableCount, getExpiration, getExtraBytesProperty, getFloatProperty, getFloatProperty, getGroupID, getGroupSequence, getIngressTimestamp, getIntProperty, getIntProperty, getLastValueProperty, getLongProperty, getLongProperty, getMemoryEstimate, getMessageID, getObjectProperty, getObjectProperty, getObjectPropertyForFilter, getOwner, getPersistentSize, getPersister, getPersistSize, getPriority, getPropertyNames, getProtocolName, getRefCount, getReplyTo, getRoutingType, getScheduledDeliveryTime, getShortProperty, getShortProperty, getSimpleStringProperty, getSimpleStringProperty, getStringBody, getStringProperty, getStringProperty, getTimestamp, getUsage, getUserContext, getUserID, getValidatedUserID, getWholeMessageSize, hasScheduledDeliveryTime, isDurable, isExpired, messageChanged, persist, putExtraBytesProperty, putObjectProperty, putObjectProperty, putStringProperty, putStringProperty, receiveBuffer, reencode, refDown, referenceOriginalMessage, refUp, rejectConsumer, reloadPersistence, removeAnnotation, removeExtraBytesProperty, removeProperty, removeProperty, sendBuffer, setAddress, setAddress, setAnnotation, setBrokerProperty, setConnectionID, setCorrelationID, setDurable, setExpiration, setGroupID, setGroupID, setGroupSequence, setIngressTimestamp, setLastValueProperty, setMessageID, setOwner, setPriority, setReplyTo, setRoutingType, setScheduledDeliveryTime, setTimestamp, setUserContext, setUserID, setValidatedUserID, toCompositeData, toCore, toCore, toMap, toPropertyMap, toPropertyMap, usageDown, usageUp
-
-
-
-
Method Detail
-
setLargeMessageSize
public void setLargeMessageSize(long largeMessageSize)
- Specified by:
setLargeMessageSizein interfaceClientLargeMessageInternal- Parameters:
largeMessageSize- the largeMessageSize to set
-
getLargeMessageSize
public long getLargeMessageSize()
-
getEncodeSize
public int getEncodeSize()
Description copied from interface:MessageReturns the size of the encoded message.- Specified by:
getEncodeSizein interfaceMessage- Overrides:
getEncodeSizein classCoreMessage
-
isLargeMessage
public boolean isLargeMessage()
- Specified by:
isLargeMessagein interfaceMessage- Overrides:
isLargeMessagein classClientMessageImpl- Returns:
- the largeMessage
-
setLargeMessageController
public void setLargeMessageController(LargeMessageController controller)
- Specified by:
setLargeMessageControllerin interfaceClientLargeMessageInternal
-
checkCompletion
public void checkCompletion() throws ActiveMQExceptionDescription copied from interface:ClientMessageThis can be optionally used to verify if the entire message has been received. It won't have any effect on regular messages but it may be helpful on large messages. The use case for this is to make sure there won't be an exception while getting the buffer. Using getBodyBuffer directly would have the same effect but you could get a Runtime non checked Exception instead- Specified by:
checkCompletionin interfaceClientMessage- Overrides:
checkCompletionin classClientMessageImpl- Throws:
ActiveMQException
-
getBodyBuffer
public ActiveMQBuffer getBodyBuffer()
Description copied from class:CoreMessageThe buffer to write the body. Warning: If you just want to read the content of a message, use getDataBuffer() or getReadOnlyBuffer();- Specified by:
getBodyBufferin interfaceClientMessage- Specified by:
getBodyBufferin interfaceICoreMessage- Specified by:
getBodyBufferin interfaceMessage- Overrides:
getBodyBufferin classCoreMessage
-
getBodySize
public int getBodySize()
Description copied from interface:ClientMessageReturns the size (in bytes) of this message's body- Specified by:
getBodySizein interfaceClientMessage- Overrides:
getBodySizein classClientMessageImpl
-
getLargeMessageController
public LargeMessageController getLargeMessageController()
- Specified by:
getLargeMessageControllerin interfaceClientLargeMessageInternal
-
saveToOutputStream
public void saveToOutputStream(OutputStream out) throws ActiveMQException
Description copied from interface:ClientMessageSaves the content of the message to the OutputStream. It will block until the entire content is transferred to the OutputStream.- Specified by:
saveToOutputStreamin interfaceClientMessage- Overrides:
saveToOutputStreamin classClientMessageImpl- Throws:
ActiveMQException
-
setOutputStream
public ClientLargeMessageImpl setOutputStream(OutputStream out) throws ActiveMQException
Description copied from interface:ClientMessageSets the OutputStream that will receive the content of a message received in a non blocking way.
This method is used when consuming large messages- Specified by:
setOutputStreamin interfaceClientMessage- Overrides:
setOutputStreamin classClientMessageImpl- Returns:
- this ClientMessage
- Throws:
ActiveMQException
-
waitOutputStreamCompletion
public boolean waitOutputStreamCompletion(long timeMilliseconds) throws ActiveMQExceptionDescription copied from interface:ClientMessageWait the outputStream completion of the message. This method is used when consuming large messages- Specified by:
waitOutputStreamCompletionin interfaceClientMessage- Overrides:
waitOutputStreamCompletionin classClientMessageImpl- Parameters:
timeMilliseconds- - 0 means wait forever- Returns:
- true if it reached the end
- Throws:
ActiveMQException
-
discardBody
public void discardBody()
Description copied from interface:ClientMessageInternalDiscard unused packets (used on large-message)- Specified by:
discardBodyin interfaceClientMessageInternal- Overrides:
discardBodyin classClientMessageImpl
-
retrieveExistingData
public void retrieveExistingData(ClientMessageInternal clMessage)
-
-