WORKER
You can read more about the concept of WORKER here
The Worker Step allows you to delegate processing to Worker nodes. Worker nodes are services that operate
outside of the Unmeshed Engine and can run anywhere, provided that they are able to initiate and maintain a connection
with the Unmeshed server. Once connected, Worker nodes continuously poll for work and execute tasks as they arrive.
You may use one of the existing client SDKs to connect your existing service to Unmeshed as a Worker.
Worker Steps are managed by Unmeshed just like any other Step: they are scheduled according to Process needs and follow the specifications configured by their Error Policies. As an example, a Worker Step may define that work must complete within a specific time threshold, and fail the Step even if the Worker is still actively working on it. Similarly, a Step may fail if a Worker is unavailable to receive the work in time.
A Worker node would typically define one or more Worker Methods that are able to accept work from the server. Methods can receive up to one input parameter and can optionally return a result. Check out the snippet below for a glimpse into how the Java variant of the SDK works:
@WorkerMethod("new_worker")
public MyOutput doSomething(MyInput input) {
// Peform some work
return new MyOutput(1);
}
Rescheduling Workers
Unlike regular Steps, Worker Nodes may return an incomplete result. In those cases, and assuming no timeout thresholds have been met, Unmeshed would reschedule the Step to be executed by the client at a later date.
Example coming soon
Input
If an input parameter has been defined in the WorkerMethod
, all fields under the Step Context's input
will
be used to create the object. Note that some languages may fail if extraneous fields are added to input
.
In the above example, assuming MyInput
contains a single field called myString
, the input could look like so:
{
"myString": "myValue"
}
Output
If the Worker Method returns an object, all object fields will be provided under the Step Context's output
field.
In the above example, assuming MyOutput
has a single field called myInteger
, the output would appear as:
{
"myInteger": 1
}
Client SDKs
- Java - Available
- TypeScript - Coming soon
- JavaScript - Coming soon
- Golang - Coming soon