-
Notifications
You must be signed in to change notification settings - Fork 10
Concepts: Stateless Workers
Orbit’s standard runtime guarantees ensure that more than one activation of an actor with a given identity can not exist in an Orbit cluster at any given time. This is typically desired behavior. It ensures that an actors internal state is always consistent, this is desirable even for actors that do not have persistent state as the internal transient state is usually important (non-persisted chat room for example).
In some specific scenarios this strict runtime behavior is not desired. As a consequence, Orbit’s standard behavior adds unnecessary latency to Actors that do not maintain an internal state.
For these scenarios, Orbit offers the concept of Stateless Workers.
- More than one stateless worker actor with a given identity can exist at once
- Orbit will create stateless workers based on demand
- Stateless workers must not rely on any state existing between calls
Creating a stateless worker simply requires adding an annotation to your Actor Interface.
import cloud.orbit.annotation.StatelessWorker;
import cloud.orbit.actors.Actor;
import cloud.orbit.concurrent.Task;
@StatelessWorker
public interface SomeStatelessWorker extends Actor
{
Task<String> someMethod(String message);
}
The @StatelessWorker annotation on the actor interface makes this actor a Stateless Worker.
Developed by Electronic Arts. Licensed under the BSD 3-Clause License.