You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-grpc-docs/src/main/antora/modules/ROOT/pages/server.adoc
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,3 +143,15 @@ You can use this option if you want to add a per-service interceptor between glo
143
143
Spring gRPC provides an autoconfigured interceptor that can be used to provide observability to your gRPC services.
144
144
All you need to do is add Spring Boot actuators to your project, and optionally a bridge to your observability platform of choice (just like https://docs.spring.io/spring-boot/reference/actuator/observability.html[any other Spring Boot application]).
145
145
The `grpc-tomcat` sample in the Spring gRPC repository shows how to do it, and you should see trace logging and metrics when you connect to the server.
146
+
147
+
== Exception Handling
148
+
149
+
Spring gRPC provides an autoconfigured exception handler that can be used to provide a consistent way to handle exceptions in your gRPC services.
150
+
All you need to do is add `@Beans` of type `GrpcExceptionHandler` to your application context, and they will be used to handle exceptions thrown by your services.
151
+
A `GrpcExceptionHandler` can be used to handle exceptions of a specific type, returning null for those it does not support, or to handle all exceptions.
152
+
153
+
== Testing
154
+
155
+
If you include `spring-grpc-test` in your project, your gRPC server in a `@SpringBootTest` will be started in-process (i.e. not listening on a network port).
156
+
All clients that connect to any server via the autoconfigured `GrpcChannelFactory` will be able to connect to it.
157
+
You can switch the in-process server off by setting `spring.grpc.in-process.enabled` to `false`.
0 commit comments