Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a workflow instance idempotent #455

Closed
saig0 opened this issue Sep 20, 2017 · 5 comments
Closed

Create a workflow instance idempotent #455

saig0 opened this issue Sep 20, 2017 · 5 comments

Comments

@saig0
Copy link
Member

saig0 commented Sep 20, 2017

AT:

  • I can provide an unique identifier while creating a workflow instance
  • a new instance is only created when no workflow instance with this identifier for this workflow is running
@berndruecker
Copy link
Member

Current assumptions:

  • It is sufficient to provide uniqueness check "only" for a certain workflow definition
  • When we do partitioning of workflow instances of one definition it might get tricky. I asked a prospect for feedback and he commented:

I think this may come down to how you plan to do the partitioning to begin with. Is this down to the client to specify a “partition_key” or do you do that internally ? If it is up to the client, then having deduplication per partition sounds good enough for me as a user can “distribute” the work based on some object_id and thus we are guaranteed to catch the duplicates. The client can supply a specific deduplication_id hash or even reuse the object id and the system will ensure to deduplicate start commands for him ( as far there is something in progress for it ). I have attached a mental map on this scenario.

client_partitioner 003

If you control the partitioning that is a harder problem. At that point a good idea might be to make this functionality configurable per workflow definition and let the user decide if he is willing to incur the extra latency. In such a scenario however having a partion only deduplication sounds inefficient because it pretty non-deterministic as far as the user is concerned.

@berndruecker
Copy link
Member

Background motivation can be best explained by a concrete scenario. In an event-driven system based on e.g. Kafka you receive a message by some app which then does something in a database (business logic, transactional) and afterwards sends an event to Kafka that something has been done. If the app crashes after it consumed the event and did the work but did not issue the message - this will not be recognized and something will not happen. Therefor you have to build own infrastructure to "simulate" transactional behavior.
With Zeebe and indempotent start you could leverage a BPMN sequence doing the two things (business logic in DB, emit event) in two steps and be sure both will be carried out).

@saig0
Copy link
Member Author

saig0 commented Jul 4, 2018

This will be implemented for message start events in #1012

@MrSaints
Copy link

MrSaints commented May 1, 2020

I'm not sure idempotent message start events quite solves idempotent workflow instances.

To elaborate, if I were to create a workflow using CreateWorkflowInstance, I'd either get a success or failure. If I were to publish a message, that will always succeed even if it does not trigger any message start event.

Ideally, it'd be nice to have some confidence when creating a workflow, but also some mechanism to ensure an idempotent instance.

@berndruecker
Copy link
Member

Could you share your use case @MrSaints? It is a quite interesting field - but I love moving discussions to a very concrete level, as many things depend on that context. For example I can easily argue, that a duplicate caused by retries or redeliveries can be safely simply ignored - I don't need a feedback here. But there might be use cases where you indeed want hat feedback, and I would love to learn about yours :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants