Open ePaul opened 4 years ago
Implementation ideas/concerns
Abstracting queue access
This possibly can be done mostly by providing just a different implementation of the EventLogRepository interface – possibly with some adaptions (including the using code):
Strict ordering vs. retrying
We might need some separate functionality for events which failed their submission:
I'm not sure how this can be abstracted in a useful way.
Consumption
Configuration
I think it makes sense to consider the task of consuming from a PGQ queue and publishing batches of events to Nakadi separately from the task of producing events for the queue in the first place. This way the former component may be reused more widely, e.g. when the application producing the events isn't using Spring (or Java, for that matter).
This library can still provide building blocks for both components, but it could be done with the potential separate deployment in mind.
@a1exsh This is certainly something to consider. I just worry that having separate deployments will increase the configuration overhead (i.e. you can not just plug in this library in your application and everything works), but maybe it's the way to go. Maybe we can find a way to have both the easy setup, and an option for separating stuff for cases where it's needed.
If other libraries (or applications implementing this manually) will want to interoperate, we also need to make sure to specify the format of the events in the queue, which limits our ability to evolve this in the future.
Background
We currently inside Zalando have a discussion of how to implement reliable (transactional) event sending, which is basically what this library is trying to do.
When I mentioned this library (and that we are using similar approaches in another team, where we do a nightly full vacuum), it was pointed (by @CyberDem0n):
@a1exsh pointed me to the pgq SQL API and promised to help with code review if we want to integrate this into this library.
Goal
Find a way of using a pgq queue instead of the current event_log table for storing the events for later Nakadi submission. This should be optional, as not every user of this library has pgq available, or the ability to install postgresql extensions.