A
- common representation form for all action commands (typically Json / GenericRecord for Avro)D
- intermediate decoded input type (this can be specific to this action processor)K
- key for the value topicO
- value returned by async functionR
- final result type that ends up in value topicpublic final class AsyncSpec<A,D,K,O,R> extends Object
This includes:
A
to the decode input type D
.Modifier and Type | Class and Description |
---|---|
static interface |
AsyncSpec.UndoFunction<A,D,O>
The UndoFunction is a mechanism to take the result of the async invocation and turn it into an
undo action command.
|
Modifier and Type | Field and Description |
---|---|
String |
actionType
Each action processor must have a unique action type associated with it.
|
java.util.function.BiConsumer<D,Callback<O>> |
asyncFunction
This is a
BiConsumer that takes the decoded input type and a Callback as input. |
String |
groupId
This group Id is used to create a consumer group that consumes requests to invoke asynchronous actions.
|
java.util.function.Function<A,io.simplesource.data.Result<Throwable,D>> |
inputDecoder
The Input decoder converts the common action command representation to an intermediate decoded type.
|
Optional<AsyncResult<D,K,O,R>> |
resultSpec
This is required for cases where the result is written to an output topic, or where an undo function is
defined based on the return value.
|
Optional<java.time.Duration> |
timeout
The timeout.
|
AsyncSpec.UndoFunction<A,D,O> |
undoFunction
An undo function.
|
Constructor and Description |
---|
AsyncSpec() |
public final String actionType
public final java.util.function.Function<A,io.simplesource.data.Result<Throwable,D>> inputDecoder
A
type is common across all action processors and action types. This enables working with a type that
is specific to this action processor.public final java.util.function.BiConsumer<D,Callback<O>> asyncFunction
BiConsumer
that takes the decoded input type and a Callback
as input.
It then executes and, completes the call back when it is finished.public final String groupId
public final Optional<AsyncResult<D,K,O,R>> resultSpec
public final AsyncSpec.UndoFunction<A,D,O> undoFunction
public final Optional<java.time.Duration> timeout
Copyright © 2019. All rights reserved.