I have a use case where I need to process a set of events. I need them to process in parallel holistically but serially for each user. Can this be done in PubSub (maybe GCP Tasks?)?
For Example:
6 events come in at one time (User_A_Event_1, User_A_Event_2, User_B_Event_1, User_B_Event_2, User_C_Event_1, User_D_Event_1).
I want to group them by UserID, process each user in parallel and then and process each event serially (subsequent event processing won't begin until successful completion of the prior event). Something like:
- User A Serial Processing: Process User_A_Event_1 --> Process User_A_Event_2
- User B Serial Processing: Process User_B_Event_1 --> Process User_B_Event_2
- User C Serial Processing: Process User_C_Event_1
- User D Serial Processing: Process User_D_Event_1
If it matters, I have not idea what users will have events and at what times. We might go months without seeing any events for a user and then start getting lots of them.
I am trying to figure out a way to accomplish this in GCP PubSub but I am open to other solutions as well. My preference would be to do this through a push instead of a pull as I could go long periods of time with nothing in the queue.
Appreciate your help.
Craig