Class Stage

java.lang.Object
net.sodacan.core.Stage
Direct Known Subclasses:
EmptyStage

public class Stage extends Object

While an Actor processes a message, it populates this object with messages to be sent to other actors upon completion of processing the message. The stage is also where, formally, the actor can say: "save the state of the object." That means all internal and external affects of an actor processing a single message are encapsulated in the Stage. One could say, "If it's not in the Stage, it didn't happen." But this is only partially true for certain actors. For those actors that are themselves the end-point of an action, then the "side effect" is the goal and the stage, at most, would contain a confirmation message. For example, an Actor that actually performs some kind of IO, like writing to a communication channel or actually turning a light on.

The stage supports the commit/rollback semantics that many business transactions need. But the stage has no real behavior, it's just a container used by the internal mechanisms to get messages to where they need to go.

A Stage object has no concurrency requirements.

  • Constructor Details

    • Stage

      public Stage()
  • Method Details

    • add

      public Message add(Message message)
    • getMessages

      public List<Message> getMessages()
    • forward

      public Stage forward(Config config, Message inbound)

      Send the message on to its next route. If there is no next route in the message, then we do nothing.

      Parameters:
      config -
      inbound -