Storing state machine - Mailing list pgsql-general

From Mohan Radhakrishnan
Subject Storing state machine
Date
Msg-id CAOoXFP_=OWmOoyzb8iUN3wHdhTgL-qxFJiHki9veTO-NFRQaqw@mail.gmail.com
Whole thread Raw
Responses Re: Storing state machine  (Tim Cross <theophilusx@gmail.com>)
List pgsql-general
Hello,
           We have a workflow when we receive events into the service. But we don't have a way to choreograph or orchestrate the workflow. The services are all independent and receive and respond to events.

Since there is no order imposed by the event queues I was thinking of storing a simple state machine in the table.

1. Order PENDING
2. Order line 1 PENDING
3. Order line 2 PENDING
4. Order line 1 PROCESSED
5. Order line 2 PROCESSED
6. Order PROCESSED

Order and Order lines can be PROCESSED in any order. But at the end all lines should be  PROCESSED and then the order is also  PROCESSED.
I won't be able to use any PostgreSql functions because we don't depend on those features.

Are there any PostgreSql features that could support this pattern ? Is it just like any other eventually consistent pattern ?
  
Thanks

pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Vulnerability PostgreSQL 11.2
Next
From: Tim Cross
Date:
Subject: Re: Storing state machine