Package io.github.javactrl.kafka
Interface Workflow
- All Superinterfaces:
Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for Kafka workflows definitions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringA short-cut toWorkflowContext.current.get().await(v)static StringA short-cut toWorkflowContext.current.get().await(newVar(name))static voidForwards a record into registered Processor sink, using the current thread id as the record's keystatic voidForwards a record into registered Processor sinkGetting currentorg.apache.kafka.streams.processor.api.ProcessorContextfrom Kafka Streams APIstatic StringGets current threadstatic VarnewVar()Generates a new variable on which workflows can suspend with an unique identifierstatic VarGenerates a new variable on which workflows can suspend with a specific local identifiervoidThe method to implement (or a lambda) for the workflow definition.
-
Method Details
-
run
The method to implement (or a lambda) for the workflow definition. Workflow functions are just simple Java functions, but they can be suspended for a long time (days, months etc), and resumed after this. The function is converted into a plain Apache Kafka Streams Processor.- Parameters:
parameter- parameter received by the workflow's starting message- Throws:
io.github.javactrl.rt.CThrowable- if suspends or there is an error
-
getProcessorContext
Getting currentorg.apache.kafka.streams.processor.api.ProcessorContextfrom Kafka Streams API- Returns:
- the current processor context
-
getThreadId
Gets current thread- Returns:
- thread id string
-
newVar
Generates a new variable on which workflows can suspend with an unique identifier- Returns:
- frash Var object
-
newVar
Generates a new variable on which workflows can suspend with a specific local identifier- Parameters:
id- the name of the variable- Returns:
- fresh Var object
-
await
A short-cut toWorkflowContext.current.get().await(v)- Parameters:
v- Var object to suspend on- Returns:
- result value on resumption
- Throws:
io.github.javactrl.rt.CThrowable- if suspended (always when this is called) or failed after resumption- See Also:
-
await
A short-cut toWorkflowContext.current.get().await(newVar(name))- Parameters:
id- local identifier of a new Var object- Returns:
- result value on resumption
- Throws:
io.github.javactrl.rt.CThrowable- if suspended (always when this is called) or failed after resumption- See Also:
-
forward
Forwards a record into registered Processor sink- Parameters:
child- name of the sinkkey- record's namevalue- record's value
-
forward
Forwards a record into registered Processor sink, using the current thread id as the record's key- Parameters:
child- name of the sinkvalue- record's value
-