-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c599636
commit db89db6
Showing
9 changed files
with
159 additions
and
7 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...essor-tests/rest-endpoints-descriptors/src/main/java/com/example/UserGrpcServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package com.example; | ||
|
||
import akka.javasdk.annotations.GrpcEndpoint; | ||
|
||
@GrpcEndpoint | ||
public class UserGrpcServiceImpl { | ||
// would extend generated service stub and implement grpc methods but that's not important for this test | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
akka-javasdk-tests/src/test/java/akkajavasdk/components/grpc/TestGrpcServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akkajavasdk.components.grpc; | ||
|
||
import akka.javasdk.annotations.GrpcEndpoint; | ||
import akkajavasdk.protocol.*; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.CompletionStage; | ||
|
||
@GrpcEndpoint | ||
public class TestGrpcServiceImpl implements TestGrpcService { | ||
@Override | ||
public CompletionStage<TestGrpcServiceOuterClass.Out> simple(TestGrpcServiceOuterClass.In in) { | ||
return CompletableFuture.completedFuture( | ||
TestGrpcServiceOuterClass.Out.newBuilder().setData(in.getData()).build() | ||
); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
akka-javasdk-tests/src/test/protobuf/akkajavasdk/test_grpc_service.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
|
||
// gRPC interface for a gRPC endpoint component | ||
|
||
syntax = "proto3"; | ||
|
||
package akkajavasdk; | ||
|
||
option java_package = "akkajavasdk.protocol"; | ||
|
||
message In { | ||
string data = 1; | ||
} | ||
|
||
message Out { | ||
string data = 1; | ||
} | ||
|
||
service TestGrpcService { | ||
rpc Simple(In) returns (Out) {}; | ||
} |
27 changes: 27 additions & 0 deletions
27
akka-javasdk/src/main/java/akka/javasdk/annotations/GrpcEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akka.javasdk.annotations; | ||
|
||
import java.lang.annotation.*; | ||
|
||
/** | ||
* Mark a class to be made available as a gRPC endpoint. The annotated class should extend a gRPC service interface | ||
* generated using Akka gRPC, be public and have a public constructor. | ||
* <p> | ||
* Annotated classes can accept the following types to the constructor: | ||
* <ul> | ||
* <li>{@link akka.javasdk.client.ComponentClient}</li> | ||
* <li>{@link akka.javasdk.http.HttpClientProvider}</li> | ||
* <li>{@link akka.javasdk.timer.TimerScheduler}</li> | ||
* <li>{@link akka.stream.Materializer}</li> | ||
* <li>{@link com.typesafe.config.Config}</li> | ||
* <li>Custom types provided by a {@link akka.javasdk.DependencyProvider} from the service setup</li> | ||
* </ul> | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
public @interface GrpcEndpoint { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters