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.
Update:
I didn't think to state the obvious but seem to be getting obvious suggestions / solutions. producer-a
simply needs to send a TCP message to Loggly (sometimes takes over 2s) and also needs to update the database to advise that the process was deferred. Sometimes, the message comes back and is picked up by Process C before Process A has completed.