corda / net.corda.core.flows / FlowExternalAsyncOperation

FlowExternalAsyncOperation

interface FlowExternalAsyncOperation<R : Any>

FlowExternalAsyncOperation represents an external future that blocks a flow from continuing until the future returned by FlowExternalAsyncOperation.execute has completed. Examples of external processes where FlowExternalAsyncOperation would be useful include, triggering a long running process on an external system or retrieving information from a service that might be down.

The flow will suspend while it is blocked to free up a flow worker thread, which allows other flows to continue processing while waiting for the result of this process.

Implementations of FlowExternalAsyncOperation should ideally hold references to any external values required by execute. These references should be passed into the implementation's constructor. For example, an amount or a reference to a Corda Service could be passed in.

It is discouraged to insert into the node's database from a FlowExternalAsyncOperation, except for keeping track of deduplicationIds that have been processed. It is possible to interact with the database from inside a FlowExternalAsyncOperation but, for most operations, is not currently supported.

Functions

execute

abstract fun execute(deduplicationId: String): CompletableFuture<R>

Executes a future.

Extension Functions

contextLogger

fun Any.contextLogger(): Logger

When called from a companion object, returns the logger for the enclosing class.