Skip to content

statemachine: Make commands more robust with 2 phases: Receive + Acknowledge #137

Description

@schmichael

Overview

Currently Metafora statemachine commands are like UNIX signals, they can be ignored by user code entirely.

It would be preferable for commands to persist until user code at least acknowledges their receipt.

Details

The current statemachine.Command interface only has a Receive() method. Once a Command is received, it is forgotten. If user code exits before receiving the command or an unexpected shutdown occurs, the command will have never been seen by user code.

Implementation

  • Make Receive() *statemachine.Message become Receive() statemachine.Command
  • Create interface:
type Command interface {
    Message() Message
    Ack()
}

Where until Ack() is called, subsequent calls to Receive() should return the same Command

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions