Skip to content

Commit ac51476

Browse files
committed
Add docs for inprocess server and channel factories
Signed-off-by: Chris Bono <[email protected]>
1 parent 171f255 commit ac51476

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

spring-grpc-docs/src/main/antora/modules/ROOT/pages/client.adoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ dependencies {
131131
}
132132
----
133133

134+
[[in-process-channel]]
135+
== InProcess Channel
136+
You can communicate with an link:server.adoc#in-process-server[in-process server factory] (i.e. not listening on a network port) by including the `io.grpc.grpc-inprocess` dependency on your classpath.
137+
138+
In this mode, the in-process channel factory is auto-configured in *addition* to the regular channel factories (e.g. Netty).
139+
However, to prevent users from having to deal with multiple channel factory, a composite channel factory has been introduced which consults its composed factories to find the first one that supports the channel target.
140+
141+
NOTE: To use the inprocess server the channel target must be set to `in-process://<in-process-name>`
142+
143+
To disable the inprocess channel factory, you can set the `spring.grpc.client.inprocess.enabled` property to false.
144+
134145
== Channel Configuration
135146
The channel factory provides an API to create channels.
136147
The channel creation process can be configured as follows.
@@ -332,4 +343,4 @@ private String token(ClientRegistration reg) {
332343
.getTokenValue();
333344
return token;
334345
}
335-
----
346+
----

spring-grpc-docs/src/main/antora/modules/ROOT/pages/server.adoc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ The native gRPC server (with netty etc.) will run happily inside a web applicati
9292
If you want to do that in any Spring Boot application, it should be sufficient *not* to include the `grpc-servlet-jakarta` dependency on your classpath.
9393
This dependency is only provided by the `spring-grpc-server-web-spring-boot-starter` (or if you include it explicitly yourself), but if you need to be explicit you can set `spring.grpc.server.servlet.enabled=false` in your application configuration.
9494

95+
[[in-process-server]]
96+
== InProcess Server
97+
98+
You can run an in-process server (i.e. not listening on a network port) by including the `io.grpc.grpc-inprocess` dependency on your classpath and specifying the `spring.grpc.server.inprocess.name` property which is used as the identity of the server for clients to connect to.
99+
100+
In this mode, the in-process server factory is auto-configured in *addition* to the regular server factory (e.g. Netty).
101+
102+
NOTE: To use the inprocess server the channel target must be set to `in-process://<in-process-name>`
103+
104+
95105
[[server-interceptor]]
96106
== Server Interceptors
97107

@@ -159,7 +169,10 @@ A `GrpcExceptionHandler` can be used to handle exceptions of a specific type, re
159169

160170
If you include `spring-grpc-test` in your project, your gRPC server in a `@SpringBootTest` can be started in-process (i.e. not listening on a network port) by enabling the in-process server.
161171
All clients that connect to any server via the autoconfigured `GrpcChannelFactory` will be able to connect to it.
162-
You can switch the in-process server on by setting `spring.grpc.inprocess.enabled` to `true` or by adding the `@AutoConfigureInProcessTransport` annotation to your `@SpringBootTest` class.
172+
You can switch the in-process server on by setting `spring.grpc.test.inprocess.enabled` to `true` or by adding the `@AutoConfigureInProcessTransport` annotation to your `@SpringBootTest` class.
173+
174+
NOTE: When the in-process server is run in test mode (as opposed to <<in-process-server,running normally>>) it replaces the regular server and channel factories (e.g. Netty)
175+
163176

164177
== Security
165178

0 commit comments

Comments
 (0)