Class FlowPublisherAdapter

java.lang.Object
org.apache.groovy.runtime.async.FlowPublisherAdapter
All Implemented Interfaces:
AwaitableAdapter

public final class FlowPublisherAdapter extends Object implements AwaitableAdapter
Adapter for Flow.Publisher, the JDK's built-in Reactive Streams type. Enables:
  • await publisher โ€” completes with the first onNext value, then cancels the subscription. Completes with null if the publisher signals onComplete without emitting.
  • for await (item in publisher) โ€” iterates over emitted values with bounded backpressure (see DEFAULT_BATCH_SIZE).

Conformance:

  • Reactive Streams ยง2.13: onNext(null) is treated as a protocol violation and surfaced as a NullPointerException.
  • A second onSubscribe after the first is cancelled.
  • Signals after a terminal onError/onComplete are ignored.

This adapter is registered as the lowest-priority built-in (after SPI-loaded adapters) so framework-specific adapters (Reactor, RxJava) take precedence for their concrete types.

Since:
6.0.0