Class AmqpJmsBytesMessageFacade
java.lang.Object
org.apache.qpid.jms.provider.amqp.message.AmqpJmsMessageFacade
org.apache.qpid.jms.provider.amqp.message.AmqpJmsBytesMessageFacade
- All Implemented Interfaces:
JmsBytesMessageFacade,JmsMessageFacade,TraceableMessage
public class AmqpJmsBytesMessageFacade
extends AmqpJmsMessageFacade
implements JmsBytesMessageFacade
A JmsBytesMessageFacade that wraps around Proton AMQP Message instances to provide
access to the underlying bytes contained in the message.
-
Field Summary
Fields inherited from class org.apache.qpid.jms.provider.amqp.message.AmqpJmsMessageFacade
connection -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the contents of this Message.copy()Create a new instance and perform a deep copy of this object's contents.byte[]copyBody()intCreate and return an InputStream instance that can be used to read the contents of this message.byteCreate and return a new OuputStream used to populate the body of the message.booleanhasBody()Returns true if the underlying message has a body, false if the body is empty.protected voidUsed to indicate that a Message object should empty the body element and make any other internal updates to reflect the message now has no body value.voidonSend(long producerTtl) Called before a message is sent to allow a Message instance to move the contents from a logical data structure to a binary form for transmission, or other processing such as setting proper message headers etc.voidreset()Reset the message state such that a call to getInputStream or getOutputStream will succeed.Methods inherited from class org.apache.qpid.jms.provider.amqp.message.AmqpJmsMessageFacade
applicationPropertyExists, clearProperties, copyInto, encodeMessage, filterTracingAnnotations, getAmqpTimeToLiveOverride, getApplicationProperty, getApplicationPropertyNames, getContentType, getCorrelationId, getCorrelationIdBytes, getDeliveryCount, getDeliveryTime, getDestination, getExpiration, getGroupId, getGroupSequence, getMessageId, getPriority, getProperty, getPropertyNames, getProviderMessageIdObject, getRedeliveryCount, getReplyTo, getReplyToGroupId, getTimestamp, getTracingAnnotation, getTracingContext, getType, getUserId, getUserIdBytes, hasAmqpTimeToLiveOverride, initialize, initialize, isDeliveryTimeTransmitted, isPersistent, isRedelivered, onDispatch, propertyExists, removeTracingAnnotation, removeTracingContext, setAmqpTimeToLiveOverride, setApplicationProperty, setContentType, setCorrelationId, setCorrelationIdBytes, setDeliveryCount, setDeliveryTime, setDestination, setExpiration, setGroupId, setGroupSequence, setMessageId, setPersistent, setPriority, setProperty, setProviderMessageIdObject, setRedelivered, setRedeliveryCount, setReplyTo, setReplyToGroupId, setTimestamp, setTracingAnnotation, setTracingContext, setType, setUserId, setUserIdBytesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.jms.message.facade.JmsMessageFacade
clearProperties, encodeMessage, getCorrelationId, getCorrelationIdBytes, getDeliveryCount, getDeliveryTime, getDestination, getExpiration, getGroupId, getGroupSequence, getMessageId, getPriority, getProperty, getPropertyNames, getProviderMessageIdObject, getRedeliveryCount, getReplyTo, getTimestamp, getType, getUserId, getUserIdBytes, isDeliveryTimeTransmitted, isPersistent, isRedelivered, onDispatch, propertyExists, setCorrelationId, setCorrelationIdBytes, setDeliveryCount, setDeliveryTime, setDestination, setExpiration, setGroupId, setGroupSequence, setMessageId, setPersistent, setPriority, setProperty, setProviderMessageIdObject, setRedelivered, setRedeliveryCount, setReplyTo, setTimestamp, setType, setUserId, setUserIdBytesMethods inherited from interface org.apache.qpid.jms.tracing.TraceableMessage
filterTracingAnnotations, getTracingAnnotation, getTracingContext, removeTracingAnnotation, removeTracingContext, setTracingAnnotation, setTracingContext
-
Constructor Details
-
AmqpJmsBytesMessageFacade
public AmqpJmsBytesMessageFacade()
-
-
Method Details
-
initializeEmptyBody
protected void initializeEmptyBody()Description copied from class:AmqpJmsMessageFacadeUsed to indicate that a Message object should empty the body element and make any other internal updates to reflect the message now has no body value.- Overrides:
initializeEmptyBodyin classAmqpJmsMessageFacade
-
copy
Description copied from interface:JmsMessageFacadeCreate a new instance and perform a deep copy of this object's contents.- Specified by:
copyin interfaceJmsBytesMessageFacade- Specified by:
copyin interfaceJmsMessageFacade- Overrides:
copyin classAmqpJmsMessageFacade- Returns:
- a copy of this JmsMessageFacade instance.
-
getJmsMsgType
public byte getJmsMsgType()- Overrides:
getJmsMsgTypein classAmqpJmsMessageFacade- Returns:
- the appropriate byte value that indicates the type of message this is.
-
clearBody
public void clearBody()Description copied from interface:JmsMessageFacadeClears the contents of this Message.- Specified by:
clearBodyin interfaceJmsMessageFacade- Overrides:
clearBodyin classAmqpJmsMessageFacade
-
getInputStream
Description copied from interface:JmsBytesMessageFacadeCreate and return an InputStream instance that can be used to read the contents of this message. If an OutputStream was previously created and no call to reset has yet been made then this method will throw an exception. Multiple calls to this method should return the same InputStream instance, only when the message has been reset should the current input stream instance be discarded and a new one created on demand. While this means the multiple concurrent readers is possible it is strongly discouraged. If the message body contains data that has been compressed and can be determined to be so by the implementation then this method will return an InputStream instance that can inflate the compressed data.- Specified by:
getInputStreamin interfaceJmsBytesMessageFacade- Returns:
- an InputStream instance to read the message body.
- Throws:
jakarta.jms.JMSException- if an error occurs creating the stream.jakarta.jms.IllegalStateException- if there is a current OutputStream in use.
-
getOutputStream
Description copied from interface:JmsBytesMessageFacadeCreate and return a new OuputStream used to populate the body of the message. If an InputStream was previously requested this method will fail until such time as a call to reset has been requested. If an existing OuputStream has already been created then this method will return that stream until such time as the reset method has been called.- Specified by:
getOutputStreamin interfaceJmsBytesMessageFacade- Returns:
- an OutputStream instance to write the message body.
- Throws:
jakarta.jms.JMSException- if an error occurs creating the stream.jakarta.jms.IllegalStateException- if there is a current OutputStream in use.
-
reset
public void reset()Description copied from interface:JmsBytesMessageFacadeReset the message state such that a call to getInputStream or getOutputStream will succeed. If an OutputStream instance exists it is closed an the current contents are stored into the message body.- Specified by:
resetin interfaceJmsBytesMessageFacade
-
getBodyLength
public int getBodyLength()- Specified by:
getBodyLengthin interfaceJmsBytesMessageFacade- Returns:
- the number of bytes contained in the body of the message.
-
hasBody
public boolean hasBody()Description copied from interface:JmsMessageFacadeReturns true if the underlying message has a body, false if the body is empty.- Specified by:
hasBodyin interfaceJmsMessageFacade- Overrides:
hasBodyin classAmqpJmsMessageFacade- Returns:
- true if the underlying message has a body, false if the body is empty.
-
asJmsMessage
- Overrides:
asJmsMessagein classAmqpJmsMessageFacade
-
copyBody
public byte[] copyBody()- Specified by:
copyBodyin interfaceJmsBytesMessageFacade- Returns:
- a copy of the bytes contained in the body of the message.
-
onSend
public void onSend(long producerTtl) throws jakarta.jms.JMSException Description copied from interface:JmsMessageFacadeCalled before a message is sent to allow a Message instance to move the contents from a logical data structure to a binary form for transmission, or other processing such as setting proper message headers etc. The method allows for passing through producer configuration details not explicitly mapped into the JMS Message allowing the facade to create the most correct and compact message on the wire.- Specified by:
onSendin interfaceJmsMessageFacade- Overrides:
onSendin classAmqpJmsMessageFacade- Parameters:
producerTtl- the time to live value configured on the producer when sent.- Throws:
jakarta.jms.JMSException- if an error occurs while preparing the message for send.
-