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. The StreamSenderMessage allows for local settlement and disposition management as well as waiting for remote settlement of a streamed message.
    • Method Detail

      • 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 AMQP Transfer frame for the delivery that comprises this streamed message. This value can only be updated before write operation is attempted and will throw an ClientIllegalStateException if any attempt to alter the value is made following a write.
        Specified by:
        messageFormat in interface AdvancedMessage<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.
      • aborted

        boolean aborted()
        Returns:
        true if this StreamSenderMessage has been marked as aborted previously.
      • body

        java.io.OutputStream body​(OutputStreamOptions options)
                           throws ClientException
        Creates an OutputStream instance configured with the given options which will write the bytes as the payload of one or more AMQP Data 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. The Data section based stream allows for control over the AMQP message Section 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 the rawOutputStream() method.

        Parameters:
        options - The stream options to use to configure the returned OutputStream
        Returns:
        a OutputStream instance configured using the given options.
        Throws:
        ClientException - if an error occurs while creating the OutputStream.
        See Also:
        rawOutputStream()
      • rawOutputStream

        java.io.OutputStream rawOutputStream()
                                      throws ClientException
        Creates an OutputStream instance that writes the bytes given without additional encoding or transformation. Using this stream option disables use of any other Message APIs and the message transfer is completed upon close of this OutputStream.

        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 the OutputStream should consist of already encoded AMQP Message data. For an OutputStream that performs the encoding of message data refer to the body(OutputStreamOptions) method.

        Returns:
        an OutputStream instance that performs no encoding.
        Throws:
        ClientException - if an error occurs while creating the OutputStream.
        See Also:
        body(org.apache.qpid.protonj2.client.OutputStreamOptions), body(OutputStreamOptions)