Package net.devh.boot.grpc.common.util
Class GrpcUtils
java.lang.Object
net.devh.boot.grpc.common.util.GrpcUtils
Utility class that contains methods to extract some information from grpc classes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The cloud discovery metadata key used to identify the grpc port.static final String
The cloud discovery metadata key used to identify service config.static final String
A constant that defines, the scheme prefix of a Unix domain socket address.static final String
A constant that defines, the scheme of a Unix domain socket address.static final int
The constant for the grpc server port, -1 represents don't start an inter process server. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
extractDomainSocketAddressPath
(String address) Extracts the domain socket address specific path from the given full address.static String
extractMethodName
(MethodDescriptor<?, ?> method) Extracts the method name from the given method.static String
extractServiceName
(MethodDescriptor<?, ?> method) Extracts the service name from the given method.
-
Field Details
-
DOMAIN_SOCKET_ADDRESS_SCHEME
A constant that defines, the scheme of a Unix domain socket address.- See Also:
-
DOMAIN_SOCKET_ADDRESS_PREFIX
A constant that defines, the scheme prefix of a Unix domain socket address.- See Also:
-
CLOUD_DISCOVERY_METADATA_PORT
The cloud discovery metadata key used to identify the grpc port.- See Also:
-
CLOUD_DISCOVERY_METADATA_SERVICE_CONFIG
The cloud discovery metadata key used to identify service config.- See Also:
-
INTER_PROCESS_DISABLE
public static final int INTER_PROCESS_DISABLEThe constant for the grpc server port, -1 represents don't start an inter process server.- See Also:
-
-
Method Details
-
extractDomainSocketAddressPath
Extracts the domain socket address specific path from the given full address. The address must fulfill the requirements as specified by grpc.- Parameters:
address
- The address to extract it from.- Returns:
- The extracted domain socket address specific path.
- Throws:
IllegalArgumentException
- If the given address is not a valid address.
-
extractServiceName
Extracts the service name from the given method.- Parameters:
method
- The method to get the service name from.- Returns:
- The extracted service name.
- See Also:
-
extractMethodName
Extracts the method name from the given method.- Parameters:
method
- The method to get the method name from.- Returns:
- The extracted method name.
- See Also:
-