Scenario: using outbox pattern for saving entry in DB and then publishing to message broker. how? : the outbox table will store a state "TO_BE_PUBLISHED | PUBLISHED". and a Scheduler1 will pick the entry to publish the event into message broker. [Another Scheduler2 will remove PUBLISHED entry after 1 Day of publishing event].
Now, After Message Broker, there is Consumer and which will make a Service Call.
MyService[Outbox Pattern & Schedulers] --> MessageBroker --> MyMessageConsumer --> Downstream Service
Now Since there can be a Failure at MessageConsumer's end, we are suggested to use the outbox for storing more states "SERVICE_CALL_SUCCESS" when the consumer is failed.
To do this, We have to expose an internal API getOrUpdate-outbox-entry
from MyService.
My Questions are:
- Since we have 1 Consumer currently, do we really require MessageBroker after Outbox is implemented? [Load is not very high]
- Exposing another API for Outbox table does not seem correct to me. but I dont have a reasoning for same. Please share if this is good or bad approach and why?
Note: we cannot add a Consumer inside Downstream Service. its a limitation.