CommunicationScope

Provides communication capabilities for transformers to interact with the router and other transformers.

CommunicationScope is the primary interface available within transformer handlers for:

  • Sending data back to the router for emission to observers

  • Publishing effects to other transformers

  • Performing inter-transformer queries and computations

  • Managing checkpoint-based flow control

This interface extends QueryHandler and CheckpointHandler to provide a comprehensive communication API within transformer processing contexts.

See also

for inter-transformer query capabilities

for checkpoint-based flow control

for creating handlers

Functions

Link copied to clipboard
abstract suspend fun <D : Any> compute(contract: Contract.Computation<D>, invalidate: Boolean = false): D?

Triggers a computation in another transformer and returns the result.

abstract suspend fun <A : Any, D : Any> compute(contract: Contract.ComputationWithArgs<A, D>, args: A, invalidate: Boolean = false): D?

Triggers a computation with arguments in another transformer and returns the result.

Link copied to clipboard
abstract suspend fun execute(contract: Contract.Execution)

Executes an operation in another transformer without expecting a return value.

abstract suspend fun <A : Any> execute(contract: Contract.ExecutionWithArgs<A>, args: A)

Executes an operation with arguments in another transformer.

Link copied to clipboard
abstract suspend fun <D : Transmission.Data> getData(contract: Contract.DataHolder<D>): D?

Retrieves data from a data holder in another transformer.

Link copied to clipboard

Pauses the current handler execution until the specified checkpoint is validated.

abstract suspend fun <A : Any> CommunicationScope.pauseOn(contract: Contract.Checkpoint.WithArgs<A>): A

Pauses the current handler execution until the specified checkpoint is validated with arguments.

abstract suspend fun CommunicationScope.pauseOn(vararg contract: Contract.Checkpoint.Default)

Pauses the current handler execution until all specified checkpoints are validated.

Link copied to clipboard
abstract suspend fun <E : Transmission.Effect> publish(effect: E)

Publishes an effect to all transformers for potential processing.

Link copied to clipboard
abstract suspend fun <D : Transmission.Data> send(data: D?)

Sends data to the TransmissionRouter for emission to data stream observers.

abstract suspend fun <E : Transmission.Effect> send(effect: E, identity: Contract.Identity)

Sends an effect to a specific transformer identified by its contract identity.

Link copied to clipboard
abstract suspend fun <D : Any> sendPayload(payload: D)

Sends arbitrary payload data through the router as a one-shot effect.

Link copied to clipboard
abstract suspend fun validate(contract: Contract.Checkpoint.Default)

Validates a checkpoint and resumes any paused execution waiting on it.

abstract suspend fun <A : Any> validate(contract: Contract.Checkpoint.WithArgs<A>, args: A)

Validates a checkpoint with arguments and resumes any paused execution waiting on it.