Interface ConnectorDelivery

All Superinterfaces:
AutoCloseable

public interface ConnectorDelivery extends AutoCloseable
Runtime-owned asynchronous task used by an incoming connector while its owner thread performs transport maintenance.

Application-facing emission remains synchronous. This handle exists so a connector such as Kafka can keep polling for group heartbeats while one retained delivery executes on a messaging-runtime virtual thread.

A BatchDeliveryException propagated by either await method is aligned with this delivery's retained batch. Its BatchDeliveryException.batch() is the exact same MessageBatch instance supplied to the successful start, tryStart, or startFailed, or tryStartFailed invocation that returned this delivery, and every BatchItemOutcome.index() addresses that batch.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Await delivery termination and propagate its processing failure.
    boolean
    await(Duration timeout)
    Await delivery termination for at most the supplied duration and propagate its processing failure.
    void
    Cancel delivery processing.
    void
    Release the delivery's message-count admission after transport settlement.
    boolean
    Whether the calling thread is the messaging-runtime thread currently executing this delivery.
    boolean
    Whether delivery processing terminated.
  • Method Details

    • isDone

      boolean isDone()
      Whether delivery processing terminated.
      Returns:
      true when processing terminated
    • isCurrentThread

      boolean isCurrentThread()
      Whether the calling thread is the messaging-runtime thread currently executing this delivery.

      Connector shutdown code must not wait for connector completion that depends on the current delivery returning; this method allows that reentrant path to skip such a self-wait without exposing the runtime thread.

      Returns:
      true when called from this delivery's execution
    • await

      void await()
      Await delivery termination and propagate its processing failure.

      If the waiting connector owner is interrupted, its interrupt status is restored before the failure is reported.

      Throws:
      BatchDeliveryException - if processing reports structured per-item failure outcomes; the exception is aligned with this delivery's retained batch as specified by this interface
      MessagingException - if the waiting connector owner is interrupted or processing fails with a checked cause
      RuntimeException - if delivery processing fails with another runtime exception
    • await

      boolean await(Duration timeout)
      Await delivery termination for at most the supplied duration and propagate its processing failure.

      If the waiting connector owner is interrupted, its interrupt status is restored before the failure is reported.

      Parameters:
      timeout - maximum wait
      Returns:
      true if processing terminated, false on timeout
      Throws:
      BatchDeliveryException - if processing reports structured per-item failure outcomes; the exception is aligned with this delivery's retained batch as specified by this interface
      MessagingException - if the waiting connector owner is interrupted or processing fails with a checked cause
      RuntimeException - if delivery processing fails with another runtime exception
    • cancel

      void cancel()
      Cancel delivery processing.

      Cancellation interrupts active cooperative work. Completion is not reported until the task actually terminates. Cancellation does not release retained admission; the connector must still call close() when the transport delivery is settled or abandoned.

    • close

      void close()
      Release the delivery's message-count admission after transport settlement.

      Connectors must retain this lease until the source record has been acknowledged, committed, negatively acknowledged, or otherwise abandoned. Calling this method before processing terminates also requests cancellation; admission is not released until active processing actually stops.

      Specified by:
      close in interface AutoCloseable