https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
grpc
  • e

    Eben Du Toit

    03/03/2020, 8:17 AM
    Hi, I wanted to find out if any of you guys know what the status is of gRPC for kotlin #multiplatform?
    s
    • 2
    • 1
  • j

    jimn

    03/18/2020, 7:24 AM
    it looks like the google grpc kotlin examples are using a different plugin hierarchy from a medium article that has a "kotlin-grpc-plugin" and if i want to get an idea of the samples i should ... run a shellscript?
    s
    • 2
    • 6
  • a

    asad.awadia

    03/18/2020, 10:13 PM
    @jimn what are you trying to do? Compile protos? Call a grpc service?
    j
    • 2
    • 3
  • g

    Gary

    04/05/2020, 2:30 AM
    Looks like grpc Kotlin finally getting some love https://github.com/grpc/grpc-kotlin Coroutine stubs: https://github.com/grpc/grpc-kotlin/tree/master/examples/src/main/kotlin/io/grpc/examples/routeguide/RouteGuideServer.kt
    s
    • 2
    • 1
  • a

    asad.awadia

    04/17/2020, 5:08 PM
    Happening rn
    g
    • 2
    • 1
  • a

    asad.awadia

    04/21/2020, 11:09 PM
    @Gary and for anyone else who missed it https://www.cncf.io/webinars/announcing-open-source-grpc-kotlin/
    ❤️ 1
    g
    • 2
    • 1
  • d

    Dariusz Kuc

    05/15/2020, 9:59 PM
    hello! are there any suggestions for grpc client? e.g. looks like https://github.com/yidongnan/grpc-spring-boot-starter is pretty popular but wondering if there is something better
    g
    • 2
    • 7
  • d

    Dariusz Kuc

    06/02/2020, 8:43 PM
    hello! trying to work around https://github.com/grpc/grpc-kotlin/issues/66 with setting up MDC from GRPC context -> while searching online it looks all examples point to GO
    metadata.FromIncomingContext
    . Does anyone know if there is similar function for Kotlin/Java?
    • 1
    • 2
  • d

    Dariusz Kuc

    07/06/2020, 6:51 PM
    btw you can also use https://github.com/marcoferrer/kroto-plus to generate nice Kotlin DSL style builders
    b
    • 2
    • 1
  • s

    Sergey Skaredov

    12/09/2020, 4:12 PM
    hi! is there a way in grpc-kotlin to customize the worker coroutine name on client side?
    "SendMessage worker for ${method.fullMethodName}"
    seems overkill
    d
    • 2
    • 1
  • d

    Dariusz Kuc

    02/10/2021, 11:28 PM
    Hello 👋 Anyone knows whether it is possible to limit which
    .proto
    files are going to be extracted by the protobuf plugin? i.e. configure
    extractIncludeProto
    task to exclude certain files?
    f
    • 2
    • 1
  • m

    Mark Allanson

    04/30/2021, 7:33 AM
    Has anyone developed a nice way of wrapping the generated java builders to make things a bit nicer in kotlin? At the moment we are doing
    val message = with(MyMessage.newBuilder()) {
        someField = 1
        build()
    }
    I was thinking it would be nicer to do something like....
    val message = build(MyMessage) {
       someField = 1
    }
    ... but my Kotlin isn't good enough to be able to write that build function yet 😄
    d
    m
    • 3
    • 6
  • d

    Dariusz Kuc

    06/10/2021, 8:29 PM
    Hello 👋 Was just wondering how do you structure your protobuf repos? Based on some articles [1][2] and stack overflow questions looks like people are leaning towards a monorepo approach but that also means that there is a potential disconnect between the schema and actual server implementation (which can run using older definitions). Guess that it is probably less troublesome than the alternatives....
    m
    • 2
    • 13
  • m

    Marc Plano-Lesay

    10/13/2021, 10:19 AM
    Maybe give some thoughts to a monorepo approach, if that's an option
    k
    • 2
    • 2
  • f

    Fleshgrinder

    10/30/2021, 3:42 PM
    Has anyone worked with the new option to generate Kotlin code in Protobuf? Any impressions on it? I just looked at their docs and it looks rather weird, going to generate some code soon to check it out, but, yeah, looks weird, just like the Java code looks weird too. 😞
    m
    • 2
    • 1
  • t

    Tomasz Krakowiak

    11/04/2021, 5:57 AM
    Are there here right people to tell them, that I would love gRPC for koltin-multiplatform? I have frontend running on node.js and backend on jvm.
    s
    • 2
    • 1
  • m

    Marc Plano-Lesay

    11/04/2021, 6:57 AM
    The best place to start a discussion on that would most likely be the grpc-kotlin GitHub issues (edit: there's already one: https://github.com/grpc/grpc-kotlin/issues/51)
    :thank-you: 1
    s
    • 2
    • 1
  • j

    Johann Pardanaud

    01/06/2022, 9:57 AM
    Hi! I'm pretty knew to Kotlin coroutines and gRPC, my server code is generated with grpc/grpc-kotlin and I struggle a bit to understand how I can even use the first coroutine explained in Kotlin's documentation in my gRPC server. Say I have the following server method (from the Kotlin gRPC Quick start):
    private class HelloWorldService : GreeterGrpcKt.GreeterCoroutineImplBase() {
        override suspend fun sayHello(request: HelloRequest) = helloReply {}
    }
    And I want to write the following code at the beginning of this method (from Kotlin's documentation):
    launch {
        delay(1000L)
        println("World!")
    }
    println("Hello")
    If I simply copy-paste this code in my method,
    launch
    isn't recognized as a valid method because it should by used on a coroutine scope. If I wrap my code with a
    coroutineScope
    like this:
    override suspend fun sayHello(request: HelloRequest) = coroutineScope {
        launch {
            delay(1000L)
            println("World!")
        }
        println("Hello")
    
        helloReply {}
    }
    It builds, the code is even executed when I make a call from the client, however the server returns an
    UNKNOWN
    code before the
    launch
    job can even finish and the
    HelloReply
    is not used. So I think I shouldn't create my own coroutine scope and I should use a scope already defined by the server, but I don't find anything related to a "default gRPC coroutine scope" in the API reference. I must be missing something really obvious, can someone help me run this really basic code please? 🙏
    a
    j
    • 3
    • 7
  • c

    Cristian Nicolas Gonzalez

    04/15/2022, 10:25 PM
    Hi! Does someone have a minimal setup to gradle kotlin grpc? I tried this https://github.com/grpc/grpc-kotlin/blob/master/compiler/README.md but it doesn’t work because it miss coroutines depedency and also I have this error
    @io.grpc.stub.annotations.GrpcGenerated
    ^
    symbol:   class GrpcGenerated
    location: package io.grpc.stub.annotations
    d
    k
    d
    • 4
    • 7
  • j

    Júlio Santos

    05/12/2022, 1:12 AM
    Guys, can I use the lib
    grpc-kotlin
    for web projects?
    j
    d
    • 3
    • 2
  • t

    taer

    06/24/2022, 9:36 PM
    Hey y'all. I notice the stubs generated have the headers as an optional parameter to the service method. I really want to send response headers/trailers from the stub code. It seems like the way is via interceptors and threadlocals and coroutineContexts so that mutable things in the threadlocal get updated. That seems really painful to just add a response header. Am I missing something to have my stubbs return a Pair of <RESP, Metadata> ?
  • t

    taer

    06/24/2022, 9:38 PM
    I did the threadlocal version. I added an AtmonicReference<String> as a threadLocal/contextElement. In the stubb, I get the Threadlocal and set the value. In the interceptor, I get the threadLocal then get the value and set it. But.. That's a lot of pain, and I'm not even sure the "post interceptor" is even running on the same thread after the "stub service method" runs.
    m
    • 2
    • 3
  • d

    davec

    06/27/2022, 9:03 PM
    Is there any decent documentation on how to create a gRPC request? It seems like everything uses the DSL stuff which I can't find any documentation for and isn't particularly intuitive:
    val 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 stuff
    d
    e
    • 3
    • 6
  • d

    davec

    06/27/2022, 9:05 PM
    as an example how would I build this?
    message 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];
    }
    d
    m
    • 3
    • 11
  • d

    David Reedy

    07/09/2022, 7:27 AM
    Hi @everybody
  • d

    David Reedy

    07/09/2022, 7:27 AM
    Anyone have experience with Kotlin-gRPC?
    • 1
    • 1
  • d

    davec

    07/11/2022, 7:20 PM
    Question: right now my application (which includes gRPC code) builds fine from the command-line (
    gradlew bootJar
    ). Can build, run, everything works fine.
  • d

    davec

    07/11/2022, 7:20 PM
    Yet IntelliJ is showing compile errors for some of the generated gRPC code. Has anyone experienced this?
    d
    • 2
    • 5
  • d

    davec

    07/27/2022, 2:59 PM
    If this is true, all the fields in the data model are platform types, which means no null safety unless you explicitly cast each one of them to a nullable type -- which is pretty bad for null safety. If Java is what's generated it would be nice if it at least marked everything nullable with an annotation (https://kotlinlang.org/docs/java-interop.html#nullability-annotations) just so Kotlin has some idea what to do. Ideally it would be nice if it actually generated Kotlin instead of Java; maybe it does but I'm not seeing it?
    m
    j
    j
    • 4
    • 7
  • a

    Akram Bensalem

    09/12/2022, 2:17 PM
    I want to add protobuf to my kotlin multiplatform project that contain "Android and Desktop" so it's JVM only the plugin by default compiles protobuf source from "src/main/proto" rather than "src/commonMain/proto" Do you know how to fix that issue ?
    m
    • 2
    • 1
Powered by Linen
Title
a

Akram Bensalem

09/12/2022, 2:17 PM
I want to add protobuf to my kotlin multiplatform project that contain "Android and Desktop" so it's JVM only the plugin by default compiles protobuf source from "src/main/proto" rather than "src/commonMain/proto" Do you know how to fix that issue ?
m

MSC

09/15/2022, 11:12 PM
You can customize your protos directory. Here's an example
View count: 36