Workflow with Multiple entrypoints

Say I have the following scenario, how would I handle it with temporal?

  1. I receive a lead event. This should start a workflow instance in the lead state.
  2. I receive an opportunity event. This will start a 2nd workflow instance in the opportunity state.
  3. I receive a job event that ties the lead from workflow #1 to the opportunity from workflow #2. What should happen here or how do I merge these two workflows?

Multiple entry points seem to cause issues
These are based on a single workflow definition.

Use signalWithStart to send both lead and opportunity events to the workflow. Use the same workflowID for both. So there is no need to merge. The first event received is going to start workflow before delivering the signal.

How do I link the same workflow ID? I have no idea they should use the same workflow ID until the 3rd event comes in.

It is hard to give a general recommendation without understanding the use case. What happens when each of the events is received? Do you need to handle each of them separately or only when all three are received?

All 3 separately, and there is no x out of 3 because many times, there is no 3rd event, and it’s expected to be two workflows in that case. There should only be one workflow when the 3rd event actually comes.

Then I would have three separate workflow types that communicate through signals.

Or two with the job being a signal to one of them