davsclaus opened a new issue, #148:
URL: https://github.com/apache/camel-jbang-examples/issues/148

   No example receives HTTP calls from another system and checks them. Webhooks 
(as GitHub and Stripe send them) are one of the most common integration tasks: 
check the signature, answer fast, process later, and handle an event that is 
sent twice.
   
   Proposed example, `connect/webhook-receiver`, with the shop story: the 
payment provider posts a JSON event for each payment, with the header 
`X-Signature` (the HMAC-SHA256 of the body with a shared secret). A simulated 
provider in the same example posts the events, so no other service is needed. 
One event is resent, and one is forged.
   
   Build it step by step:
   1. A `platform-http` route for `POST /webhooks/payments` that logs the event.
   2. Check the signature; reject a wrong one with 401.
   3. Answer 202 at once, and record the payment afterwards (it takes two 
seconds).
   4. Record each event id only once.
   
   Simple has `hash()` but no HMAC, so the signature is computed with Groovy. 
If models struggle here, a Simple `hmac` function is a candidate for Camel.
   
   With a Citrus YAML test, run with `camel test run`.
   
   _Claude Code on behalf of davsclaus_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to