Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 17 22:52
    edma2 added as member
  • Sep 17 22:52
    edma2 removed as member
  • Sep 17 22:51
    edma2 added as member
  • Sep 17 22:51
    edma2 removed as member
  • Jun 13 2020 03:21

    finaglehelper on develop

    finatra: Support for injecting … (compare)

  • Jun 12 2020 22:21

    finaglehelper on develop

    finatra-thrift: Reduce complexi… (compare)

  • Jun 12 2020 02:44

    finaglehelper on develop

    finatra-thrift: Use correct dat… (compare)

  • Jun 11 2020 07:32

    finaglehelper on develop

    finatra-thrift: CommonThriftLog… (compare)

  • Jun 10 2020 19:31

    finaglehelper on develop

    finagle, finatra, ts: Keep `inc… (compare)

  • Jun 10 2020 19:05
    ihasfrozen commented #522
  • Jun 09 2020 00:46

    finaglehelper on develop

    finatra: Add comments for optim… (compare)

  • Jun 08 2020 18:23

    finaglehelper on develop

    finatra-doc: Add missing import… (compare)

  • Jun 05 2020 03:18

    finaglehelper on develop

    inject-core: Remove finagle-cor… (compare)

  • Jun 04 2020 22:33

    finaglehelper on develop

    finatra: Use permanent links fo… (compare)

  • May 29 2020 21:31
    cacoco closed #511
  • May 29 2020 21:31
    cacoco commented #511
  • May 29 2020 21:31
    cacoco closed #524
  • May 29 2020 21:31
    cacoco commented #524
  • May 28 2020 22:31

    finaglehelper on develop

    util|scrooge|finagle|twitter-se… (compare)

  • May 28 2020 00:41

    finaglehelper on develop

    finatra: Update testing docs P… (compare)

Matthieu Totet
@totetmatt

Hey @cacoco thanks for the insights !

I actually tried what you explain before but if I do so, scala complain as

class GetAReQuest needs to be abstract, since value userId in trait Usertrait of type String is not defined

And then, even if I add userId:String to the case class, the @QueryParam won't be propagated : "user_id: field is required"

But, if on the trait I declare the attributes as def then it works, Needs to repeat the field, but then @QueryParam looks "propagated".

trait UserTrait { @QueryParam("user.id")  def userId:String}
                                       //  ^---- use of def instead of val 

case class GetAReQuest(@QueryParam a:String, userId:String) extends UserTrait
case class GetBReQuest(@QueryParam b:Int, userId:String) extends UserTrait
                                       // ^----- Repeat the trait attributes but no need to repeat @QueryParam or any other @Annotation

I don't really know what are the implication or even if it's correct to do this way, but so far it's acceptable for my use case.

Thanks also for the explaination about the ScalaObjectMapper & MessageBodyReader, was quite confuse on what was happening here.
But then if I understand there is no real way to parse a request "ad-hoc" like :
case class UserData([...])
case class QueryData([...])
case class XYZData([...])
get("/api/") { req:Requests =>
    val userData:UserData   = req.asInstanceOf[UserData]
    val queryData:QueryData = req.asInstanceOf[QueryData]
    val xyzData:XYZData     = req.asInstanceOf[XYZData]
                        ^----- Or any other magical method ?
// Yeah I know feels weird but just want to know for knowledge
}
Christopher Coco
@cacoco
@totetmatt It seems like you have a pretty standard case for inheritence and you’re just fighting Scala. Case classes can be a bit funny but there’s no magic here and we have plenty of test cases if you look around that highlight the behavior of annotated inherited fields as it pertains to custom request case class parsing. But yeah, you’re right, you need to define the field as a def in the trait and in the case class repeat it as a field (but you don’t need to redefine the annotation). This just Scala. For your second question, I’m not sure I understand what you mean by “ad-hoc” here. You have a type so it’s not really ad-hoc? If you manually want to parse the JSON body of a request, then you would just use an http Request as the callback type and then parse the content string into some object like here.
awu
@awu
hey folks, x-posting from twitter/finagle: i'm trying to use inject-mdc and MDCInitializer from finatra in a finagle(finch) service, but for some reason the mdc keys aren't showing up in logs. anyone have an idea? the filter is pretty much the exact same as the LoggingMDCFilter and it's the very first filter.
4 replies
Marwan Rabbâa
@waghanza
Hello,
We want to introduce finatra in the-benchmarker/web-frameworks#3835
@cacoco do you (or any core team member) consent (or is no opposed) on such a thing ?
Yufan Gong
@yufangong
Hi all, just a heads up that we are starting the February release, we will be cross-building scala 2.11/2.12/2.13 this time, 2.11 will be dropped in March release. Thanks!
Andy
@andy1xx8
Hi everyone , Im using Finatra 20.4.1.
i have a thrift service with lot of methods ( let's say 100+ methods) .
So i have to implement all of it in 1 single Controller class.
is there any way to split it into many differ impl files?
Thanks in advanced.
Ultimately it's just code, you call logic in other classes how you see fit.
sherzod
@sherzodv
Hi guys, is there a centralized way to change (add) base path to all registered controller in finatra?
4 replies
Christopher Coco
@cacoco
In a controller itself you just use prefix
Eg in MyController you’d scope the routes under prefix(“/api”)
But if you wanted something to apply for all controllers you add to the router...that is not there
Andy
@andy1xx8
@cacoco thanks Christopher. I got it
Marwan Rabbâa
@waghanza
Christopher Coco
@cacoco
@waghanza fixed here: twitter/finatra@660dcb0. Thanks!
Jason Cohen
@jdcohen220
Where can I find the jars for inject-server / EmbeddedTwitterServer for scala 2.12? I am attempting to set up feature tests for HttpServer
Jason Cohen
@jdcohen220
@enbnt thank you!
Jason Cohen
@jdcohen220
Is it possible to conditionally or lazily instantiate/inject modules? Let's say I want my server to either use a MongoDB or Postgres module for the datastore depending on some configuration or flag. I cannot simply inject both since one would fail to start if the instance doesn't exist in that environment.
9 replies
Jason Cohen
@jdcohen220
Any recommendations for in-memory caching libraries that play well with twitter futures?
Christopher Coco
@cacoco
Have you seen Twitter/util/util-cache? https://github.com/twitter/util/tree/develop/util-cache
Vladimir Ivanovskiy
@vi-p4f
Hi! Are there any known obstacles for using Finatra 21.2.0 in Scala 3 built projects?
3 replies
jyanJing
@jyanJing
freshly baked Finatra summer update 😃 : https://finagle.github.io/blog/2021/08/03/summer-review/
jyanJing
@jyanJing