Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    David Denton
    @daviddenton
    This message was deleted
    Shane Delmore
    @ShaneDelmore
    Haven't had a chance to play with fintrospect yet but just wanted to say that reading the source I love what I see
    David Denton
    @daviddenton
    Thanks. :)
    if you've got any questions then obviously just stick them here. Especially if you spot something in the docs which doesn't make sense... writing good docs and tutorial stuff is really hard to do when you already know it!
    Richard Gomes
    @frgomes
    Hello David, I'm considering using FIntrospect due to advantages you've pointed out regarding validation, etc. I'm sorry if my question is out of scope or even nonsense... but... does it make sense to employ FIntrospect as a filter in a Finatra application?
    David Denton
    @daviddenton
    @frgomes Hi. Well it depends on what exactly it is that you're looking to use. Since Fintrospect Modules export a Finagle Service[Request, Response], can you even plug that into a Finatra endpoint?

    In theory, you could easily reuse the Query, Header, and Body extractors, but you'd need to deal with the validation cases yourself since the validation logic is encapsulated in the RouteModule. You could reuse this logic from RouteModule.scala:

    private def validationFilter(route: ServerRoute[RQ, RS]) = Filter.mk[Request, Response, Request, Response] {
    (request, svc) =>
    route.routeSpec <--? request match {
    case Extracted(extractedRequest) => svc(extractedRequest)
    case ExtractionFailed(invalid) => Future(moduleRenderer.badRequest(invalid))
    }
    }
    to recreate the Filter, but you need the ModuleRenderer instance and the ServerRoute. That would give you the validation layer which would give you the automatic 400 generation.

    Richard Gomes
    @frgomes

    Hi, @daviddenton . Thanks for the prompt response.

    Apparently, FIntrospect and Finatra are competing implementations from the perspective of handling routes. From my scarse understanding of the two (actually zero in regards to FInstrospect), seems like I should let FIntrospect attend the request, perform validation and handle a Service[Request, Response] to Finatra.

    Since I don't need any fancy rendering, just mundane HTTP Server and HTTP Client in my microservice, I don't see at this point what would be the advantage of handling the service to Finatra, since the most interesting thing, which is: routing, was already done at this point by FInstrospect.

    I suppose that management of Futures is done by lower levels in Finagle anyway so, if I'm not mistaken, it does not make much difference if I have FIntrospect or Finatra on top of Finagle. I suppose I need to do a small PoC in order to understand better this matter.

    David Denton
    @daviddenton
    Yep - fintrospect provides the entire stack, including clients, so there's no real advantage IMHO in trying to put it on top of something else. Take a look at the cookbook or the example apps to get a better idea: https://github.com/daviddenton/fintrospect-example-app gives an entire application with contract tests for the remote dependencies.
    And please just yell if there's anything you need clarifying :)
    David Denton
    @daviddenton
    it might be that the description of fintrospect as a "routing layer" is confusing, when actually it actually provides the entire service.
    Richard Gomes
    @frgomes
    @daviddenton : Yes, I saw an example which has a client which gets the geo location given the IP address. It's something conceptually identical to the use case I have. Thanks a lot! :+1:
    David Denton
    @daviddenton
    np :)
    Shane Delmore
    @ShaneDelmore
    Does fintrospect have websockets support?
    David Denton
    @daviddenton
    Sorry - no. Just plain http
    Shane Delmore
    @ShaneDelmore
    No problem, I might be able to figure something out with finagle-websockets. This project still working well for you? I don’t see a lot of activity and wasn’t sure if that was because it was just working well.
    David Denton
    @daviddenton
    Yeah - it's driving a lot of our backend traffic from a few nodes (on a top 1000 global website) and it generally just works. At the moment, keeping it up to date with Finagle releases until inspiration strikes! :h
    Shane Delmore
    @ShaneDelmore
    Nice. I’ve been keeping an eye on it looking for an excuse to write my next project in it, may actually have something coming up soon but too early to tell.
    David Denton
    @daviddenton
    @ShaneDelmore As a bit of a cross sell, we've also ported it to Kotlin - in case that floats any more of your boats 😀 . Same SaaF model, but not async. Check it out: https://http4k.org
    (That's driving a lot of the front end traffic for the same site - different teams prefer Kotlin/Scala mix (anything but Java it seems 😝)
    Abhishek Srivastava
    @abhishes_twitter
    I wrote a small Hello World example app, by looking and reading the code of the example-app published here. https://github.com/daviddenton/fintrospect-example-app
    My API works. but I cannot see any swagger documentation
    David Denton
    @daviddenton
    @abhishes_twitter I've just run your example and the swagger docs are at the expected place: http://localhost:8080/api-docs
    .withDescriptionPath(_ / "api-docs") is where you set that value. By default it goes into the root of the module
    Abhishek Srivastava
    @abhishes_twitter
    I see it now. sorry I was trying to access the api-docs without specifying the header "key".
    thanks @daviddenton
    quick question, is there any sbt plugin or any other stub so that I can push this swagger json to something like a swagger hub or some in-house tool which renders this json into a nice html interface
    David Denton
    @daviddenton
    @abhishes_twitter sorry - no - the swagger is generated at runtime - you could build it into your tests to output the swagfer file..
    Abhishek Srivastava
    @abhishes_twitter
    Alright. thank you so much
    David Denton
    @daviddenton
    np