Interface RpcInvocationListener

All Superinterfaces:
Serializable

@Deprecated(since="25.3", forRemoval=true) public interface RpcInvocationListener extends Serializable
Deprecated, for removal: This API element is subject to removal in a future version.
add listeners for RpcInvocationStartedEvent, RpcInvocationFailedEvent and RpcInvocationEndedEvent on the service event bus instead. The callbacks of this listener are served by those events, one instance each, so an implementation that correlates the callbacks of an invocation has to do so through the thread they are delivered on rather than through the identity of the event
Listener that is notified around the server-side handling of individual client-to-server RPC invocations, enabling per-invocation observation (for example to emit a tracing span showing which DOM event, synchronized property or @ClientCallable method is consuming the time spent holding the session lock while processing a request).

A single client request typically carries several invocations; the listener is notified once per invocation. invocationStarted(com.vaadin.flow.server.communication.RpcInvocationEvent), invocationFailed(com.vaadin.flow.server.communication.RpcInvocationEvent, java.lang.Throwable) (only when the handler threw) and invocationEnded(com.vaadin.flow.server.communication.RpcInvocationEvent) for one invocation are delivered on the same thread, in that order, with invocationEnded always delivered after invocationStarted regardless of outcome, so a listener may keep timing state in a ThreadLocal. See AbstractRpcInvocationEvent for which invocations are reported, what a synchronized property update reports, and how the notifications of concurrent requests relate.

Implementations must be fast and non-blocking: callbacks run on the request thread directly around invocation handling. Exceptions thrown from a callback are logged and suppressed so they cannot disrupt RPC processing.

Register via VaadinService.addRpcInvocationListener(RpcInvocationListener), typically from a VaadinServiceInitListener.

Since:
25.2
See Also:
  • Method Details

    • invocationStarted

      default void invocationStarted(RpcInvocationEvent event)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Invoked on the request thread immediately before an RPC invocation is handled.
      Parameters:
      event - the invocation event
    • invocationFailed

      default void invocationFailed(RpcInvocationEvent event, Throwable error)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Invoked on the request thread when handling an invocation threw, before invocationEnded(com.vaadin.flow.server.communication.RpcInvocationEvent). The framework routes the throwable to the session error handler independently of this callback.
      Parameters:
      event - the invocation event
      error - the throwable raised by the invocation handler
    • invocationEnded

      default void invocationEnded(RpcInvocationEvent event)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Invoked on the request thread once an RPC invocation has been handled, whether it completed normally or threw.
      Parameters:
      event - the invocation event