Package com.linecorp.armeria.spring
Class GrpcServiceRegistrationBean
java.lang.Object
com.linecorp.armeria.spring.AbstractServiceRegistrationBean<HttpServiceWithRoutes,GrpcServiceRegistrationBean,GrpcExampleRequest,GrpcExampleHeaders>
com.linecorp.armeria.spring.GrpcServiceRegistrationBean
public class GrpcServiceRegistrationBean extends AbstractServiceRegistrationBean<HttpServiceWithRoutes,GrpcServiceRegistrationBean,GrpcExampleRequest,GrpcExampleHeaders>
A bean with information for registering a gRPC service.
It enables Micrometer metric collection of the service automatically.
> @Bean
> public GrpcServiceRegistrationBean helloService() {
> return new GrpcServiceRegistrationBean()
> .setServiceName("helloService")
> .setService(GrpcService.builder()
> .addService(new HelloService())
> .supportedSerializationFormats(GrpcSerializationFormats.values())
> .enableUnframedRequests(true)
> .build())
> .setDecorators(LoggingService.newDecorator())
> .addExampleRequests(GrpcExampleRequest.of(
> HelloServiceGrpc.SERVICE_NAME, "Hello",
> HelloRequest.newBuilder().setName("Armeria").build()))
> .addExampleHeaders(GrpcExampleHeaders.of(HelloServiceGrpc.SERVICE_NAME,
> HttpHeaders.of("my-header", "headerVal")));
> }
-
Constructor Summary
Constructors Constructor Description GrpcServiceRegistrationBean()
-
Method Summary
Modifier and Type Method Description GrpcServiceRegistrationBean
addExampleHeaders(String serviceName, HttpHeaders exampleHeaders)
Adds an example HTTP header for all service methods.GrpcServiceRegistrationBean
addExampleHeaders(String serviceName, CharSequence name, String value)
Adds an example HTTP header for all service methods.GrpcServiceRegistrationBean
addExampleHeaders(String serviceName, String methodName, @NotNull HttpHeaders... exampleHeaders)
Adds example HTTP headers for the specified method.GrpcServiceRegistrationBean
addExampleHeaders(String serviceName, String methodName, @NotNull Iterable<? extends HttpHeaders> exampleHeaders)
Adds example HTTP headers for the specified method.GrpcServiceRegistrationBean
addExampleHeaders(String serviceName, String methodName, HttpHeaders exampleHeaders)
Adds an example HTTP header for the specified method.GrpcServiceRegistrationBean
addExampleHeaders(String serviceName, String methodName, CharSequence name, String value)
Adds an example HTTP header for the specified method.GrpcServiceRegistrationBean
addExampleRequests(String serviceName, String methodName, Object exampleRequest)
Adds an example request forAbstractServiceRegistrationBean.getService()
.Methods inherited from class com.linecorp.armeria.spring.AbstractServiceRegistrationBean
addExampleHeaders, addExampleHeaders, addExampleHeaders, addExampleRequests, addExampleRequests, addExampleRequests, getDecorators, getExampleHeaders, getExampleRequests, getService, getServiceName, setDecorators, setDecorators, setExampleHeaders, setExampleHeaders, setExampleHeaders, setExampleRequests, setExampleRequests, setExampleRequests, setService, setServiceName
-
Constructor Details
-
GrpcServiceRegistrationBean
public GrpcServiceRegistrationBean()
-
-
Method Details
-
addExampleRequests
public GrpcServiceRegistrationBean addExampleRequests(String serviceName, String methodName, Object exampleRequest)Adds an example request forAbstractServiceRegistrationBean.getService()
. -
addExampleHeaders
public GrpcServiceRegistrationBean addExampleHeaders(String serviceName, HttpHeaders exampleHeaders)Adds an example HTTP header for all service methods. -
addExampleHeaders
public GrpcServiceRegistrationBean addExampleHeaders(String serviceName, CharSequence name, String value)Adds an example HTTP header for all service methods. -
addExampleHeaders
public GrpcServiceRegistrationBean addExampleHeaders(String serviceName, String methodName, CharSequence name, String value)Adds an example HTTP header for the specified method. -
addExampleHeaders
public GrpcServiceRegistrationBean addExampleHeaders(String serviceName, String methodName, HttpHeaders exampleHeaders)Adds an example HTTP header for the specified method. -
addExampleHeaders
public GrpcServiceRegistrationBean addExampleHeaders(String serviceName, String methodName, @NotNull @NotNull Iterable<? extends HttpHeaders> exampleHeaders)Adds example HTTP headers for the specified method. -
addExampleHeaders
public GrpcServiceRegistrationBean addExampleHeaders(String serviceName, String methodName, @NotNull @NotNull HttpHeaders... exampleHeaders)Adds example HTTP headers for the specified method.
-