Handling multiple events in Event Driven Architecture

Let’s say I have

  • Service A that publishes Message 1 to be processed by Consumer A
  • The same service A that publishes Message 2 to be processed by Consumer B

I need to make sure that consumer B processes Message 2 only after Message 1 has been fully processed. What is the common or best approach to this kind of situation ?

I was thinking that maybe I would need to generate a unique identifier and pass it in both messages and store it in the database so that Consumer A can update the status of the process and Consumer B can look up the status and only starts processing Message 2 after Consumer A has finished, otherwise it would push the message back into the queue. Would that be feasible ?