mirror of https://github.com/dapr/java-sdk.git
Merge branch 'master' into release-1.0
This commit is contained in:
commit
6b9a0e1bce
|
@ -26,7 +26,7 @@ jobs:
|
|||
DAPR_RUNTIME_VER: 1.0.0-rc.3
|
||||
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/3dacfb672d55f1436c249057aaebbe597e1066f3/install/install.sh
|
||||
DAPR_CLI_REF:
|
||||
DAPR_REF:
|
||||
DAPR_REF: 4899aa8fb8f7537fb10432e6cc0cfc09c572cb54
|
||||
OSSRH_USER_TOKEN: ${{ secrets.OSSRH_USER_TOKEN }}
|
||||
OSSRH_PWD_TOKEN: ${{ secrets.OSSRH_PWD_TOKEN }}
|
||||
GPG_KEY: ${{ secrets.GPG_KEY }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# ------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
# Licensed under the MIT License.
|
||||
# ------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## Dapr SDK for Java
|
||||
|
||||
[](https://github.com/dapr/java-sdk/actions?workflow=Build)
|
||||
[](https://gitter.im/Dapr/java-sdk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[](https://discord.com/channels/778680217417809931/778749797242765342)
|
||||
[](https://codecov.io/gh/dapr/java-sdk)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://search.maven.org/search?q=g:%22io.dapr%22%20AND%20a:%22dapr-sdk%22)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
~ Copyright (c) Microsoft Corporation.
|
||||
~ Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
~ Licensed under the MIT License.
|
||||
-->
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
<module name="Header">
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="header" value="/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n */"/>
|
||||
<property name="header" value="/*\n * Copyright (c) Microsoft Corporation and Dapr Contributors.\n * Licensed under the MIT License.\n */"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
@ -52,18 +52,18 @@ public class InvokeClient {
|
|||
InvokeMethodRequest request = builder
|
||||
.withBody(message)
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.withContext(getReactorContext()).build();
|
||||
.build();
|
||||
client.invokeMethod(request, TypeRef.get(byte[].class))
|
||||
.map(r -> {
|
||||
System.out.println(new String(r.getObject()));
|
||||
System.out.println(new String(r));
|
||||
return r;
|
||||
})
|
||||
.flatMap(r -> {
|
||||
InvokeMethodRequest sleepRequest = new InvokeMethodRequestBuilder(SERVICE_APP_ID, "proxy_sleep")
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.withContext(r.getContext()).build();
|
||||
.build();
|
||||
return client.invokeMethod(sleepRequest, TypeRef.get(Void.class));
|
||||
}).block();
|
||||
}).subscriberContext(getReactorContext()).block();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,8 +149,8 @@ public class TracingDemoMiddleServiceController {
|
|||
InvokeMethodRequest request = builder
|
||||
.withBody(body)
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.withContext(getReactorContext(context)).build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).map(r -> r.getObject());
|
||||
.build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).subscriberContext(getReactorContext(context));
|
||||
}
|
||||
// ...
|
||||
@PostMapping(path = "/proxy_sleep")
|
||||
|
@ -158,8 +158,8 @@ public class TracingDemoMiddleServiceController {
|
|||
InvokeMethodRequestBuilder builder = new InvokeMethodRequestBuilder(INVOKE_APP_ID, "sleep");
|
||||
InvokeMethodRequest request = builder
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.withContext(getReactorContext(context)).build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).then();
|
||||
.build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).subscriberContext(getReactorContext(context)).then();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -222,26 +222,29 @@ public class InvokeClient {
|
|||
private static final String SERVICE_APP_ID = "tracingdemoproxy";
|
||||
///...
|
||||
public static void main(String[] args) throws Exception {
|
||||
Tracer tracer = OpenTelemetryConfig.createTracer(InvokeClient.class.getCanonicalName());
|
||||
final OpenTelemetry openTelemetry = OpenTelemetryConfig.createOpenTelemetry();
|
||||
final Tracer tracer = openTelemetry.getTracer(InvokeClient.class.getCanonicalName());
|
||||
|
||||
Span span = tracer.spanBuilder("Example's Main").setSpanKind(Span.Kind.CLIENT).startSpan();
|
||||
try (DaprClient client = (new DaprClientBuilder()).build()) {
|
||||
for (String message : args) {
|
||||
try (Scope scope = tracer.withSpan(span)) {
|
||||
InvokeServiceRequestBuilder builder = new InvokeServiceRequestBuilder(SERVICE_APP_ID, "proxy_echo");
|
||||
InvokeServiceRequest request
|
||||
= builder.withBody(message).withHttpExtension(HttpExtension.POST).withContext(Context.current()).build();
|
||||
client.invokeService(request, TypeRef.get(byte[].class))
|
||||
try (Scope scope = span.makeCurrent()) {
|
||||
InvokeMethodRequestBuilder builder = new InvokeMethodRequestBuilder(SERVICE_APP_ID, "proxy_echo");
|
||||
InvokeMethodRequest request = builder
|
||||
.withBody(message)
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.build();
|
||||
client.invokeMethod(request, TypeRef.get(byte[].class))
|
||||
.map(r -> {
|
||||
System.out.println(new String(r.getObject()));
|
||||
System.out.println(new String(r));
|
||||
return r;
|
||||
})
|
||||
.flatMap(r -> {
|
||||
InvokeServiceRequest sleepRequest = new InvokeServiceRequestBuilder(SERVICE_APP_ID, "proxy_sleep")
|
||||
InvokeMethodRequest sleepRequest = new InvokeMethodRequestBuilder(SERVICE_APP_ID, "proxy_sleep")
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.withContext(r.getContext()).build();
|
||||
.build();
|
||||
return client.invokeMethod(sleepRequest, TypeRef.get(Void.class));
|
||||
}).block();
|
||||
}).subscriberContext(getReactorContext()).block();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
@ -52,8 +52,8 @@ public class TracingDemoMiddleServiceController {
|
|||
InvokeMethodRequest request = builder
|
||||
.withBody(body)
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.withContext(getReactorContext(context)).build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).map(r -> r.getObject());
|
||||
.build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).subscriberContext(getReactorContext(context));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,8 +67,8 @@ public class TracingDemoMiddleServiceController {
|
|||
InvokeMethodRequestBuilder builder = new InvokeMethodRequestBuilder(INVOKE_APP_ID, "sleep");
|
||||
InvokeMethodRequest request = builder
|
||||
.withHttpExtension(HttpExtension.POST)
|
||||
.withContext(getReactorContext(context)).build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).then();
|
||||
.build();
|
||||
return client.invokeMethod(request, TypeRef.get(byte[].class)).subscriberContext(getReactorContext(context)).then();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -16,7 +16,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<grpc.version>1.33.1</grpc.version>
|
||||
<protobuf.version>3.13.0</protobuf.version>
|
||||
<dapr.proto.baseurl>https://raw.githubusercontent.com/dapr/dapr/4a6369caaba9cf46eae9bfa4fa6e76b474854c89/dapr/proto</dapr.proto.baseurl>
|
||||
<dapr.proto.baseurl>https://raw.githubusercontent.com/dapr/dapr/4899aa8fb8f7537fb10432e6cc0cfc09c572cb54/dapr/proto</dapr.proto.baseurl>
|
||||
<os-maven-plugin.version>1.6.2</os-maven-plugin.version>
|
||||
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
|
||||
<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
@ -18,9 +18,8 @@ import reactor.core.publisher.Mono;
|
|||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* Contains methods to register actor types. Registering the types allows the
|
||||
|
@ -66,7 +65,7 @@ public class ActorRuntime implements Closeable {
|
|||
/**
|
||||
* Map of ActorType --> ActorManager.
|
||||
*/
|
||||
private final Map<String, ActorManager> actorManagers;
|
||||
private final ConcurrentMap<String, ActorManager> actorManagers;
|
||||
|
||||
/**
|
||||
* The default constructor. This should not be called directly.
|
||||
|
@ -100,7 +99,7 @@ public class ActorRuntime implements Closeable {
|
|||
}
|
||||
|
||||
this.config = new ActorRuntimeConfig();
|
||||
this.actorManagers = Collections.synchronizedMap(new HashMap<>());
|
||||
this.actorManagers = new ConcurrentHashMap<>();
|
||||
this.daprClient = daprClient;
|
||||
this.channel = channel;
|
||||
}
|
||||
|
@ -138,7 +137,7 @@ public class ActorRuntime implements Closeable {
|
|||
* @throws IOException If cannot serialize config.
|
||||
*/
|
||||
public byte[] serializeConfig() throws IOException {
|
||||
return this.INTERNAL_SERIALIZER.serialize(this.config);
|
||||
return INTERNAL_SERIALIZER.serialize(this.config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,6 +206,8 @@ public class ActorRuntime implements Closeable {
|
|||
|
||||
ActorTypeInformation<T> actorTypeInfo = ActorTypeInformation.create(clazz);
|
||||
|
||||
// Create ActorManager, if not yet registered.
|
||||
this.actorManagers.computeIfAbsent(actorTypeInfo.getName(), (k) -> {
|
||||
ActorRuntimeContext<T> context = new ActorRuntimeContext<>(
|
||||
this,
|
||||
objectSerializer,
|
||||
|
@ -214,10 +215,9 @@ public class ActorRuntime implements Closeable {
|
|||
actorTypeInfo,
|
||||
this.daprClient,
|
||||
new DaprStateAsyncProvider(this.daprClient, stateSerializer));
|
||||
|
||||
// Create ActorManagers, override existing entry if registered again.
|
||||
this.actorManagers.put(actorTypeInfo.getName(), new ActorManager<T>(context));
|
||||
this.config.addRegisteredActorType(actorTypeInfo.getName());
|
||||
return new ActorManager<T>(context);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,29 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
package io.dapr.actors.runtime;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* Represents the configuration for the Actor Runtime.
|
||||
*/
|
||||
public class ActorRuntimeConfig {
|
||||
|
||||
private Collection<String> registeredActorTypes = new ArrayList<>();
|
||||
private List<String> registeredActorTypes = new CopyOnWriteArrayList<>();
|
||||
|
||||
private Duration actorIdleTimeout;
|
||||
private volatile Duration actorIdleTimeout;
|
||||
|
||||
private Duration actorScanInterval;
|
||||
private volatile Duration actorScanInterval;
|
||||
|
||||
private Duration drainOngoingCallTimeout;
|
||||
private volatile Duration drainOngoingCallTimeout;
|
||||
|
||||
private Boolean drainBalancedActors;
|
||||
private volatile Boolean drainBalancedActors;
|
||||
|
||||
/**
|
||||
* Instantiates a new config for the Actor Runtime.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
package io.dapr.actors;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
package io.dapr.actors.client;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
package io.dapr.actors.runtime;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
package io.dapr.actors.runtime;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
* Copyright (c) Microsoft Corporation and Dapr Contributors.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue