Server Events
This section describes how you can subscribe to events related to the grpc server.
Table of Contents
Additional Topics
- Getting Started
- Configuration
- Exception Handling
- Contextual Data / Scoped Beans
- Testing the Service
- Server Events
- Security
Event Overview
GrpcServerLifecycleEvent
Abstract base class for all events related to GrpcServerLifecycle
changes.
GrpcServerStartedEvent
This event will be fired after the server has been started.
GrpcServerShutdownEvent
This event will be fired before the server starts to shutdown. The server will no longer process new requests.
GrpcServerTerminatedEvent
This event will be fired after the server completed to shutdown. The server will no longer process requests.
Subscribing to Events
In order to subscribe to any of these events you can just use the @EventListener
annotation on a public method
in any of your @Component
s.
@Component
public class MyEventListenerComponent {
@EventListener
public void onServerStarted(GrpcServerStartedEvent event) {
System.out.println("gRPC Server started, listening on address: " + event.getAddress() + ", port: " + event.getPort());
}
}
Additional Topics
- Getting Started
- Configuration
- Exception Handling
- Contextual Data / Scoped Beans
- Testing the Service
- Server Events
- Security