https://kotlinlang.org logo
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
server
  • t

    Torbilicious

    11/26/2018, 1:23 PM
    Hi! Does anyone know any load testing tool (maybe like gatling) that can be configured via kotlin?
    r
    b
    • 3
    • 3
  • j

    John Hageman

    11/28/2018, 2:58 PM
    Anyone want to share their opinion on using something like kotlinx.html for server side rendering vs a traditional templating engine like FreeMarker or Pebble? Just looking for advice or feedback on current best practices, if there are any.
    d
    s
    +5
    • 8
    • 15
  • t

    tw

    11/28/2018, 8:49 PM
    I asked in #test too - but I am wondering if anyone has any better alternatives/suggestions to https://github.com/DiUS/pact-jvm/ - maybe I am even approaching the problem in the wrong way
    f
    • 2
    • 2
  • a

    Adam Hurwitz

    12/01/2018, 10:02 PM
    Hey Everyone, I'm attempting to have my Ktor app's main method run once deployed to AppEngine. Currently the Ktor application's main method is only called when the app's hosted route is called: https://[yourProjectName].appspot.com. In the applications's main method is logic to retrieve content from an API request based on a Timer and save that information to a Firestore database which a client consumes. Thanks for the help! 🙂
    r
    n
    +2
    • 5
    • 10
  • d

    droidrcc

    12/03/2018, 4:07 PM
    Could you suggest how to generate build config fields with String type from gradle?
    d
    n
    g
    • 4
    • 3
  • j

    Joar Leth

    12/07/2018, 10:52 AM
    Hi! I’m trying out Ktor and can’t get auto-reload to work. I’ve added watch [ project-name ] to application.json under ktor.deployment. Then I build using ./gradlew -t build and run the app in a separate tab using ./gradlew run. The project is set up using the Ktor project wizard in IDEA I have a / route responding with plain text. When I load / in the browser it displays the text, but if I change the text and reload / in the browser it returns 200, but no text. I’m not sure how to figure out what goes wrong since I don’t get any errors in the terminal windows or in the response. Any ideas on how to figure out what’s going wrong?
    c
    • 2
    • 4
  • h

    Hexa

    12/08/2018, 10:05 PM
    Does anyone know, do I need to wrap the logic inside my
    handleRequest
    function into a
    try catch
    block in here? https://gist.github.com/rinnegan/3f65805a2f510519e738c4365b6fe97c#file-do-i-need-to-wrap-logic-in-try-catch-block-L20 I am confused because
    processor.process(input, output)
    will throw a checked exception in Java but Kotlin as no checked exceptions so I'm not sure what to do
    n
    g
    • 3
    • 5
  • a

    Alexandre

    12/10/2018, 1:04 PM
    Hello. I'm beginning on Kotlin, and I would like to trying it using Ktor. Is possible create a local server on Mac to use Ktor ? I look at the site https://ktor.io but i did not find
    m
    l
    +2
    • 5
    • 12
  • z

    zucen.co

    12/12/2018, 2:22 PM
    Hi, I was wondering, some poeple using ktor on GAE? I mean i checked demo on ktor.io but i would love to see "proper way" to acces datastore, use ofy or not, etc etc not to reinvent myslef 🙂 ?
    m
    g
    b
    • 4
    • 9
  • s

    Slackbot

    12/16/2018, 8:25 PM
    This message was deleted.
    o
    a
    • 3
    • 7
  • k

    kenkyee

    12/19/2018, 12:45 AM
    https://medium.com/@NetflixTechBlog/netflix-oss-and-spring-boot-coming-full-circle-4855947713a0 Not directly Kotlin related but a bug deal because Netflix is adopting Kotlin heavily and this makes Spring Boot more of a de facto standard...
    o
    m
    +4
    • 7
    • 10
  • x

    Xyu

    12/20/2018, 11:09 PM
    Hello, I am building a rest server with Jersey 2.6. And for DB access, I am trying to switch from Hibernate JPA to JDBI since I kinda feel Hibernate does not work well with Kotlin. I and totally new to jdbi and I got a few questions like: whether it is a good practice to inject DAO with onDemand, how to use enum type, etc. Do you guys have any tutorials or sample projects to start with?
    s
    • 2
    • 4
  • s

    savrov

    12/23/2018, 9:30 PM
    Guys, hello, Im using this framework to create auth2 server with ktor. But i dont understand how can i access methods for auth (Oauth2TokenService class, that i install as a feature) in my endpoints. https://github.com/myndocs/kotlin-oauth2-server Can someone look in it, please
    o
    • 2
    • 2
  • v

    vnsgbt

    12/24/2018, 4:07 PM
    I'm migrating to coroutine 1.0.0 for a SpringBoot app. Previously I can easily create an actor as Spring Bean. How can I create an actor that is injectable for SpringBoot and the new coroutine?
    g
    • 2
    • 3
  • k

    kenkyee

    12/28/2018, 12:43 PM
    That's pretty cool...a versioned xml doc database 🙂
    j
    • 2
    • 1
  • k

    kenkyee

    12/28/2018, 5:05 PM
    If you do JSON, it'd be mostly like MongoDB..then you'd have to look at supporting something like their query language which is relatively complicated.
    👍 1
    j
    • 2
    • 2
  • s

    Slackbot

    12/28/2018, 5:38 PM
    This message was deleted.
    s
    s
    • 3
    • 5
  • j

    Jeff Gulbronson

    12/31/2018, 4:11 AM
    Has anyone used Hibernate successfully with Kotlin? Checked #hibernate but the channel seems pretty dead.
    k
    s
    m
    • 4
    • 6
  • s

    savrov

    01/04/2019, 5:35 PM
    I have 2 independent servers - one A for user (auth, refresh, details, registration), the other one B - for data. if I want to access data on server B, I need to validate token first of all, that means that in my B server endpoint I need to call a
    check
    method from A server. Is it correct?
    n
    m
    • 3
    • 5
  • h

    hyukchan

    01/05/2019, 5:45 PM
    Does someone know how to use multiple conf files for Ktor project ?
    t
    • 2
    • 1
  • h

    hyukchan

    01/21/2019, 12:45 PM
    Anyone having the same issue as me ?
    d
    • 2
    • 1
  • a

    akhu

    01/21/2019, 6:26 PM
    Hi everyone, do you know a good tool for profiling memory consumption for a kotlin / JVM program ? The integrated Intellijea 2018.3 solution only profile CPU. Thanks for help !
    a
    h
    n
    • 4
    • 3
  • g

    gpeal

    01/22/2019, 10:15 PM
    Hi everybody, I've been a huge proponent of Kotlin and helped migrate Airbnb's Android team to Kotlin and am not well underway doing the same at Tonal (https://www.tonal.com/). I'm meeting with our backend team tomorrow to introduce the idea of using Kotlin to them. Right now, they do everything in Go but I think there could be a ton of value to having shared language/code/knowledge/tooling. Plus, Kotlin is wonderful. However, I have very limited experience with Java/Kotlin on the server side of things. Any suggestions for talking points or ideas I could lead that discussion with?
    👍 1
    🍾 1
    k
    h
    +11
    • 14
    • 49
  • t

    Tomer

    01/24/2019, 5:42 PM
    Hi everyone! I've recently decided that I want to rewrite my currently static portfolio website/blog as a dynamically served website with a server (mainly with the purpose of adding additional functionality). I love Kotlin and when looking into using it for the server I came across ktor and exposed which I think I would work well together. However, most of the server-side code I've written has been in Ruby under the Rails framework, which is super opinionated and pushes for a predefined structure that I certainly followed. Now I've started working with ktor and exposed and I'm a bit at a loss for how to organize my code. Have any of you figured out a way to organize your classes, functions, files, etc. that's scaled well?
    t
    m
    j
    • 4
    • 5
  • t

    Talon

    01/24/2019, 9:35 PM
    I'm trying to run a ktor API on my raspberrypi but I get this error
    io.ktor.client.call.ReceivePipelineException: Fail to run receive pipeline
    doesn't happen locally, I'm thinking maybe I need to configure the client differently or something?
    o
    • 2
    • 1
  • v

    vnsgbt

    01/30/2019, 2:28 PM
    Hi everyone, is there a library out there that can generate Kotlin data class from SOAP WSDL?
    d
    • 2
    • 2
  • l

    Louis Saglio

    01/30/2019, 7:41 PM
    I am trying to understand Ktor form authentication. To do so, I have created a very simple web app but I am stuck on an error for multiple hours and documentation seems incomplete or outdated.
    fun Application.bank() {
        install(Authentication) {
            form("form") {
                challenge = FormAuthChallenge.Unauthorized
                passwordParamName = "password"
                userParamName = "username"
                validate { credentials ->
                    println("Credentials : ${credentials.name}, ${credentials.password}")
                    when {
                        credentials.name == "John" && credentials.password == "pa$$w0rd" -> UserIdPrincipal("John")
                        else -> null
                    }
                }
            }
        }
        routing {
            authenticate("form") {
                route("account") {
                    post {
                        call.respond(HttpStatusCode.OK, "connected")
                    }
                }
            }
        }
    }
    To access the route /account I send this HTTP request :
    POST <http://0.0.0.0:8081/account?username=Louis&password=pass>
    But this raises an exception :
    io.ktor.features.CannotTransformContentToTypeException: Cannot transform this request's content to class io.ktor.http.Parameters
    So I guess I should not give credentials to the server via POST body. I have tried sending credentials in JSON with ContentNegocition installed but I get a similar error. If someone could help me ... I will update the documentation once I know how it works.
    b
    h
    • 3
    • 4
  • n

    neworldlt

    02/11/2019, 7:35 PM
    Hello. Maybe do you have some insights of my problem? I have a backend with many cores, C10k traffic, and DB. DB is the slowest part. Of course, I am using a Ktor. Question, which DB driver performs better (assume server hits 100% load): - sync driver. - async + coroutines. A thread is able to process another request while a DB query is working. I did some benchmarks on the artificial system and found, the sync driver was able to produce ~10% more reqs/sec. Also, the async driver takes much more memory on the same load. I assume coroutines have some overhead. I even tried to limit IO bandwidth inside docker to emulate IO cap. The sync driver was faster. However, I am not sure my benchmark was good. So, my question, why I should use async + coroutines? Maybe do you have some insights from real-world applications?
    o
    b
    +2
    • 5
    • 15
  • h

    Hexa

    02/13/2019, 3:46 PM
    Please can someone with JAX-RS and Kotlin have a look at this question: https://stackoverflow.com/q/54674096/9506917
    s
    t
    j
    • 4
    • 45
  • t

    thiagoretondar

    02/17/2019, 5:35 PM
    Hey guys! I’m starting with Kotlin and I’ll be using it only for server-side applications. My intention is to start using it to write serverless application, but I have some doubts about the framework to be used. I’ve worked with Java Spring Boot in the past (two years ago) and now I’m mainly working with NodeJS. My scenario is only APIs (won’t be rendering any front end). What are your thoughts on it?
    o
    a
    +4
    • 7
    • 21
Powered by Linen
Title
t

thiagoretondar

02/17/2019, 5:35 PM
Hey guys! I’m starting with Kotlin and I’ll be using it only for server-side applications. My intention is to start using it to write serverless application, but I have some doubts about the framework to be used. I’ve worked with Java Spring Boot in the past (two years ago) and now I’m mainly working with NodeJS. My scenario is only APIs (won’t be rendering any front end). What are your thoughts on it?
o

orangy

02/17/2019, 5:39 PM
Try #ktor
a

addamsson

02/17/2019, 5:40 PM
If you want something like node.js you can also try #vertx I've also used #http4k which I liked and it is geared towards fast startup times and works with the GraalVM as well.
👍 2
t

thiagoretondar

02/17/2019, 7:08 PM
Thanks!! I’ll look into them. Is there a specific reason to no use spring with kotlin for aws lambda ?
t

tddmonkey

02/17/2019, 8:03 PM
You’re typically looking for a fast startup time with lambda. Stripping things like Spring really help.
☝️ 1
r

Robert Jaros

02/17/2019, 8:25 PM
You could try Jooby as well.
t

thiagoretondar

02/17/2019, 8:52 PM
Gotcha
What about #micronaut , what do you think?
r

Robert Jaros

02/17/2019, 9:44 PM
Haven't used it, but from the docs it seems quite complicated to use with Kotlin.
🤔 2
t

thiagoretondar

02/17/2019, 10:02 PM
From what I read “Micronaut, we are getting quite close to the barrier what is considered a microframework and what is not” But I didn’t see the docs yet
a

addamsson

02/17/2019, 10:16 PM
@thiagoretondar Spring has a very slow startup time especially within Docker. Things like #http4k are geared towards lambda (if you check the docs it is there) and it can also work on GraalVM. I mentioned #vertx because it implements the Reactor pattern just like node.js. In fact it is a multireactor where you also have the chance to run background jobs (something which node.js is incapable of). I love #spring and I use it on multiple projects but I wouldn't use it in a lambda environment because of the things I mentioned above. I can't comment on #ktor I haven't used it yet, but from what I heard it is getting mature so you might want to take a look at it as well. It is also written in Kotlin so theoretically it might be easier to use from Kotlin than other Java projects.
@Robert Jaros in my local Kotlin user group there was some talk about #micronaut on the last meetup, we had a presentation about it in fact and it seems promising, but apart from that I can't really comment on it since I haven't used it.
One more thing: if performance is important for you then you might want to check these benchmarks: https://www.techempower.com/benchmarks/
t

thiagoretondar

02/17/2019, 10:30 PM
Perfomance is always important hahaha but I need something that can’t be hard to create and maintain I’ll check those other frameworks because not everything I’ll be running initially
Happy to know this a good community to share knowledge
d

dave

02/17/2019, 10:31 PM
@thiagoretondar http4k apps can be tested locally and then easily converted to run inside lambda by implementing a single wrapper interface. We don't provide any tools for upload and config because there are multiple better methods than we could write. However, what you will notice is that sizes can be made to be very small if you use a tool like proguard to shrink the binary. In our experiments, a simple hello world lambda was only 400kb in total.
👍 1
Obviously the jar size will multiply depending on complexity of the lambda, but you can be judicious in what you use for dependencies. Eg. Am pretty sure that using the in-built http client with the http4k aws module would still yield a lambda binary of less than 1mb for something taking an input request body and dumping it into S3.
t

tddmonkey

02/18/2019, 8:38 AM
Have you considered fronting lambda with API gateway and dumping the need to run a web server?
d

dave

02/18/2019, 9:07 AM
@tddmonkey can't speak for how the other libs work, but that's exactly how serverless works with http4k. Lambda is simply another backend that you plug your app into as it's completely decoupled. Then you can test locally with something like jetty (or even completely without a server and in memory), and then just upload with the wrapper.
t

tddmonkey

02/18/2019, 9:09 AM
just read the docs, nice
k

kenkyee

02/20/2019, 1:59 PM
For AWS Lambda, you mainly care about startup times so look for frameworks that support GraalVM. I did a talk at last year's KotlinConf covering most of the available frameworks that you might want to watch. Not much has changed except micronaut has been released but I did mention it then as well because it looked so promising.
👍 1
a

addamsson

02/20/2019, 4:05 PM
Agree 100%, that's why I mentioned #http4k
View count: 3