Class ClientStreamSender

    • Field Detail

      • CLOSED_UPDATER

        protected static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<org.apache.qpid.protonj2.client.impl.ClientSender> CLOSED_UPDATER
      • closed

        protected volatile int closed
      • executor

        protected final java.util.concurrent.ScheduledExecutorService executor
      • senderId

        protected final java.lang.String senderId
      • sendsSettled

        protected final boolean sendsSettled
      • protonSender

        protected Sender protonSender
      • senderRemotelyClosedHandler

        protected java.util.function.Consumer<Sender> senderRemotelyClosedHandler
      • remoteSource

        protected volatile Source remoteSource
      • remoteTarget

        protected volatile Target remoteTarget
    • Method Detail

      • send

        public StreamTracker send​(Message<?> message)
                           throws ClientException
        Description copied from interface: Sender
        Send the given message immediately if there is credit available or blocks if the link has not yet been granted credit.
        Specified by:
        send in interface Sender
        Parameters:
        message - the Message to send.
        Returns:
        the Tracker for the message delivery
        Throws:
        ClientException - if an error occurs while initiating the send operation.
      • send

        public StreamTracker send​(Message<?> message,
                                  java.util.Map<java.lang.String,​java.lang.Object> deliveryAnnotations)
                           throws ClientException
        Description copied from interface: Sender
        Send the given message immediately if there is credit available or blocks if the link has not yet been granted credit.
        Specified by:
        send in interface Sender
        Parameters:
        message - the Message to send.
        deliveryAnnotations - the delivery annotations that should be included in the sent Message.
        Returns:
        the Tracker for the message delivery
        Throws:
        ClientException - if an error occurs while initiating the send operation.
      • trySend

        public StreamTracker trySend​(Message<?> message)
                              throws ClientException
        Description copied from interface: Sender
        Send the given message if credit is available or returns null if no credit has been granted to the link at the time of the send attempt.
        Specified by:
        trySend in interface Sender
        Parameters:
        message - the Message to send if credit is available.
        Returns:
        the Tracker for the message delivery or null if no credit for sending.
        Throws:
        ClientException - if an error occurs while initiating the send operation.
      • trySend

        public StreamTracker trySend​(Message<?> message,
                                     java.util.Map<java.lang.String,​java.lang.Object> deliveryAnnotations)
                              throws ClientException
        Description copied from interface: Sender
        Send the given message if credit is available or returns null if no credit has been granted to the link at the time of the send attempt.
        Specified by:
        trySend in interface Sender
        Parameters:
        message - the Message to send if credit is available.
        deliveryAnnotations - the delivery annotations that should be included in the sent Message.
        Returns:
        the Tracker for the message delivery or null if no credit for sending.
        Throws:
        ClientException - if an error occurs while initiating the send operation.
      • beginMessage

        public org.apache.qpid.protonj2.client.impl.ClientStreamSenderMessage beginMessage()
                                                                                    throws ClientException
        Description copied from interface: StreamSender
        Creates and returns a new StreamSenderMessage that can be used by the caller to perform streaming sends of large message payload data.
        Specified by:
        beginMessage in interface StreamSender
        Returns:
        a new StreamSenderMessage that can be used to stream message data to the remote.
        Throws:
        ClientException - if an error occurs while initiating a new streaming send message.
      • beginMessage

        public org.apache.qpid.protonj2.client.impl.ClientStreamSenderMessage beginMessage​(java.util.Map<java.lang.String,​java.lang.Object> deliveryAnnotations)
                                                                                    throws ClientException
        Description copied from interface: StreamSender
        Creates and returns a new StreamSenderMessage that can be used by the caller to perform streaming sends of large message payload data.
        Specified by:
        beginMessage in interface StreamSender
        Parameters:
        deliveryAnnotations - the delivery annotations that should be included in the sent StreamSenderMessage.
        Returns:
        a new StreamSenderMessage that can be used to stream message data to the remote.
        Throws:
        ClientException - if an error occurs while initiating a new streaming send message.
      • address

        public java.lang.String address()
                                 throws ClientException
        Description copied from interface: Sender
        Returns the address that the Sender instance will send Message objects to. The value returned from this method is control by the configuration that was used to create the sender.
        • If the Sender is configured as an anonymous sender then this method returns null.
        • If the Sender was created with the dynamic sender methods then the method will return the dynamically created address once the remote has attached its end of the sender link. Due to the need to await the remote peer to populate the dynamic address this method will block until the open of the sender link has completed.
        • If neither of the above is true then the address returned is the address passed to the original Session.openSender(String) or Session.openSender(String, SenderOptions) methods.
        Specified by:
        address in interface Sender
        Returns:
        the address that this Sender is sending to.
        Throws:
        ClientException - if an error occurs while obtaining the Sender address.
      • source

        public Source source()
                      throws ClientException
        Description copied from interface: Sender
        Returns an immutable view of the remote Source object assigned to this sender link. If the attach has not completed yet this method will block to await the attach response which carries the remote Source.
        Specified by:
        source in interface Sender
        Returns:
        the remote Source node configuration.
        Throws:
        ClientException - if an error occurs while obtaining the Sender remote Source.
      • target

        public Target target()
                      throws ClientException
        Description copied from interface: Sender
        Returns an immutable view of the remote Target object assigned to this sender link. If the attach has not completed yet this method will block to await the attach response which carries the remote Target.
        Specified by:
        target in interface Sender
        Returns:
        the remote Target node configuration.
        Throws:
        ClientException - if an error occurs while obtaining the Sender remote Target.
      • close

        public void close()
        Description copied from interface: Sender
        Requests a close of the Sender at the remote and waits until the Sender has been fully closed or until the configured SenderOptions.closeTimeout() is exceeded.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Sender
      • close

        public void close​(ErrorCondition error)
        Description copied from interface: Sender
        Requests a close of the Sender at the remote and waits until the Sender has been fully closed or until the configured SenderOptions.closeTimeout() is exceeded.
        Specified by:
        close in interface Sender
        Parameters:
        error - The ErrorCondition to transmit to the remote along with the close operation.
      • detach

        public void detach()
        Description copied from interface: Sender
        Requests a detach of the Sender at the remote and waits until the Sender has been fully detached or until the configured SenderOptions.closeTimeout() is exceeded.
        Specified by:
        detach in interface Sender
      • detach

        public void detach​(ErrorCondition error)
        Description copied from interface: Sender
        Requests a detach of the Sender at the remote and waits until the Sender has been fully detached or until the configured SenderOptions.closeTimeout() is exceeded.
        Specified by:
        detach in interface Sender
        Parameters:
        error - The ErrorCondition to transmit to the remote along with the detach operation.
      • closeAsync

        public ClientFuture<Sender> closeAsync()
        Description copied from interface: Sender
        Requests a close of the Sender link at the remote and returns a Future that will be completed once the link has been closed.
        Specified by:
        closeAsync in interface Sender
        Returns:
        a Future that will be completed when the remote closes this Sender link.
      • closeAsync

        public ClientFuture<Sender> closeAsync​(ErrorCondition error)
        Description copied from interface: Sender
        Requests a close of the Sender link at the remote and returns a Future that will be completed once the link has been closed.
        Specified by:
        closeAsync in interface Sender
        Parameters:
        error - The ErrorCondition to transmit to the remote along with the close operation.
        Returns:
        a Future that will be completed when the remote closes this Sender link.
      • detachAsync

        public ClientFuture<Sender> detachAsync()
        Description copied from interface: Sender
        Requests a detach of the Sender link at the remote and returns a Future that will be completed once the link has been detached.
        Specified by:
        detachAsync in interface Sender
        Returns:
        a Future that will be completed when the remote detaches this Sender link.
      • detachAsync

        public ClientFuture<Sender> detachAsync​(ErrorCondition error)
        Description copied from interface: Sender
        Requests a detach of the Sender link at the remote and returns a Future that will be completed once the link has been detached.
        Specified by:
        detachAsync in interface Sender
        Parameters:
        error - The ErrorCondition to transmit to the remote along with the detach operation.
        Returns:
        a Future that will be completed when the remote detaches this Sender link.
      • properties

        public java.util.Map<java.lang.String,​java.lang.Object> properties()
                                                                          throws ClientException
        Description copied from interface: Sender
        Returns the properties that the remote provided upon successfully opening the Sender. If the attach has not completed yet this method will block to await the attach response which carries the remote properties. If the remote provides no properties this method will return null.
        Specified by:
        properties in interface Sender
        Returns:
        any properties provided from the remote once the sender has successfully opened.
        Throws:
        ClientException - if an error occurs while obtaining the Sender remote properties.
      • offeredCapabilities

        public java.lang.String[] offeredCapabilities()
                                               throws ClientException
        Description copied from interface: Sender
        Returns the offered capabilities that the remote provided upon successfully opening the Sender. If the attach has not completed yet this method will block to await the attach response which carries the remote offered capabilities. If the remote provides no capabilities this method will return null.
        Specified by:
        offeredCapabilities in interface Sender
        Returns:
        any capabilities provided from the remote once the sender has successfully opened.
        Throws:
        ClientException - if an error occurs while obtaining the Sender remote offered capabilities.
      • desiredCapabilities

        public java.lang.String[] desiredCapabilities()
                                               throws ClientException
        Description copied from interface: Sender
        Returns the desired capabilities that the remote provided upon successfully opening the Sender. If the attach has not completed yet this method will block to await the attach response which carries the remote desired capabilities. If the remote provides no capabilities this method will return null.
        Specified by:
        desiredCapabilities in interface Sender
        Returns:
        any desired capabilities provided from the remote once the sender has successfully opened.
        Throws:
        ClientException - if an error occurs while obtaining the Sender remote desired capabilities.
      • notClosedOrFailed

        protected boolean notClosedOrFailed​(ClientFuture<?> request)
      • notClosedOrFailed

        protected boolean notClosedOrFailed​(ClientFuture<?> request,
                                            Sender sender)