Interface Receiver

All Superinterfaces:
Endpoint<Receiver>, Link<Receiver>
All Known Implementing Classes:
ProtonReceiver

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

    • addCredit

      Receiver addCredit(int additionalCredit)
      Adds the given amount of credit for the Receiver.
      Parameters:
      additionalCredit - the new amount of credits to add.
      Returns:
      this Receiver
      Throws:
      IllegalArgumentException - if the credit amount is negative.
    • drain

      boolean drain()
      Initiate a drain of all remaining credit of this Receiver link.
      Returns:
      true if a drain was started or false if the link already had no credit to drain.
      Throws:
      IllegalStateException - if an existing drain attempt is incomplete.
    • drain

      boolean drain(int credit)
      Initiate a drain of the given credit from this this Receiver link. If the credit given is greater than the current link credit the current credit is increased, however if the amount of credit given is less that the current amount of link credit an exception is thrown.
      Parameters:
      credit - The amount of credit that should be requested to be drained from this link.
      Returns:
      true if a drain was started or false if the value is zero and the link had no credit.
      Throws:
      IllegalStateException - if an existing drain attempt is incomplete.
      IllegalArgumentException - if the credit value given is less than the current value.
    • setDefaultDeliveryState

      Receiver setDefaultDeliveryState(DeliveryState state)
      Configures a default DeliveryState to be used if a received delivery is settled/freed without any disposition state having been previously applied.
      Parameters:
      state - the default delivery state
      Returns:
      this Receiver for chaining.
    • getDefaultDeliveryState

      DeliveryState getDefaultDeliveryState()
      Returns:
      the default delivery state for this delivery
    • disposition

      Receiver disposition(Predicate<IncomingDelivery> filter, DeliveryState state, boolean settle)
      For each unsettled outgoing delivery that is pending in the Receiver 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 Receiver for chaining
    • settle

      For each unsettled outgoing delivery that is pending in the Receiver 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 Receiver for chaining
    • unsettled

      Retrieves the list of unsettled deliveries for this Receiver link which have yet to be settled on this end of the link. When the IncomingDelivery is settled by the receiver the value will be removed from the 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 list if no pending deliveries are outstanding.
    • hasUnsettled

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

      Receiver deliveryReadHandler(EventHandler<IncomingDelivery> handler)
      Handler for incoming deliveries that is called for each incoming Transfer frame that comprises either one complete delivery or a chunk of a split framed Transfer. The handler should check that the delivery being read is partial or not and act accordingly, as partial deliveries expect additional updates as more frames comprising that IncomingDelivery arrive or the remote aborts the transfer.
      Parameters:
      handler - The handler that will be invoked when Transfer frames arrive on this receiver link.
      Returns:
      this receiver
    • deliveryAbortedHandler

      Receiver deliveryAbortedHandler(EventHandler<IncomingDelivery> handler)
      Handler for aborted deliveries that is called for each aborted in-progress delivery.

      This handler is an optional convenience handler that supplements the standard deliveryReadHandler(EventHandler) in cases where the users wishes to break out the processing of inbound delivery data from abort processing. If this handler is not set the Receiver will call the registered deliveryAbortedHandler(EventHandler) if one is set.

      Parameters:
      handler - The handler that will be invoked when Transfer frames arrive on this receiver link.
      Returns:
      this receiver
    • deliveryStateUpdatedHandler

      Receiver deliveryStateUpdatedHandler(EventHandler<IncomingDelivery> handler)
      Handler for updates to the remote state of incoming deliveries that have previously been received.

      Remote state updates for an IncomingDelivery can happen when the remote settles a complete IncomingDelivery or otherwise modifies the delivery outcome and the user needs to act on those changes such as a spontaneous update to the DeliveryState.

      Parameters:
      handler - The handler that will be invoked when a new remote state update for an IncomingDelivery arrives on this link.
      Returns:
      this receiver