Interface ConnectorDelivery
- All Superinterfaces:
AutoCloseable
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 TypeMethodDescriptionvoidawait()Await delivery termination and propagate its processing failure.booleanAwait delivery termination for at most the supplied duration and propagate its processing failure.voidcancel()Cancel delivery processing.voidclose()Release the delivery's message-count admission after transport settlement.booleanWhether the calling thread is the messaging-runtime thread currently executing this delivery.booleanisDone()Whether delivery processing terminated.
-
Method Details
-
isDone
boolean isDone()Whether delivery processing terminated.- Returns:
truewhen 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:
truewhen 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 interfaceMessagingException- if the waiting connector owner is interrupted or processing fails with a checked causeRuntimeException- if delivery processing fails with another runtime exception
-
await
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:
trueif processing terminated,falseon 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 interfaceMessagingException- if the waiting connector owner is interrupted or processing fails with a checked causeRuntimeException- 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:
closein interfaceAutoCloseable
-