Skip to main content
1 of 2
Gravy
  • 1.1k
  • 11
  • 15

Using message queue systems - forcing synchronous processing

I have a php process producer-a which places a job on RabbitMQ a - deferring processing to a third-party service. The 3rd party service completes processing a and places a response onto queue b. I have a listener consumer-b which picks up jobs on queue b to continue processing.

I need to ensure that producer-a has completed it's process entirely before the listener consumer-b picks up the job to continue processing.

The problem which I am facing is that by using RMQ - I am asynchronously performing tasks - however I need to serialise this process whilst still using RMQ.

In case the above doesn't make sense:

Example timeline if serialised:

Process A ------> Process B ------> Process C 

Example timeline with message queue

Internal Process Process A----------------------------------| Deferred Process Process B -----| Internal Process |Process C---| 

Process A needs to complete fully before Process C. The problem is that Process B is deferred to a 3rd party service via a message queue, and I need to ensure that Process A which sent the job to Process B completed before Process C picks up the job from Process A. As can be seen from the timeline above, Process C has completed before Process A has completed.

Gravy
  • 1.1k
  • 11
  • 15