-
Notifications
You must be signed in to change notification settings - Fork 388
add event handler class #2104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: beta
Are you sure you want to change the base?
add event handler class #2104
Conversation
| */ | ||
| protected void setContext(String context) { | ||
| // TODO(major): add getOptions to the StripeResponseGetter interface? that would simplify this | ||
| if (!(responseGetter instanceof LiveStripeResponseGetter)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this and am all ears for a better suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh, not much you can do. Seems like the wrong abstractions were put in place (or they made the common Java mistake of creating an interface when there was only ever going to be a single implementation)
mbroshi-stripe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't repeat all of my comments from the Go review, but they carry over (concurrency concerns and naming, mostly). Java-specific stuff looks good to me
| */ | ||
| protected void setContext(String context) { | ||
| // TODO(major): add getOptions to the StripeResponseGetter interface? that would simplify this | ||
| if (!(responseGetter instanceof LiveStripeResponseGetter)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh, not much you can do. Seems like the wrong abstractions were put in place (or they made the common Java mistake of creating an interface when there was only ever going to be a single implementation)
| } | ||
| } | ||
|
|
||
| private boolean hasHandledEvent = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar concurrency concerns as in Go: You probably want to set this to volatile or use an AtomicBoolean
Why?
We've been designing a streamlined approach to handling incoming events that is easy to get right and hard to get wrong. This PR has the initial implementation of this new system.
The only other pending item is to add a method to allow handling a webhook without verifying the signature. This is good for testing and for Event Bridge, which doesn't use the signature-based verification. Otherwise, this is ready for review.
What?
EventHandlerclassStripeClientExample usage
See Also