Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    lr9040
    @lr9040_twitter
    also we forced to use Jetty at the moment as netty is terribly falling behind and returning socket error, will future releases of http4k includes kotlinx or any.. seeing the website can't really see any upcoming milestones any one can shade some lights on that ?
    Ivan Sanchez
    @s4nchez
    @lr9040_twitter for grade you mean in the http4k project or your project? There shouldn’t be any restriction for using it in your project...
    lr9040
    @lr9040_twitter
    in http4k project
    I do know that template rendering has hot-reload
    just curious on the possibility of having auto reload on . kt files updates
    Ivan Sanchez
    @s4nchez
    Re: jetty we support other backends. Undertow is pretty solid and have seen used in production in various clients. We also support ktor-server if you prefer something Kotlin based
    I’m a bit confused about the auto reload use case you’re after. Can you give a concrete example of the behaviour you’d like to see?
    lr9040
    @lr9040_twitter
    yes sure
    Ivan Sanchez
    @s4nchez
    Is that a thing for development or for production?
    lr9040
    @lr9040_twitter
    for production
    part of our api uses http4k, is there a possibility to achieve kind similar to vertx launcher does for re-deploy
    Ivan Sanchez
    @s4nchez
    But how does one change just some files of the project in production? Sorry, I’m so used to immutable packages/deployments that this use case feels very foreign to me
    I’m curious how you’d plan this kind of re-deployment
    lr9040
    @lr9040_twitter

    ./gradlew web:vertxRun

    Task :web:vertxRun
    2020-04-13 00:56:23,927 [main] INFO i.v.c.impl.launcher.commands.Watcher - Watched paths: [/Users/lr9040/IdeaProjects/api/web/src]
    2020-04-13 00:56:23,932 [main] INFO i.v.c.impl.launcher.commands.Watcher - Starting the vert.x application in redeploy mode
    Starting vert.x application...
    d97bac62-c3ec-4ca4-a703-b42487c342b7-redeploy
    2020-04-13 00:56:24,925 [vert.x-eventloop-thread-0] INFO app - api.service.App is ready!
    2020-04-13 00:56:44,078 [Thread-1] INFO i.v.c.impl.launcher.commands.Watcher - Redeploying!
    Stopping vert.x application 'd97bac62-c3ec-4ca4-a703-b42487c342b7-redeploy'
    Application 'd97bac62-c3ec-4ca4-a703-b42487c342b7-redeploy' terminated with status 0
    Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details
    Task :common:compileKotlin UP-TO-DATE
    Task :common:compileJava NO-SOURCE
    Task :common:processResources NO-SOURCE
    Task :common:classes UP-TO-DATE
    Task :common:inspectClassesForKotlinIC UP-TO-DATE
    Task :common:jar UP-TO-DATE
    Task :web:compileKotlin UP-TO-DATE
    Task :web:compileJava NO-SOURCE
    Task :web:processResources UP-TO-DATE
    Task :web:classes UP-TO-DATE

    BUILD SUCCESSFUL in 7s
    5 actionable tasks: 5 up-to-date
    2020-04-13 00:56:52,789 [Thread-1] INFO i.v.c.impl.launcher.commands.Watcher - User command terminated with status 0
    Starting vert.x application...
    d97bac62-c3ec-4ca4-a703-b42487c342b7-redeploy
    2020-04-13 00:56:52,807 [Thread-1] INFO i.v.c.impl.launcher.commands.Watcher - Redeployment done in 8729 ms.
    2020-04-13 00:56:53,746 [vert.x-eventloop-thread-0] INFO app - api.service.App is ready!
    <===========--> 90% EXECUTING [41s]

    :web:vertxRun

    pretty long log thought it might helps you..
    Ivan Sanchez
    @s4nchez
    Ah! Gotcha... you run grade in prod. Then re-deploy means simply updating the project files?
    lr9040
    @lr9040_twitter
    correct
    we just trying to accomplish the re-deployment upon files changes within project files.. is there a possibility to achieve this with http4k since it's running asServer ?
    Ivan Sanchez
    @s4nchez
    I’m not sure if that reload model fits in http4k design. Needs some exploration, which unfortunately I don’t have the bandwidth to do at the moment :(
    lr9040
    @lr9040_twitter
    seeing the website can't really see any upcoming milestones any lights on that ?
    lr9040
    @lr9040_twitter
    👍
    Jude Cooray
    @judecooray
    Hello! I'm trying always setScale to my BigDecimal so I went ahead with my own ConfigurableJackson
    fun myBigDecimalFormatter() = BiDiMapping(String::toBigDecimal) { it.setScale(2, RoundingMode.HALF_UP).toString() }
    
    object MyJackson : ConfigurableJackson(KotlinModule()
        .asConfigurable()
        .withStandardMappings()
        .text(myBigDecimalFormatter())
        .done()
        .deactivateDefaultTyping()
        .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
    )
    I've used this configuration in my contract
    contract {
        renderer = OpenApi3(apiInfo = ApiInfo("Merchant Fees Service", "v1.0"), MyJackson)
        descriptionPath = "/swagger.json"
        routes += calculateFees()
    }
    Unfortunately it doesn't use this formatter but always defaults to BigDecimal.toString
    Anything else I need to do to make it work ?
    David Denton
    @daviddenton
    @judecooray the withStandardMappings() function will also add the BigDecimal mapping. Try adding your mapping first? Or you may have to copy the contents of withStandardMappings and replace the BigDecimal mapping
    Jude Cooray
    @judecooray
    Hey David - withStandardMappings does not seem to be adding a BigDecimal mapping
    fun <T> AutoMappingConfiguration<T>.withStandardMappings() = apply {
        text(duration())
        text(uri())
        text(url())
        text(uuid())
        text(regexObject())
        text(instant())
        text(yearMonth())
        text(localTime())
        text(localDate())
        text(localDateTime())
        text(zonedDateTime())
        text(offsetTime())
        text(offsetDateTime())
        text(eventCategory())
        text(traceId())
        text(samplingDecision())
        text(throwable())
        int({ Status(it, "") }, Status::code)
    }
    David Denton
    @daviddenton
    hmm - interesting. I think this comes down to being a straight configuration of Jackson then. TBH I've never tried to actually reconfigure it to remap BigDecimal. One thing that you could do is to create a small Microtype to wrap your BigDecimal (which is good practice anyway if it's got a meaning in your domain) and then add a custom mapping for it.
    Jude Cooray
    @judecooray
    I've found the answer to why it wasn't working - so it's not only a matter of passing the my own configuration to the Renderer -
    OpenApi3(apiInfo = ApiInfo("Merchant Fee Service", "v1.0"), FeeServiceJacksonConfig) but I have to use the auto method of that ConfigurableJackson class when deserializing
    I kept on using the org.http4k.format.Jackson.auto when deserializing val body = Body.auto<MyEvent>().toLens() which of course meant that it will not use any of my custom mappings
    Norman Shipman
    @nshipman-io

    Hello,

    Are there any examples of implementing the micrometer stackdriver package for httpk4k? SimpleRegistry is straight forward, but pretty lost on implementing other services.

    Moritz Lindner
    @linde9821
    Hi :) How should i hold a pool of websocket connections so that i can send them messages when i need to.
    David Denton
    @daviddenton
    @linde9821 there isn't really a pattern for this - is there any reason some type of in-memory map wouldn't do? We used one for the IRC demo which you can find here: https://github.com/daviddenton/http4k-demo-irc/blob/master/src/main/kotlin/org/http4k/demo/IrcApp.kt
    (also, Slack is much better for asking questions :wink: )
    Moritz Lindner
    @linde9821
    Okay thank you ill look at this :)
    Moritz Lindner
    @linde9821
    @daviddenton Just out of curiosity did you handle the ws default timeout in the IRC demo?
    Moritz Lindner
    @linde9821
    Does anyone know a sample on how to build a "normal" docker image with gradle for a http4k project?
    David Denton
    @daviddenton
    @linde9821 define normal. :) Our recommended way to build one is to use Google Jib. You can generate a sample project at: https://toolbox.http4k.org
    Moritz Lindner
    @linde9821_gitlab
    Hi :) Are there any Auto-marshalling capabilitys for SSE Messages?
    Moritz Lindner
    @linde9821_gitlab
    or can i produce a "raw" json string with a lens?
    David Denton
    @daviddenton
    @linde9821_gitlab There aren't any Sse lenses at the moment. if you want to copy the WsMessage ones then they should be broadly similar. And if you fancy PRing it back to the project then even better
    Christopher London
    @Sicarius154

    Hi. Is there a way in which I can combine two RoutingHttpHandlers?

    I currently have two separate functions in my API that I have separated out, calling routes() with each set of endpoints for each part of my API. Now I have these RoutingHttpHandlers I want to combine/compose them to be run from the top-level of my app. A bit like you can see here, which I did using Finch+Finagle in Scala:

    https://github.com/Sicarius154/DistributedSystemsCoursework2/blob/main/src/main/scala/web/Endpoints.scala

    David Denton
    @daviddenton
    Yep - the routes() function is designed to compose handlers like this.
    Christopher London
    @Sicarius154
    I'm an idiot, not sure how I overlooked that given I scoured through the file
    Cheers!