Class PaymentResource

java.lang.Object
io.github.ravocode.avoonce.sample.quarkus.PaymentResource

@Path("/api/payments") @ApplicationScoped @Produces("application/json") public class PaymentResource extends Object
Sample JAX-RS resource in Quarkus demonstrating selective idempotency protection using the Idempotent name-binding annotation.
  • Constructor Details

    • PaymentResource

      public PaymentResource()
  • Method Details

    • processPayment

      @POST @Consumes("application/json") public jakarta.ws.rs.core.Response processPayment(PaymentResource.PaymentRequest request)
      Protected endpoint: annotated with Idempotent. Requests with an Idempotency-Key header are deduplicated, locked, and cached.
      Parameters:
      request - the payment request payload
      Returns:
      a response containing the processing outcome
    • processUnprotectedPayment

      @POST @Path("/unprotected") @Consumes("application/json") public jakarta.ws.rs.core.Response processUnprotectedPayment(PaymentResource.PaymentRequest request)
      Unprotected endpoint: NOT annotated with Idempotent. Even if an Idempotency-Key header is provided, this endpoint is NOT intercepted by the filter.
      Parameters:
      request - the payment request payload
      Returns:
      a response containing the processing outcome
    • getProcessCount

      @GET @Path("/count") public jakarta.ws.rs.core.Response getProcessCount()
      Returns the current number of processed payment requests.
      Returns:
      a response containing the process count
    • resetCount

      @POST @Path("/reset") public jakarta.ws.rs.core.Response resetCount()
      Resets the sample resource's processing counter.
      Returns:
      an empty success response