#Machine design help: parallel updater and queue

1 messages · Page 1 of 1 (latest)

light root
#

Hi! I'm trying to describe a state machine that has the following properties:

  • allows updating an entity semi-synchronously (this calls an API, but in practice all these updates will trigger loaders in the UI)
  • allows adding paths to media files to a queue to be uploaded, which will then update the entity

see illustrative example: https://stately.ai/registry/editor/118178cf-5a44-4aaf-81dc-c9082f506a57?machineId=8fbdabe5-a43b-48cb-9051-11403712e352

But here's the issue: on finishing an upload, the machine should wait for the updater to be ready to accept the ADD_MEDIA event... And I'm not sure how to model this part. The only thing I can think of is making an endpoint specifically for adding the media item to the entity, but I'd like to avoid that if there's another way (for now).

light root
#

I think I resolved it. I've added an UPDATER_IS_READY event, and the uploader will call onReceive waiting for this event before sending an ADD_MEDIA event.