Skip to content

Commit

Permalink
feat: add new features and new modules
Browse files Browse the repository at this point in the history
+ feat: add rpc server api
+ feat: add pubsub subscriber api
+ feat: add adaptor to capa module
+ feat: add adaptor to dapr module
+ feat: add adaptor to layotto module
+ refactor: optimize optional dependency
+ release: release 1.12.RELEASE version
  • Loading branch information
kevinten10 committed Apr 12, 2022
1 parent b667129 commit a68ea5e
Show file tree
Hide file tree
Showing 22 changed files with 2,493 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ labels: kind/bug
assignees: ''
---

- [ ] I have searched the [issues](https://github.com/reactivegroup/cloud-runtimes-jvm/issues) of this repository and believe that this is not a duplicate.
- [ ] I have searched the [issues](https://github.com/capa-cloud/cloud-runtimes-jvm/issues) of this repository and believe that this is not a duplicate.

### Environment

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Cloud Runtimes Specification for the JVM.

The Multi-Runtime Standard API for Mecha architecture Projects:

+ [capa](https://github.com/reactivegroup/capa) (used)
+ [capa](https://github.com/capa-cloud/capa) (used)
+ [dapr](https://docs.dapr.io/concepts/building-blocks-concept/) (follow)
+ [layotto](https://github.com/mosn/layotto) (follow)
+ ....
Expand Down Expand Up @@ -50,7 +50,7 @@ For a Maven project, add the following to your `pom.xml` file:
<dependency>
<groupId>group.rxcloud</groupId>
<artifactId>cloud-runtimes-api</artifactId>
<version>1.11.RELEASE</version>
<version>1.12.RELEASE</version>
</dependency>
...
</dependencies>
Expand All @@ -64,6 +64,6 @@ For a Gradle project, add the following to your `build.gradle` file:
dependencies {
...
// https://mvnrepository.com/artifact/group.rxcloud/cloud-runtimes-api
implementation group: 'group.rxcloud', name: 'cloud-runtimes-api', version: '1.11.RELEASE'
implementation group: 'group.rxcloud', name: 'cloud-runtimes-api', version: '1.12.RELEASE'
}
```
6 changes: 2 additions & 4 deletions cloud-runtimes-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>group.rxcloud</groupId>
<artifactId>cloud-runtimes</artifactId>
<version>1.11.RELEASE</version>
<version>1.12.RELEASE</version>
</parent>

<artifactId>cloud-runtimes-api</artifactId>
Expand All @@ -35,28 +35,26 @@
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor-core.version}</version>
<optional>true</optional>
</dependency>

<!-- open-telemetry-api -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>${open.telemetry.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api-metrics</artifactId>
<version>${open.telemetry.version.alpha}</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
<optional>true</optional>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import group.rxcloud.cloudruntimes.domain.core.configuration.SubConfigurationResp;
import group.rxcloud.cloudruntimes.domain.core.invocation.HttpExtension;
import group.rxcloud.cloudruntimes.domain.core.invocation.InvokeMethodRequest;
import group.rxcloud.cloudruntimes.domain.core.invocation.RegisterServerRequest;
import group.rxcloud.cloudruntimes.domain.core.pubsub.PublishEventRequest;
import group.rxcloud.cloudruntimes.domain.core.pubsub.TopicEventRequest;
import group.rxcloud.cloudruntimes.domain.core.pubsub.TopicSubscription;
import group.rxcloud.cloudruntimes.domain.core.secrets.GetBulkSecretRequest;
import group.rxcloud.cloudruntimes.domain.core.secrets.GetSecretRequest;
import group.rxcloud.cloudruntimes.domain.core.state.DeleteStateRequest;
Expand Down Expand Up @@ -65,12 +68,16 @@

import java.util.List;
import java.util.Map;
import java.util.function.Function;

/**
* An exception is thrown by default, and some functions can be implemented on demand.
*/
public interface DefaultCloudRuntimesClient extends CloudRuntimesClient {

@Override
List<String> registryNames();

@Override
default Mono<Void> waitForSidecar(int timeoutInMilliseconds) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
Expand Down Expand Up @@ -166,6 +173,16 @@ default <T> Mono<T> invokeMethod(InvokeMethodRequest invokeMethodRequest, TypeRe
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default <T, R> Mono<Boolean> registerMethod(String methodName, List<HttpExtension> httpExtensions, Function<T, R> onInvoke, Map<String, String> metadata) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Mono<Boolean> registerServer(RegisterServerRequest registerServerRequest) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Mono<String> publishEvent(String pubsubName, String topicName, Object data) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
Expand All @@ -181,6 +198,16 @@ default Mono<String> publishEvent(PublishEventRequest request) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Flux<TopicEventRequest> subscribeEvents(String pubsubName, String topicName, Map<String, String> metadata) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Flux<TopicEventRequest> subscribeEvents(TopicSubscription topicSubscription) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
default Mono<Map<String, String>> getSecret(String storeName, String secretName, Map<String, String> metadata) {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
Expand Down Expand Up @@ -501,9 +528,6 @@ default Mono<Void> shutdown() {
throw new UnsupportedOperationException("CloudRuntimes Operate Unsupported.");
}

@Override
List<String> registryNames();

@Override
void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,31 @@

import group.rxcloud.cloudruntimes.domain.core.invocation.HttpExtension;
import group.rxcloud.cloudruntimes.domain.core.invocation.InvokeMethodRequest;
import group.rxcloud.cloudruntimes.domain.core.invocation.RegisterServerRequest;
import group.rxcloud.cloudruntimes.utils.TypeRef;
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

/**
* Service-to-Service Invocation Runtimes standard API defined.
*/
public interface InvocationRuntimes {

// -- Runtime as Client

/**
* Invoke a service method, using serialization.
*
* @param <T> The Type of the return, use byte[] to skip serialization.
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in data.
* @param type The Type needed as return for the call.
* @param <T> The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
<T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
Expand All @@ -47,14 +51,13 @@ <T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpEx
/**
* Invoke a service method, using serialization.
*
* @param <T> The Type of the return, use byte[] to skip serialization.
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @param clazz The type needed as return for the call.
* @param <T> The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
<T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
Expand All @@ -63,13 +66,12 @@ <T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpEx
/**
* Invoke a service method, using serialization.
*
* @param <T> The Type of the return, use byte[] to skip serialization.
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param type The Type needed as return for the call.
* @param <T> The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
<T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
Expand All @@ -78,13 +80,12 @@ <T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpEx
/**
* Invoke a service method, using serialization.
*
* @param <T> The Type of the return, use byte[] to skip serialization.
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param clazz The type needed as return for the call.
* @param <T> The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
<T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension,
Expand All @@ -93,13 +94,12 @@ <T> Mono<T> invokeMethod(String appId, String methodName, Object request, HttpEx
/**
* Invoke a service method, using serialization.
*
* @param <T> The Type of the return, use byte[] to skip serialization.
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @param type The Type needed as return for the call.
* @param <T> The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
<T> Mono<T> invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map<String, String> metadata,
Expand All @@ -108,13 +108,12 @@ <T> Mono<T> invokeMethod(String appId, String methodName, HttpExtension httpExte
/**
* Invoke a service method, using serialization.
*
* @param <T> The Type of the return, use byte[] to skip serialization.
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @param clazz The type needed as return for the call.
* @param <T> The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
<T> Mono<T> invokeMethod(String appId, String methodName, HttpExtension httpExtension, Map<String, String> metadata,
Expand All @@ -126,8 +125,7 @@ <T> Mono<T> invokeMethod(String appId, String methodName, HttpExtension httpExte
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @return A Mono Plan of type Void.
*/
Expand All @@ -140,8 +138,7 @@ Mono<Void> invokeMethod(String appId, String methodName, Object request, HttpExt
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @return A Mono Plan of type Void.
*/
Mono<Void> invokeMethod(String appId, String methodName, Object request, HttpExtension httpExtension);
Expand All @@ -151,8 +148,7 @@ Mono<Void> invokeMethod(String appId, String methodName, Object request, HttpExt
*
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @return A Mono Plan of type Void.
*/
Expand All @@ -164,8 +160,7 @@ Mono<Void> invokeMethod(String appId, String methodName, Object request, HttpExt
* @param appId The Application ID where the service is.
* @param methodName The actual Method to be call in the application.
* @param request The request to be sent to invoke the service, use byte[] to skip serialization.
* @param httpExtension Additional fields that are needed if the receiving app is listening on
* HTTP, {@link HttpExtension#NONE} otherwise.
* @param httpExtension Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be sent in request.
* @return A Mono Plan of type byte[].
*/
Expand All @@ -175,10 +170,35 @@ Mono<byte[]> invokeMethod(String appId, String methodName, byte[] request, HttpE
/**
* Invoke a service method.
*
* @param <T> The Type of the return, use byte[] to skip serialization.
* @param invokeMethodRequest Request object.
* @param type The Type needed as return for the call.
* @param <T> The Type of the return, use byte[] to skip serialization.
* @return A Mono Plan of type T.
*/
<T> Mono<T> invokeMethod(InvokeMethodRequest invokeMethodRequest, TypeRef<T> type);

// -- Runtime as Server

/**
* Register onInvoke method when runtime as server.
*
* @param <T> The Type of the request type, use byte[] to skip serialization.
* @param <R> The Type of the response type, use byte[] to skip serialization.
* @param methodName The actual Method to be call in the application.
* @param httpExtensions Additional fields that are needed if the receiving app is listening on HTTP, {@link HttpExtension#NONE} otherwise.
* @param onInvoke the on invoke
* @param metadata Metadata (in GRPC) or headers (in HTTP) to be received in request.
* @return A Mono Plan of register result.
*/
<T, R> Mono<Boolean> registerMethod(String methodName, List<HttpExtension> httpExtensions,
Function<T, R> onInvoke,
Map<String, String> metadata);

/**
* Register controller class when runtime as server.
*
* @param registerServerRequest the register server request
* @return A Mono Plan of register result.
*/
Mono<Boolean> registerServer(RegisterServerRequest registerServerRequest);
}
Loading

0 comments on commit a68ea5e

Please sign in to comment.