Grpc
Available in a dev version: 0․11․0-grpc-186
How to configure
@Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.TYPE_PARAMETER] )
Marks an interface as a gRPC service definition.
The annotation supports customizing the gRPC service name and package used in the protocol. By default, the service name is derived from the interface name and the package from the Kotlin package.
Example:
@Grpc(protoPackage = "com.example.api", protoServiceName = "RpcUserService")
interface UserService {
suspend fun getUser(request: GetUserRequest): User
@Grpc.Method(name = "CustomName", safe = true, idempotent = true)
suspend fun searchUsers(query: SearchQuery): SearchResults
}Content copied to clipboard
See also
Types
Properties
Link copied to clipboard
The Protocol Buffers package name for this service. If empty (default), the Kotlin package name is used. This affects the fully qualified service name in gRPC (e.g., "com.example.api.RpcUserService").
Link copied to clipboard
The Protocol Buffers service name. If empty (default), the interface name is used. Useful when the service name in the proto definition differs from the Kotlin interface name, such as when multiple client/server interfaces map to the same proto service.