Cristian Nicolas Gonzalez
04/15/2022, 10:25 PM@io.grpc.stub.annotations.GrpcGenerated
^
symbol: class GrpcGenerated
location: package io.grpc.stub.annotations
Júlio Santos
05/12/2022, 1:12 AMgrpc-kotlin
for web projects?taer
06/24/2022, 9:36 PMtaer
06/24/2022, 9:38 PMdavec
06/27/2022, 9:03 PMval request = rectangle {
lo = point(lowLat, lowLon)
hi = point(hiLat, hiLon)
}
var i = 1
stub.listFeatures(request).
☝️ that looks easy in theory but try it with a nontrivial request and it becomes near impossible to come up with the right syntax. Seems like sometimes things are a "DSL code block" and other time they're done like constructors? It would be nice if I could just construct the request like a data class
instead of all this stuffdavec
06/27/2022, 9:05 PMmessage DateRange {
// The beginning of the date range
google.type.Date from = 1 [(validate.rules).message.required = true];
// The end of the date range
google.type.Date until = 2 [(validate.rules).message.required = true];
}
David Reedy
07/09/2022, 7:27 AMDavid Reedy
07/09/2022, 7:27 AMdavec
07/11/2022, 7:20 PMgradlew bootJar
). Can build, run, everything works fine.davec
07/11/2022, 7:20 PMdavec
07/27/2022, 2:57 PMdavec
07/27/2022, 2:59 PMAkram Bensalem
09/12/2022, 2:17 PMsarvagya agarwal
09/25/2022, 8:53 PMmessage File {
bytes file_bytes = 1;
}
message Response {
string some_response = 1;
}
Service UploadService {
rpc uploadFiles(stream File) returns Response;
}
How can I define a service that takes List of Files as a parameter ? The above is fine for a single file.Thomas Cesare-Herriau
09/29/2022, 10:40 PMgrpc-kotlin
wrapper to grpc-java
already supports setting Deadlines on Client Stubs (using the withDeadline function), however there is no "Kotlin coroutine" equivalent to the io.grpc.Context#withDeadline function that allows wrapping any operation into a Cancellable context with a deadline (a deadline that is then propagated to all gRPC client stubs within the operation!).
The problem is that the io.grpc.Context#withDeadline
API requires using a ScheduledExecutorService
, which as I understand it, would require bypassing Kotlin coroutine architecture. An alternative is to use `withTimeout`: however this results in 2 separate contextual timeouts (the withTimeout
one and a potential propagated gRPC Deadline in the context)
Has anyone here had to set server-side deadlines/timeouts in the past (in the context of gRPC servers)? If so, what approach have you used?Endre Deak
09/30/2022, 3:22 PMbuild/extracted-include-protos
folder? I do see the healthcheck proto there, but not sure how to put that next to my own protos to be generated.sarvagya agarwal
10/13/2022, 9:45 AMval chunk = ByteArray(BYTE_ARRAY_SIZE)
val inputStream = FileInputStream(file)
val fileChunks = flow {
val metadata = MetaData.newBuilder()
.setPath(file.path)
.setConvertToPdf(BoolValue.of(convertToPdf))
.build()
emit(FileUploadRequest.newBuilder().setMetadata(metadata).build())
// It works if i dont break the file into chunks
// val fileChunk = FileChunk.newBuilder().setData(ByteString.copyFrom(byteArray)).build()
// emit(FileUploadRequest.newBuilder().setContent(fileChunk).build())
while(true) {
val size = inputStream.read(chunk)
if(size <= 0) break
val fileChunk = FileChunk.newBuilder()
.setData(ByteString.copyFrom(chunk, 0, size)).build()
emit(FileUploadRequest.newBuilder().setContent(fileChunk).build())
}
}
On the server side , i reconstruct the file and process it , the file is constructed properly if i send it all at once instead of breaking it down into smaller chunks. Not sure how to debug this either , does anyone have any idea what i am doing wrong ?
requests.collect {
if (it.hasContent()) {
file.writeBytes(it.content.toByteArray())
} else {
metadata = it.metadata
file = File(metadata.path)
}
}
xuemin.guan
11/07/2022, 7:48 PMAgustin Bonilla
12/16/2022, 3:43 PMgrpc-kotlin-stub
. As a limitation on my side, I can only add those dependencies on AAR or JAR files.
I have found and added the grpc-kotlin-stub
JAR, but when I run my app I’m having the following error:
“Java.Lang.NoClassDefFoundError: Failed resolution of: Lio/grpc/kotlin/AbstractCoroutineStub”
It looks like haven’t found the class AbstractCoroutineStub
that if I’m right, it should be in the grpc-kotlin-stub
JAR.
Does anyone know why it isn’t finding the class AbstractCoroutineStub
?
Is there a grpc-kotlin-stub
AAR version to try?Andrés Romero
01/25/2023, 6:41 PMperformAction()
which is a unary RPC. I want to notify the other users with information about that action. I would expect those members to be subscribed to another long-living RPC that facilitates sending that information.
Do you have any examples of how can achieve that in Kotlin? I was looking into something like:
https://dev.bitolog.com/grpc-long-lived-streaming/
https://sultanov.dev/blog/grpc-long-lived-streaming-using-observer-pattern/
But those implementations are written in Go and Java, and I'm struggling to find examples in KotlinFrancis Reynders
03/25/2023, 10:38 AMChannelFlow
. A request/response request from the server -> client could then be initiated by an async coroutine launch that sends the payload with correlation id to the channel and listens with timeout for a respone on a SharedChannel
flow (client->server stream), listening for the first response with that correlation id. Would that work?
Thank youMinsoo Cheong
04/02/2023, 4:20 PMJacob K
05/05/2023, 11:05 AMGrpcContextElement
https://github.com/grpc/grpc-kotlin/blob/master/stub/src/main/java/io/grpc/kotlin/GrpcContextElement.kt#L27
It's seems as the initial GrpcContextElement
is created when the server-call is created, and that it is supposed to rely on kotlins coroutine system to ensure the context is available on the current thread (used by the coroutine). But once I create a new context with Context.current().withValue(...)
and pass it on with Contexts.interceptCall(...)
I worry that this newly created context doesn't "inherit" that coroutine specific logic.
The current interceptor looks something like this:
data class DebugInfo(val enabled: Boolean, var debugCtx: DebugContext?)
val DEBUG_KEY = Context.key<DebugInfo>("debug-info")
val DEBUG_INFO_CTX =
Metadata.Key.of(
"x-debug-info-ctx${Metadata.BINARY_HEADER_SUFFIX}",
ProtoUtils.metadataMarshaller(DebugContext.getDefaultInstance()))
class DebugInfoInterceptor : ServerInterceptor {
override fun <ReqT : Any?, RespT : Any?> interceptCall(
call: ServerCall<ReqT, RespT>,
headers: Metadata,
next: ServerCallHandler<ReqT, RespT>
): ServerCall.Listener<ReqT> {
val debug = headers.get(DEBUG_HEADER)?.let { it == "true" } ?: false
val debugInfo = DebugInfo(debug, null)
val debugInfoContext = Context.current().withValue(DEBUG_KEY, debugInfo)
val debugInfoCall =
object : ForwardingServerCall.SimpleForwardingServerCall<ReqT, RespT>(call) {
override fun close(status: Status, trailers: Metadata) {
debugInfo.debugCtx?.let { trailers.put(DEBUG_INFO_CTX, it) }
super.close(status, trailers)
}
}
return Contexts.interceptCall(debugInfoContext, debugInfoCall, headers, next)
}
}
and the corresponding server stub:
class SomeService() : SomeServiceGrpcKt.SomeServiceCoroutineImplBase() {
override suspend fun someRpc(request: SomeRequest): SomeResponse {
//
// do suspending stuff
//
val debugInfo = DEBUG_KEY.get()
if (debugInfo.enabled) {
debugInfo.debugCtx = DebugContext.newBuilder().setSomething().build()
}
return SomeResponse().build()
}
}
I'v been digging through the source but I can't convince myself that this is safe 😉Júlio Santos
06/05/2023, 5:45 PMJorge Viana
07/28/2023, 2:14 PMAli
09/22/2023, 10:30 AMe: com.squareup.anvil.compiler.api.AnvilCompilationException: Back-end (JVM) Internal error: Couldn't resolve FqName com.google.protobuf.kotlin.ProtoDslMarker for Psi element: com.google.protobuf.kotlin.ProtoDslMarker
Alseddnm
02/08/2024, 3:08 PMColton Idle
02/27/2024, 7:27 PMEgYIARABGAIaILk8CE7/WHIslvUnsNk+ZYNVF0XTTwCQzAD8xqk7K81G
through a protobuf deserializer? I guess i have the proto file so it should be possible? https://github.com/tink-crypto/tink-java/blob/main/proto/tink.protoMinsoo Cheong
03/07/2024, 8:54 AMDavid
08/02/2024, 2:19 PMTransientFailure
on Connecting. After setting up maxTraceEvent
we see the following:
ManagementService connection state: Connecting
[{0}] Failed to resolve name. status={1}
ManagementService connection state: TransientFailure
[{0}] Failed to resolve name. status={1}
ManagementService connection state: Connecting
ManagementService connection state: Ready
Any ideas why we would get Failed to resolve name
?