Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Leif Battermann
    @battermann
    @cb372 we solved the problem
    part of the problem was here:
        for {
          response <- serviceClient.use(client => client.ListOrders(empty.Empty()))
          _        <- IO(response.take(100).dump("Data Service Response (100):").subscribe())
        } yield ExitCode.Success
    the client resource gets destroyed before we run the IO response...
    :see_no_evil:
    chain-alex
    @chain-alex
    I am trying to use PBDirect but it is not clear to me how to do the above
    Dylan Martin
    @dmarticus
    hi @chain-alex I’m sorry for the slow response to your question! We use our fork of PBDirect under the hood of mu-scala for Protobuf serialization, and it’s possible to define custom codecs for both Avro and protobuf serialization by using instances of PBDirect’s PBScalarValueReader and PBScalarValueWriter type classes (see here: https://higherkindness.io/mu-scala/guides/custom-grpc-serialization#custom-codecs). What specifically are you trying to do in your case? FYI, for deserialization, PBDirect supports a pbTo[A] method if that’s what you’re looking for (example: https://github.com/47degrees/pbdirect#deserialization)
    Anton Semenov
    @a7emenov

    Hi, everyone!

    Am I correct that mu only respects the package option (and requires it) when generating server/client definitions from .proto files? Some of the proto files I'm dealing with have package names that I don't want to use when generating Scala code and some have no package names at all.

    I could've manually provided the target directory for generation that points to the package I want (which would only work assuming that all generated classes should reside in the same package), but that will still fail if there is no package name in the .proto file - I always have to provide it.

    I really want to keep the original package names in the .proto definitions, because that's important when communicating with other teams, so is there a way I could "customize" the target package without having to modify the .proto files?

    Dylan Martin
    @dmarticus
    Hi @a7emenov! You're correct that mu requires the package option when generating server/client definitions from .proto files. We do have an option for customizing the target directory (to an extent) that can be configured in your build.sbt (or similar) called muSrcGenIdlTargetDir (more details can be found here: https://higherkindness.io/mu-scala/reference/source-generation). This plugin setting determines the name of the target directory to write your generated protobuf code into (the default being target/scala-2.13/src_managed/main/), so I think it would be possible to use that plugin to specify different target directories for your generated protobuf code if you don't want to modify the package names. That said, I don't know if this is a complete answer to your question, and I'm happy to help you further if you can provide more specific details to what you're trying to do :)
    Anton Semenov
    @a7emenov

    @dmarticus thank you for the response, really appreciate it! Basically confirms all my assumptions. Though I really love Mu, this may be the reason why we'd have to switch to ScalaPB as it allows to be very flexible when generating packages.

    Is it likely that in the future skeuomorph and, by extension, mu will support options like java_package?

    Dylan Martin
    @dmarticus
    @a7emenov great feedback; and I'll circle back with the mu folks at 47 to see what our roadmap for skeuomorph looks like going forward (we're planning on continuing to make mu and skeuomorph more tightly coupled, e.g. we're likely going to move from avrohugger to skeuomorph for the avro schema parsing), so no promises but I'll definitely bring it up. I've added the issue (higherkindness/skeuomorph#318) to the skeuomorph backlog if you'd like to follow along on it.
    Anton Semenov
    @a7emenov
    @dmarticus thanks again - looking forward to this being implemented.
    chain-alex
    @chain-alex
    How hard would it be to use Mu with gradle?
    chain-alex
    @chain-alex
    also, how can I convert an instance of a proto generated case class to a byte array?
    Dylan Martin
    @dmarticus
    Hi @chain-alex, does the pbTo[A] method from https://github.com/47degrees/pbdirect#deserialization not work for writing the case classes to a byte array? And re: the mu with gradle, I've never tried it before (I don't use gradle for scala projects) but I imagine the scala plugin for gradle will work with this library (https://guides.gradle.org/building-scala-libraries/). Not sure if you've tried that approach already; please let me know if you did and you're getting errors
    Andrey Patseev
    @patseev
    Hi guys. Have a question regarding gRPC mu client. What happens when connection to remote gRPC server closes? I see that the service is being exposed as a resource, does that mean that it terminates upon loss of connection and I have to reboot the app to work again? Or is the reconnection handled in the background automatically?
    Andrey Patseev
    @patseev
    Maybe I just misuse it and it brings confusion. What is the best pattern for working with it? Right now I initiate resource at a top level and then pass the client down into app wiring, then use that client on lower levels of the app. Should I instead pass the resource on the lower levels, and when I need to call the server, do it via .use(client => ...)?
    Dylan Martin
    @dmarticus

    Right now I initiate resource at a top level and then pass the client down into app wiring, then use that client on lower levels of the app. Should I instead pass the resource on the lower levels, and when I need to call the server, do it via .use(client => ...)?

    Hi Andrey, the pattern you described where you pass the resource into the lower levels and then call it via .use(client => ...) makes sense from my perspective! I don't know what specifically you're working on, so I can't offer more insights than that, but have you checked out our example repo for using mu? You can check it out here (https://github.com/higherkindness/mu-scala-examples/); this repo contains several examples that use mu idiomatically (here's one that does the behavior that you're describing: https://github.com/higherkindness/mu-scala-examples/blob/master/tracing/serverA/src/main/scala/com/example/ServerA.scala#L47).

    @patseev ^ if you didn't get notified :)
    Juan Pedro Moreno
    @juanpedromoreno
    I think you are doing right, @patseev . Passing the client down is the common pattern used.
    Dylan Martin
    @dmarticus
    hi @a7emenov, with the latest release of v0.25, skeuomorph now supports java_package options with the same functionality as ScalaPB. See the release notes for more!
    Anton Semenov
    @a7emenov
    Looking forward to respective mu release as well, thanks a lot @dmarticus !
    Dylan Martin
    @dmarticus
    Hi @a7emenov, mu version 0.23.0 and sbt-mu-srcgen (the sbt plugin that handles the source generation) version 0.23.0 have both been released as of this afternoon! The release notes can be found here for mu and here for sbt-mu-srcgen. Enjoy!
    Anton Semenov
    @a7emenov
    Didn't know it's Christmas time already, @dmarticus :D
    This means mu stays in the project, cannot underappreciate that.
    Anton Semenov
    @a7emenov

    Hey @dmarticus!

    Created higherkindness/skeuomorph#337 as there seems to be an issue with enums still requiring the package option. Really hope it can be fixed soon, but luckily it's not a complete blocker for us.

    Please let me know if I can help with it in any way.

    Dylan Martin
    @dmarticus
    Thanks for letting me know @a7emenov! I took a look at the issue and left a small comment but the issue itself seems clearly filed and make sense. This week I'm a bit tied up with consulting work during the week but I can try and take a look at this tonight or over the weekend. If one of my coworkers has more bandwidth, though, I can ask and see if they'd take a look at it. Thanks again for the detailed bug report!
    Anton Semenov
    @a7emenov
    Much obliged @dmarticus! As again, happy to help and/or provide any necessary information.
    Dylan Martin
    @dmarticus
    @a7emenov if you're curious, the PR to fix this is here: higherkindness/skeuomorph#339
    Anton Semenov
    @a7emenov
    Thank you so much, @dmarticus! Glad that I could at least provide some test examples.
    Dylan Martin
    @dmarticus
    For sure! Real-world use cases make for great test files :)
    Anton Semenov
    @a7emenov
    I think I found another issue related to enums (though not related to the package option). Doesn't seem to be skeuomorph this time, so created an issue in mu itself #1022
    Anton Semenov
    @a7emenov
    Pardon, the issue link was wrong: higherkindness/mu-scala#1022
    Anton Semenov
    @a7emenov
    Just got a notification that a PR for higherkindness/skeuomorph#337 was merged today. Can't thank you enough, @dmarticus! Judging by the comments it wasn't quite straightforward.
    Dylan Martin
    @dmarticus
    you're so welcome! Happy to help (and sorry for the late response; been embedded in some client consulting and haven't had time to work in the open-source world as much lately)
    Evgeniy
    @key-eugene
    Hello! Does mu-scala has support for gRPC Server Reflection?
    iandebeer
    @iandebeer_twitter
    Hi, is it possible to have an Interceptor that can integrate with an Auth service like Keycloak to check the permissions of a client based on a token that you can presumably pass with the Request as metadata?
    Kevo
    @kelvinmac
    Hello everyone, hope you all had a good New Years. We are trying to compile some .proto which have validation and therefore use the google standard types to achieve this. When we tried compiling our protos with Mu, we got “could not find duration.proto (a google standard type)”. After looking into google/protobuf/skeuomorph, we noticed that you exclude the “include_std_types” flag when compiling the protos here: https://github.com/higherkindness/skeuomorph/blob/master/src/main/scala/higherkindness/skeuomorph/protobuf/ParseProto.scala#L90. When this flag is set, it will include google’s standard types according to https://github.com/os72/protoc-jar#usage---executable-include-googleprotobuf-standard-types-option---include_std_types. We created a version of skeuomorph which includes this flag and included this custom skeuomorph version into a custom version of sbt-mu-srcgen which we included in our project. This compiled our protos fine, however the generated code had errors “object duration is not a member of package com.google.protobuf” which makes sense since the google types haven’t been compiled by mu. We wondered why Mu doesn’t support the google standard types, and if there is any plan for their support in the future?
    Rafa Paradela
    @rafaparadela
    Hi @kelvinmac Sadly we can't dedicate as long time as we would love, so we can't commit to work on this in short terms. Would you please create an issue in Github for us? Thanks a lot.
    Dmitriy Kuzkin
    @kuzkdmy

    Hi
    Is there a way to generate code from open.api where classes have more than 22 fields?

    Got quite reasonable error
    tuples may not have more than 22 elements, but 32 given
    Encoder.forProduct32(

    The settings that I setup to project are
    .settings(
    muSrcGenIdlTargetDir := (Compile / sourceManaged).value / "compiled_openapi",
    muSrcGenIdlType := higherkindness.mu.rpc.srcgen.Model.IdlType.OpenAPI,
    sourceGenerators in Compile += (Compile / muSrcGen).taskValue
    )

    Thanks.

    Diego E. Alonso Blas
    @diesalbla
    I am afraid not. The 22 is a limitation of Scala itself.
    Dmitriy Kuzkin
    @kuzkdmy
    I got this, thanks,
    Make it working for me(just don't want to write all manually by hands)
    enable generators
    copy/paste generated code
    change case class to be class
    update endoder/decoder to be manually constructed
    disable generators
    Generally I see that this is something that can be done as part of generator, but really have no time to do a big research or contribute
    Thanks