Class GrpcMessageSizeInterceptor
java.lang.Object
org.axonframework.axonserver.connector.util.GrpcMessageSizeInterceptor
- All Implemented Interfaces:
io.grpc.ClientInterceptor
Interceptor around a gRPC request that checks whether the message size is within the limits of the server.
This is done for both outbound and inbound messages.
If an outbound message exceeds the maximum message size, a GrpcMessageSizeExceededException is thrown.
Then, if the message's size exceeds the warning threshold, a warning is logged with a stack trace to debug the issue.
Inbound messages are only logged as warnings if they exceed the warning threshold.
When during initialization, the message size is greater than the default configuration of Axon Server, we inform the user that this can cause issues if they don't increase the maximum message size on the server.
The performance overhead of this interceptor is minimal, as it uses a simple check that GRPC does while sending the message anyway.
- Since:
- 4.11.0
- Author:
- Mitchell Herrijgers
-
Constructor Summary
ConstructorsConstructorDescriptionGrpcMessageSizeInterceptor(int maxMessageSizeInBytes, double maxMessageSizeWarningPercentage) -
Method Summary
Modifier and TypeMethodDescription<REQ,RESP>
io.grpc.ClientCall<REQ, RESP> interceptCall(io.grpc.MethodDescriptor<REQ, RESP> methodDescriptor, io.grpc.CallOptions callOptions, io.grpc.Channel channel)
-
Constructor Details
-
GrpcMessageSizeInterceptor
public GrpcMessageSizeInterceptor(int maxMessageSizeInBytes, double maxMessageSizeWarningPercentage)
-
-
Method Details
-
interceptCall
public <REQ,RESP> io.grpc.ClientCall<REQ,RESP> interceptCall(io.grpc.MethodDescriptor<REQ, RESP> methodDescriptor, io.grpc.CallOptions callOptions, io.grpc.Channel channel) - Specified by:
interceptCallin interfaceio.grpc.ClientInterceptor
-