Interface Sender

    • Method Detail

      • offer

        void offer​(int credits)
        indicates pending deliveries
        Parameters:
        credits - the number of pending deliveries
      • send

        int send​(byte[] bytes,
                 int offset,
                 int length)
        Sends some data for the current delivery. The application may call this method multiple times for the same delivery.
        Parameters:
        bytes - the byte array containing the data to be sent.
        offset - the offset into the given array to start reading.
        length - the number of bytes to read from the given byte array.
        Returns:
        the number of bytes accepted TODO Proton-j current copies all the bytes it has been given so the return value will always be length. Should this be changed? How does Proton-c behave? What should the application do if the number of bytes accepted is smaller than length.
      • send

        int send​(ReadableBuffer buffer)
        Sends some data for the current delivery. The application may call this method multiple times for the same delivery.
        Parameters:
        buffer - the buffer to read the data from.
        Returns:
        the number of bytes read from the provided buffer.
      • sendNoCopy

        int sendNoCopy​(ReadableBuffer buffer)
        Sends data to the current delivery attempting not to copy the data unless a previous send has already added data to the Delivery in which case a copy may occur depending on the implementation.

        Care should be taken when passing ReadableBuffer instances that wrapped pooled bytes as the send does not mean the data will be sent immediately when the transport is flushed so the pooled bytes could be held for longer than expected.

        Parameters:
        buffer - An immutable ReadableBuffer that can be held until the next transport flush.
        Returns:
        the number of bytes read from the provided buffer.
      • abort

        void abort()
        Abort the current delivery. Note "pn_link_abort" is commented out in the .h