Interface StreamSenderMessage
-
- All Superinterfaces:
AdvancedMessage<java.io.OutputStream>
,Message<java.io.OutputStream>
public interface StreamSenderMessage extends AdvancedMessage<java.io.OutputStream>
Streaming Message Tracker object used to operate on and track the state of a streamed message at the remote. TheStreamSenderMessage
allows for local settlement and disposition management as well as waiting for remote settlement of a streamed message.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StreamSenderMessage
abort()
Marks the currently streaming message as being aborted.boolean
aborted()
java.io.OutputStream
body(OutputStreamOptions options)
Creates anOutputStream
instance configured with the given options which will write the bytes as the payload of one or more AMQPData
sections based on the provided configuration..StreamSenderMessage
complete()
Marks the currently streaming message as being complete.boolean
completed()
StreamSenderMessage
messageFormat(int messageFormat)
Sets the configured message format value that will be set on the first outgoing AMQPTransfer
frame for the delivery that comprises this streamed message.java.io.OutputStream
rawOutputStream()
Creates anOutputStream
instance that writes the bytes given without additional encoding or transformation.StreamSender
sender()
StreamTracker
tracker()
-
Methods inherited from interface org.apache.qpid.protonj2.client.AdvancedMessage
addBodySection, annotations, annotations, applicationProperties, applicationProperties, bodySections, bodySections, clearBodySections, encode, footer, footer, forEachBodySection, header, header, messageFormat, properties, properties
-
Methods inherited from interface org.apache.qpid.protonj2.client.Message
absoluteExpiryTime, absoluteExpiryTime, annotation, annotation, body, body, contentEncoding, contentEncoding, contentType, contentType, correlationId, correlationId, creationTime, creationTime, deliveryCount, deliveryCount, durable, durable, firstAcquirer, firstAcquirer, footer, footer, forEachAnnotation, forEachFooter, forEachProperty, groupId, groupId, groupSequence, groupSequence, hasAnnotation, hasAnnotations, hasFooter, hasFooters, hasProperties, hasProperty, messageId, messageId, priority, priority, property, property, removeAnnotation, removeFooter, removeProperty, replyTo, replyTo, replyToGroupId, replyToGroupId, subject, subject, timeToLive, timeToLive, to, to, toAdvancedMessage, userId, userId
-
-
-
-
Method Detail
-
tracker
StreamTracker tracker()
- Returns:
- The
Tracker
assigned to monitor the life-cycle of thisStreamSenderMessage
-
sender
StreamSender sender()
- Returns:
- the
Sender
that was used to send the delivery that is being tracked.
-
messageFormat
StreamSenderMessage messageFormat(int messageFormat) throws ClientException
Sets the configured message format value that will be set on the first outgoing AMQPTransfer
frame for the delivery that comprises this streamed message. This value can only be updated before write operation is attempted and will throw anClientIllegalStateException
if any attempt to alter the value is made following a write.- Specified by:
messageFormat
in interfaceAdvancedMessage<java.io.OutputStream>
- Parameters:
messageFormat
- The assigned AMQP message format for this streamed message.- Returns:
- this
StreamSenderMessage
instance. - Throws:
ClientException
- if an error occurs while attempting set the message format.
-
complete
StreamSenderMessage complete() throws ClientException
Marks the currently streaming message as being complete.Marking a message as complete finalizes the streaming send operation and causes a final
Transfer
frame to be sent to the remote indicating that the ongoing streaming delivery is done and no more message data will arrive.- Returns:
- this
StreamSenderMessage
instance. - Throws:
ClientException
- if an error occurs while initiating the completion operation.
-
completed
boolean completed()
- Returns:
- true if this message has been marked as being complete.
-
abort
StreamSenderMessage abort() throws ClientException
Marks the currently streaming message as being aborted. Once aborted no further writes regardless of whether any writes have yet been performed or not.- Returns:
- this
StreamSenderMessage
instance. - Throws:
ClientException
- if an error occurs while initiating the abort operation.
-
aborted
boolean aborted()
- Returns:
- true if this
StreamSenderMessage
has been marked as aborted previously.
-
body
java.io.OutputStream body(OutputStreamOptions options) throws ClientException
Creates anOutputStream
instance configured with the given options which will write the bytes as the payload of one or more AMQPData
sections based on the provided configuration..The returned
OutputStream
can be used to write the payload of an AMQP Message in chunks when the source is not readily available in memory or as part of a larger streams based component. TheData
section based stream allows for control over the AMQP messageSection
values that are sent but does the encoding itself. For stream of message data where the content source already consists of an AMQP encoded message refer to therawOutputStream()
method.- Parameters:
options
- The stream options to use to configure the returnedOutputStream
- Returns:
- a
OutputStream
instance configured using the given options. - Throws:
ClientException
- if an error occurs while creating theOutputStream
.- See Also:
rawOutputStream()
-
rawOutputStream
java.io.OutputStream rawOutputStream() throws ClientException
Creates anOutputStream
instance that writes the bytes given without additional encoding or transformation. Using this stream option disables use of any otherMessage
APIs and the message transfer is completed upon close of thisOutputStream
.The returned
OutputStream
can be used to write the payload of an AMQP Message in chunks when the source is not readily available in memory or as part of a larger streams based component. The source of the bytes written to theOutputStream
should consist of already encoded AMQPMessage
data. For anOutputStream
that performs the encoding of message data refer to thebody(OutputStreamOptions)
method.- Returns:
- an
OutputStream
instance that performs no encoding. - Throws:
ClientException
- if an error occurs while creating theOutputStream
.- See Also:
body(org.apache.qpid.protonj2.client.OutputStreamOptions)
,body(OutputStreamOptions)
-
-