Storing state machine

From: Mohan Radhakrishnan <radhakrishnan(dot)mohan(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Storing state machine
Date: 2021-04-19 05:53:37
Message-ID: CAOoXFP_=OWmOoyzb8iUN3wHdhTgL-qxFJiHki9veTO-NFRQaqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Cross 2021-04-19 06:27:15 Re: Storing state machine
Previous Message Joel Jacobson 2021-04-18 20:42:11 Re: Planning time grows exponentially with levels of nested views