Interface Sender

All Superinterfaces:
Endpoint<Sender>, Link<Sender>
All Known Implementing Classes:
ProtonSender

public interface Sender extends Link<Sender>
AMQP Sender API
  • Method Details

    • drained

      Sender drained()
      Called when the Receiver has requested a drain of credit and the sender has sent all available messages.
      Returns:
      this Sender instance.
      Throws:
      IllegalStateException - if the link is not draining currently.
    • isSendable

      boolean isSendable()
      Checks if the sender has credit and the session window allows for any bytes to be written currently.
      Returns:
      true if the link has credit and the session window allows for any bytes to be written.
    • current

      OutgoingDelivery current()
      Gets the current OutgoingDelivery for this Sender if one is available.

      The sender only tracks a current delivery in the case that the next method has bee called and if any bytes are written to the delivery using the streaming based API OutgoingDelivery.streamBytes(ProtonBuffer) which allows for later writing of additional bytes to the delivery. Once the method OutgoingDelivery.writeBytes(ProtonBuffer) is called the final Transfer is written indicating that the delivery is complete and the current delivery value is reset. An outgoing delivery that is being streamed may also be completed by calling the OutgoingDelivery.abort() method.

      Returns:
      the current active outgoing delivery or null if there is no current delivery.
    • next

      When there has been no deliveries so far or the current delivery has reached a complete state this method updates the current delivery to a new instance and returns that value. If the current OutgoingDelivery has not been completed by either calling the OutgoingDelivery.writeBytes(ProtonBuffer) or the OutgoingDelivery.abort() method then this method will throw an exception to indicate the sender state cannot allow a new delivery to be started.
      Returns:
      a new delivery instance unless the current delivery is not complete.
      Throws:
      IllegalStateException - if the current delivery has not been marked complete.
    • disposition

      Sender disposition(Predicate<OutgoingDelivery> filter, DeliveryState state, boolean settle)
      For each unsettled outgoing delivery that is pending in the Sender apply the given predicate and if it matches then apply the given delivery state and settled value to it.
      Parameters:
      filter - The predicate to apply to each unsettled delivery to test for a match.
      state - The new DeliveryState to apply to any matching outgoing deliveries.
      settle - Boolean indicating if the matching unsettled deliveries should be settled.
      Returns:
      this Sender instance.
    • settle

      For each unsettled outgoing delivery that is pending in the Sender apply the given predicate and if it matches then settle the delivery.
      Parameters:
      filter - The predicate to apply to each unsettled delivery to test for a match.
      Returns:
      this Sender instance.
    • unsettled

      Retrieves the list of unsettled deliveries sent from this Sender. The deliveries in the Collection cannot be written to but can have their settled state and disposition updated. Only when this Sender settles on its end are the OutgoingDelivery instances removed from the unsettled Collection. The Collection returned from this method is a copy of the internally maintained data and is not modifiable. The caller should use this method judiciously to avoid excess GC overhead.
      Returns:
      a collection of unsettled deliveries or an empty collection if no pending deliveries are outstanding.
    • hasUnsettled

      boolean hasUnsettled()
      Returns:
      true if there are unsettled deliveries for this Sender link.
    • setDeliveryTagGenerator

      Sender setDeliveryTagGenerator(DeliveryTagGenerator generator)
      Configures a DeliveryTagGenerator that will be used to create and set a DeliveryTag value on each new OutgoingDelivery that is created and returned from the next() method.
      Parameters:
      generator - The DeliveryTagGenerator to use to create automatic DeliveryTag values.
      Returns:
      this Sender instance.
    • getDeliveryTagGenerator

      DeliveryTagGenerator getDeliveryTagGenerator()
      Returns:
      the currently configured DeliveryTagGenerator for this Sender.
    • deliveryStateUpdatedHandler

      Sender deliveryStateUpdatedHandler(EventHandler<OutgoingDelivery> handler)
      Handler for updates for deliveries that have previously been sent. Updates can happen when the remote settles or otherwise modifies the delivery and the user needs to act on those changes.
      Parameters:
      handler - The handler that will be invoked when a new update delivery arrives on this link.
      Returns:
      this Sender instance.