Class HttpRequestTerminatedEvent

java.lang.Object
java.util.EventObject
io.micronaut.context.event.ApplicationEvent
io.micronaut.http.context.event.HttpRequestTerminatedEvent
All Implemented Interfaces:
Serializable

public class HttpRequestTerminatedEvent extends ApplicationEvent
An event fired when an HttpRequest is finalized by the server, once the server is done with the request (the response has been handed to the transport, which does not mean it was delivered, or the request was discarded). Consumers of the event should generally not perform I/O, instead this is designed for tracing of headers, URI etc.

Listeners are invoked on the thread the server selects for request handling, which with the default micronaut.server.thread-selection (MANUAL, and also with AUTO) is the Netty event loop of the connection. A listener that blocks or does slow work delays every other connection on that event loop. Listeners that need to block must hand off, for example with @Async on the @EventListener method, or the server can be configured with micronaut.server.thread-selection=BLOCKING which moves the listeners (and controllers) off the event loop.

Since:
1.2.0
Author:
graemerocher
See Also:
  • Constructor Details

    • HttpRequestTerminatedEvent

      public HttpRequestTerminatedEvent(HttpRequest<?> request)
      Parameters:
      request - The request. Never null.
  • Method Details