{"id":15289113,"url":"https://github.com/ollls/qh2_grpc","last_synced_at":"2025-08-04T07:10:34.190Z","repository":{"id":246587244,"uuid":"821553889","full_name":"ollls/qh2_grpc","owner":"ollls","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-04T17:41:52.000Z","size":82,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T05:44:49.371Z","etag":null,"topics":["grpc","quartz-h2","scala"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ollls.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-28T20:08:43.000Z","updated_at":"2024-07-09T18:27:51.000Z","dependencies_parsed_at":"2024-10-14T19:41:45.392Z","dependency_job_id":"e1511141-cf3f-4bbe-b8e7-2c16cadd7223","html_url":"https://github.com/ollls/qh2_grpc","commit_stats":null,"previous_names":["ollls/qh2_grpc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ollls/qh2_grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ollls%2Fqh2_grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ollls%2Fqh2_grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ollls%2Fqh2_grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ollls%2Fqh2_grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ollls","download_url":"https://codeload.github.com/ollls/qh2_grpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ollls%2Fqh2_grpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268660145,"owners_count":24286028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc","quartz-h2","scala"],"created_at":"2024-09-30T15:59:18.736Z","updated_at":"2025-08-04T07:10:34.130Z","avatar_url":"https://github.com/ollls.png","language":"Scala","readme":"PoC Quartz-H2 and sbt-fs2-grpc plugin.\n\nWe use generated models and Marshallers from sbt-fs2-grpc but to call the actual service methods we use scala 3.3 macro.\n\n\nTests with gcpcurl: UnaryToUnary, UnaryToStream, StreamToUnary, StreamToStream\n```\ngrpcurl -v -insecure -proto orders.proto -d '{\"name\" : \"John The Cube Jr\", \"number\":101 }' localhost:8443 com.example.protos.Greeter/SayHello\ngrpcurl -v -insecure -proto orders.proto -d '{\"name\" : \"John The Cube Jr\", \"number\":101 }' localhost:8443 com.example.protos.Greeter/LotsOfReplies\ngrpcurl -v -insecure -proto orders.proto -d '{\"name\" : \"MESSAGE1\", \"number\":101 } {\"name\" : \"MESSAGE2\", \"number\":101 }' localhost:8443 com.example.protos.Greeter/LotsOfGreetings\ngrpcurl -v -insecure -proto orders.proto -d '{\"name\" : \"John The Cube Jr\", \"number\":101 } {\"name\" : \"George The King\", \"number\":101 }' localhost:8443 com.example.protos.Greeter/BidiHello \n```\n\nUniversal grpc router for quartz with scala 3 macro.\n\nTo call service method directly with fs2 streaming with IO context we use\n* ServerServiceDefinition\n* TraitMethodFinder.getAllMethods[GreeterService] which was done with scala3 macro.\n\n```scala\n  def run(args: List[String]) = {\n\n    val greeterService: Resource[IO, ServerServiceDefinition] =\n      GreeterFs2Grpc.bindServiceResource[IO](new GreeterService)\n\n    val exitCode = greeterService.use { sd =\u003e\n      for {\n        _ \u003c- IO(QuartzH2Server.setLoggingLevel(Level.DEBUG))\n        ctx \u003c- QuartzH2Server.buildSSLContext(\n          \"TLSv1.3\",\n          \"keystore.jks\",\n          \"password\"\n        )\n        grpcIO \u003c- IO(\n          Router[GreeterService](\n            service,\n            sd,\n            TraitMethodFinder.getAllMethods[GreeterService]\n          ).getIO\n        )\n        exitCode \u003c- new QuartzH2Server(\n          \"localhost\",\n          8443,\n          32000,\n          Some(ctx)\n        ).start(grpcIO, sync = false)\n      } yield (exitCode)\n    }\n    exitCode\n  }\n```\n\nREST Style interraction with grpc clients also possible.\n\n```scala\n\n val R: HttpRouteIO = {\n    case req @ POST -\u003e Root / \"com.example.protos.Greeter\" / \"SayHello\" =\u003e\n      for {\n        request \u003c- req.body\n        io \u003c- service._sayHello(request, null)\n\n      } yield (Response\n        .Ok()\n        .trailers(\n          Headers(\n            \"grpc-status\" -\u003e \"0\",\n            \"grpc-message\" -\u003e \"ok\",\n            \"content-type\" -\u003e \"application/grpc\"\n          )\n        )\n        .hdr(\"content-type\" -\u003e \"application/grpc\"))\n        .asStream(\n          Stream.emits(io.toByteArray)\n        )\n  }\n\n```\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Follls%2Fqh2_grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Follls%2Fqh2_grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Follls%2Fqh2_grpc/lists"}