Class PushController


@Requires(beans=PushControllerConfiguration.class) @Requires(classes=io.micronaut.http.annotation.Controller.class) @Controller("${gcp.pubsub.push.path:/push}") public class PushController extends Object
A Controller implementation for handling PubSub Push JSON messages.

If push message handling is enabled, and the required HTTP dependencies are available on the classpath, this controller will handle all incoming push messages via a single URL path. The default path is /push. This is the path that should be configured in the GCP PubSub service.

The incoming JSON messages contain metadata about the subscription from which they originated, and they will be routed to the corresponding PushSubscription method for the subscription.

Jeremy Grelle
  • Constructor Details

    • PushController

      public PushController(PushSubscriberHandler handler)
      Constructor for the push controller.
      handler - the handler that implements processing of the incoming message
  • Method Details

    • handlePushRequest

      @Post(consumes="application/json") @SingleResult public CompletableFuture<io.micronaut.http.MutableHttpResponse<Object>> handlePushRequest(@Valid @Body @Valid PushRequest message)
      Handle incoming PubSub Push messages by deserializing them from their specified JSON format and forwarding the deserialized message to the configured PushSubscriberHandler. Validation is applied to the incoming message to ensure that it conforms to the format specified by GCP.
      message - the incoming pub sub push request message
      an HTTP response to indicate ack or nack of the message to the PubSub service