org.hornetq.api.core.client
Interface ClientMessage

All Superinterfaces:
Message

public interface ClientMessage
extends Message

A ClientMessage represents a message sent and/or received by HornetQ.

Author:
Tim Fox, Clebert Suconic

Field Summary
 
Fields inherited from interface org.hornetq.api.core.Message
BYTES_TYPE, DEFAULT_TYPE, HDR_ACTUAL_EXPIRY_TIME, HDR_DUPLICATE_DETECTION_ID, HDR_GROUP_ID, HDR_LARGE_BODY_SIZE, HDR_LARGE_COMPRESSED, HDR_LAST_VALUE_NAME, HDR_ORIG_MESSAGE_ID, HDR_ORIGINAL_ADDRESS, HDR_SCHEDULED_DELIVERY_TIME, MAP_TYPE, OBJECT_TYPE, STREAM_TYPE, TEXT_TYPE
 
Method Summary
 void acknowledge()
          Acknowledge reception of this message.
 int getBodySize()
          Return the size (in bytes) of this message's body
 int getDeliveryCount()
          Returns the number of times this message was delivered.
 void individualAcknowledge()
          Acknowledge reception of a single message.
 void saveToOutputStream(OutputStream out)
          Saves the content of the message to the OutputStream.
 void setBodyInputStream(InputStream bodyInputStream)
          Sets the body's IntputStream.
 void setDeliveryCount(int deliveryCount)
          Set the delivery count for this message.
 void setOutputStream(OutputStream out)
          Sets the OutputStream that will receive the content of a message received in a non blocking way.
 boolean waitOutputStreamCompletion(long timeMilliseconds)
          Wait the outputStream completion of the message.
 
Methods inherited from interface org.hornetq.api.core.Message
containsProperty, containsProperty, getAddress, getBodyBuffer, getBodyBufferCopy, getBooleanProperty, getBooleanProperty, getByteProperty, getByteProperty, getBytesProperty, getBytesProperty, getDoubleProperty, getDoubleProperty, getEncodeSize, getExpiration, getFloatProperty, getFloatProperty, getIntProperty, getIntProperty, getLongProperty, getLongProperty, getMessageID, getObjectProperty, getObjectProperty, getPriority, getPropertyNames, getShortProperty, getShortProperty, getSimpleStringProperty, getSimpleStringProperty, getStringProperty, getStringProperty, getTimestamp, getType, getUserID, isDurable, isExpired, isLargeMessage, putBooleanProperty, putBooleanProperty, putByteProperty, putByteProperty, putBytesProperty, putBytesProperty, putDoubleProperty, putDoubleProperty, putFloatProperty, putFloatProperty, putIntProperty, putIntProperty, putLongProperty, putLongProperty, putObjectProperty, putObjectProperty, putShortProperty, putShortProperty, putStringProperty, putStringProperty, removeProperty, removeProperty, setAddress, setDurable, setExpiration, setPriority, setTimestamp, setUserID, toMap
 

Method Detail

getDeliveryCount

int getDeliveryCount()
Returns the number of times this message was delivered.


setDeliveryCount

void setDeliveryCount(int deliveryCount)
Set the delivery count for this message. This method is not meant to be called by HornetQ clients.

Parameters:
deliveryCount - message delivery count

acknowledge

void acknowledge()
                 throws org.hornetq.api.core.HornetQException
Acknowledge reception of this message.

If the session responsible to acknowledge this message has autoCommitAcks set to true, the transaction will automatically commit the current transaction. Otherwise, this acknowledgement will not be committed until the client commits the session transaction.

Throws:
org.hornetq.api.core.HornetQException - if an error occurred while acknowledging the message.
See Also:
ClientSession.isAutoCommitAcks()

individualAcknowledge

void individualAcknowledge()
                           throws org.hornetq.api.core.HornetQException
Acknowledge reception of a single message. If the session responsible to acknowledge this message has autoCommitAcks set to true, the transaction will automatically commit the current transaction. Otherwise, this acknwoledgement will not be committed until the client commits the session transaction.

Throws:
org.hornetq.api.core.HornetQException - if an error occured while acknowledging the message.
See Also:
ClientSession.isAutoCommitAcks()

getBodySize

int getBodySize()
Return the size (in bytes) of this message's body


setOutputStream

void setOutputStream(OutputStream out)
                     throws org.hornetq.api.core.HornetQException
Sets the OutputStream that will receive the content of a message received in a non blocking way.
This method is used when consuming large messages

Throws:
org.hornetq.api.core.HornetQException

saveToOutputStream

void saveToOutputStream(OutputStream out)
                        throws org.hornetq.api.core.HornetQException
Saves the content of the message to the OutputStream. It will block until the entire content is transfered to the OutputStream.

Throws:
org.hornetq.api.core.HornetQException

waitOutputStreamCompletion

boolean waitOutputStreamCompletion(long timeMilliseconds)
                                   throws org.hornetq.api.core.HornetQException
Wait the outputStream completion of the message. This method is used when consuming large messages

Parameters:
timeMilliseconds - - 0 means wait forever
Returns:
true if it reached the end
Throws:
org.hornetq.api.core.HornetQException

setBodyInputStream

void setBodyInputStream(InputStream bodyInputStream)
Sets the body's IntputStream.
This method is used when sending large messages



Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.