Feature/persist webhook events - #24
Conversation
3d3e173 to
8b89465
Compare
5b7b368 to
e6d985e
Compare
| @Setter | ||
| @Entity | ||
| @Table(name = "failed_request", schema = "public") | ||
| public class FailedRequest { |
There was a problem hiding this comment.
@VSydor Re: what we were talking about yesterday, wondering if we should refactor this to make it more of a WebhookRequest class. I think the fields can be kept the same, but we'd switch to inserting this at the beginning of every single webhook Controller method. If processing fails, update it with the errorMessage? If it succeeds, delete it? Or possibly retain it for 7ish days in case we need to analyze it?
That will get us one step closer to creating a durable, async queue...
Thoughts? CC @LandonBaer721
There was a problem hiding this comment.
As I see it:
if we want to keep track of every single incoming event - then we should do it like you said: persist on each request and then update with an error message if processing failed (and keep "successful events" for some longer time. But how do we clean-up them later on? Will have to do it manually in some way?).
if the idea is to track only failed-to-process events - then there is no need to persist every event - only failed ones (and then delete them after successful processing?)
Please let me know which approach is preferred - I'll update the code.
| log.error("failed to process the Stripe event", e); | ||
| // TODO: email notification? | ||
| log.info("Saving event with id '{}' as failed request...", event.getId()); | ||
| env.failedRequestService().persist(event.getId(), new JSONObject(event), e.getMessage()); |
There was a problem hiding this comment.
IE, shift this to the beginning of the webhook method, then replace this line with an update to mark it as failed?
e6d985e to
c1d6ad1
Compare
c1d6ad1 to
e822f80
Compare
No description provided.