Hi. Good question
I think both represent the same concept, but serve different purposes.
gen_statem is process-oriented, as you said. In my case (both in a current project, and a couple of past projects where I felt the need for a similar pattern) I actually wanted to model persistent state, and not necessarily a process.
The example I’m dealing with right now was an Ecto model that already existed before this fsm concept was introduced to it. It now contains a state field, some behaviour that is necessary when entering/leaving certain states, and some specific validations on the changeset, also depending on the state
Modeling this with gen_statem would require a process to deal with each individual instance of the schema, which already changes a whole lot the approach we use in the rest of the existing code. In this case I’m just dealing with database updates, and a couple of side effects of some particular cases (such as sending an email, which
Bamboo already defers to an async task