http_request.proto:20:1: warning: Import google/api/annotations.proto is unused.
http_request.proto:20:1: warning: Import google/api/annotations.proto is unused.
[error] stack trace is suppressed; run last protocol / muSrcGen for the full output
[error] (protocol / muSrcGen) higherkindness.mu.rpc.srcgen.proto.ProtoSrcGenerator$ProtobufSrcGenException
[error] Total time: 5 s, completed Jun 5, 2020 8:48:21 PM
[IJ]sbt:sbt-mu-grpc> last protocol / muSrcGen
[error] higherkindness.mu.rpc.srcgen.proto.ProtoSrcGenerator$ProtobufSrcGenException
[error] (protocol / muSrcGen) higherkindness.mu.rpc.srcgen.proto.ProtoSrcGenerator$ProtobufSrcGenException
target/streams/_global/muSrcGen/_global/streams
[0m[[0m[31merror[0m] [0m[0mhigherkindness.mu.rpc.srcgen.proto.ProtoSrcGenerator$ProtobufSrcGenException[0m
[0m[[0m[31merror[0m] [0m[0m(protocol / [31mmuSrcGen[0m) higherkindness.mu.rpc.srcgen.proto.ProtoSrcGenerator$ProtobufSrcGenException[0m
Failed to parse package name: <input>:1: error: identifier expected but type found
google.logging.type
^
google.logging.type
fails here:
So, we porbably should replace it with ‘type' before parsing
Hm, I’m trying to build my protos, but there a lots of
object fs2 is not a member of package higherkindness.mu.rpc.internal.server
[error] @service(Protobuf, Identity, namespace = Some("uadc.services.v1"), methodNameStyle = Capitalize) trait SystemInstrumentsController[F[_]] {
What am I doing wrong?)
Hi, we implemented a gRPC client with mu-scala
which worked really well. However when running the client we always get the following error message:
0: Data Service Response (100): --> io.grpc.StatusRuntimeException: UNAVAILABLE: Channel shutdown invoked
io.grpc.StatusRuntimeException: UNAVAILABLE: Channel shutdown invoked
at io.grpc.Status.asRuntimeException(Status.java:533)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:460)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:689)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$900(ClientCallImpl.java:577)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:751)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:740)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Network diagnostics show that host and port is accessible.
Appearently SSL/TLS is used.
We added the certificate to the keystore as descibed here: https://www.47deg.com/blog/mu-rpc-securing-communications-with-mu/#client-6
And we still get the same error. It is quite hard to debug this.
Do you have any pointers what to look into? Is it possible to enable more verbose logging?
def run(args: Args): IO[ExitCode] = {
val channelFor: ChannelFor = ChannelForAddress(args.host, args.port)
val serviceClient: Resource[IO, DataService[IO]] = DataService.client[IO](channelFor, Nil, null)
for {
response <- serviceClient.use(client => client.ListOrders(empty.Empty()))
_ <- IO(response.take(100).dump("Data Service Response (100):").subscribe())
} yield ExitCode.Success
}
mu-scala
client
case class AuthCredentials(user: String, pass: String) extends CallCredentials {
override def applyRequestMetadata(requestInfo: RequestInfo, executor: Executor, metadataApplier: MetadataApplier): Unit =
executor.execute(new Runnable() {
override def run() =
try {
val key = Metadata.Key.of("Authorization", io.grpc.Metadata.ASCII_STRING_MARSHALLER)
val userPassBase64 = getMimeEncoder.encodeToString(s"$user:$pass".getBytes(StandardCharsets.UTF_8))
val value = s"Basic $userPassBase64"
val headers = new Metadata()
headers.put(key, value)
metadataApplier.apply(headers)
} catch {
case err: Throwable => metadataApplier.fail(Status.UNAUTHENTICATED.withCause(err))
}
})
override def thisUsesUnstableApi(): Unit = ()
}
mu-scala
? I would really appreciate some pointers :pray:
for {
response <- serviceClient.use(client => client.ListOrders(empty.Empty()))
_ <- IO(response.take(100).dump("Data Service Response (100):").subscribe())
} yield ExitCode.Success
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?
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 :)
@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
?
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