diff --git a/pom.xml b/pom.xml index 54b6ed052..120b8fb2e 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ UTF-8 - 1.33.1 + 1.39.0 3.13.0 https://raw.githubusercontent.com/dapr/dapr/v1.2.0-rc.3/dapr/proto 1.6.2 diff --git a/sdk-actors/pom.xml b/sdk-actors/pom.xml index 605027969..4d012c90f 100644 --- a/sdk-actors/pom.xml +++ b/sdk-actors/pom.xml @@ -74,6 +74,7 @@ io.grpc grpc-testing + 1.39.0 test diff --git a/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorObjectSerializer.java b/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorObjectSerializer.java index d45bd78d5..58a04f62e 100644 --- a/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorObjectSerializer.java +++ b/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorObjectSerializer.java @@ -53,7 +53,6 @@ public class ActorObjectSerializer extends ObjectSerializer { return super.serialize(state); } - /** * Faster serialization for params of Actor's timer. * @@ -136,6 +135,9 @@ public class ActorObjectSerializer extends ObjectSerializer { if (config.getDrainBalancedActors() != null) { generator.writeBooleanField("drainBalancedActors", config.getDrainBalancedActors()); } + if (config.getRemindersStoragePartitions() != null) { + generator.writeNumberField("remindersStoragePartitions", config.getRemindersStoragePartitions()); + } generator.writeEndObject(); generator.close(); writer.flush(); @@ -213,7 +215,7 @@ public class ActorObjectSerializer extends ObjectSerializer { private static Duration extractDurationOrNull(JsonNode node, String name) { JsonNode valueNode = node.get(name); if (valueNode == null) { - return null; + return null; } return DurationUtils.convertDurationFromDaprFormat(valueNode.asText()); diff --git a/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorRuntimeConfig.java b/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorRuntimeConfig.java index 64aec99c6..da66f255e 100644 --- a/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorRuntimeConfig.java +++ b/sdk-actors/src/main/java/io/dapr/actors/runtime/ActorRuntimeConfig.java @@ -26,6 +26,8 @@ public class ActorRuntimeConfig { private volatile Boolean drainBalancedActors; + private volatile Integer remindersStoragePartitions; + /** * Instantiates a new config for the Actor Runtime. */ @@ -34,6 +36,7 @@ public class ActorRuntimeConfig { /** * Adds a registered actor to the list of registered actors. + * * @param actorTypeName Actor type that was registered. * @return This instance. */ @@ -135,4 +138,24 @@ public class ActorRuntimeConfig { return this; } + /** + * Gets the number of storage partitions for Actor reminders. + * + * @return The number of Actor reminder storage partitions. + */ + public Integer getRemindersStoragePartitions() { + return remindersStoragePartitions; + } + + /** + * Sets the number of storage partitions for Actor reminders. + * + * @param remindersStoragePartitions The number of storage partitions for Actor reminders. + * @return This instance. + */ + public ActorRuntimeConfig setRemindersStoragePartitions(Integer remindersStoragePartitions) { + this.remindersStoragePartitions = remindersStoragePartitions; + return this; + } + } diff --git a/sdk-actors/src/test/java/io/dapr/actors/runtime/ActorRuntimeTest.java b/sdk-actors/src/test/java/io/dapr/actors/runtime/ActorRuntimeTest.java index 5073ec465..6a8b62b9c 100644 --- a/sdk-actors/src/test/java/io/dapr/actors/runtime/ActorRuntimeTest.java +++ b/sdk-actors/src/test/java/io/dapr/actors/runtime/ActorRuntimeTest.java @@ -27,6 +27,7 @@ public class ActorRuntimeTest { public interface MyActor { String say(); + int count(); } @@ -93,14 +94,12 @@ public class ActorRuntimeTest { @BeforeClass public static void beforeAll() throws Exception { - constructor = (Constructor) Arrays.stream(ActorRuntime.class.getDeclaredConstructors()) - .filter(c -> c.getParameters().length == 2) - .map(c -> { - c.setAccessible(true); - return c; - }) - .findFirst() - .get(); + constructor = + (Constructor) Arrays.stream(ActorRuntime.class.getDeclaredConstructors()) + .filter(c -> c.getParameters().length == 2).map(c -> { + c.setAccessible(true); + return c; + }).findFirst().get(); } @Before @@ -116,17 +115,20 @@ public class ActorRuntimeTest { @Test(expected = IllegalArgumentException.class) public void registerActorNullFactory() { - this.runtime.registerActor(MyActorImpl.class, null, new DefaultObjectSerializer(), new DefaultObjectSerializer()); + this.runtime.registerActor(MyActorImpl.class, null, new DefaultObjectSerializer(), + new DefaultObjectSerializer()); } @Test(expected = IllegalArgumentException.class) public void registerActorNullSerializer() { - this.runtime.registerActor(MyActorImpl.class, new DefaultActorFactory<>(), null, new DefaultObjectSerializer()); + this.runtime.registerActor(MyActorImpl.class, new DefaultActorFactory<>(), null, + new DefaultObjectSerializer()); } @Test(expected = IllegalArgumentException.class) public void registerActorNullStateSerializer() { - this.runtime.registerActor(MyActorImpl.class, new DefaultActorFactory<>(), new DefaultObjectSerializer(), null); + this.runtime.registerActor(MyActorImpl.class, new DefaultActorFactory<>(), + new DefaultObjectSerializer(), null); } @Test @@ -157,6 +159,13 @@ public class ActorRuntimeTest { new String(this.runtime.serializeConfig())); } + @Test + public void setRemindersStoragePartitions() throws Exception { + this.runtime.getConfig().setRemindersStoragePartitions(12); + Assert.assertEquals("{\"entities\":[],\"remindersStoragePartitions\":12}", + new String(this.runtime.serializeConfig())); + } + @Test public void invokeActor() throws Exception { String actorId = UUID.randomUUID().toString(); @@ -194,10 +203,8 @@ public class ActorRuntimeTest { deactivateCall.block(); this.runtime.invoke(ACTOR_NAME, actorId, "say", null) - .doOnError(e -> Assert.assertTrue(e.getMessage().contains("Could not find actor"))) - .doOnSuccess(s -> Assert.fail()) - .onErrorReturn("".getBytes()) - .block(); + .doOnError(e -> Assert.assertTrue(e.getMessage().contains("Could not find actor"))) + .doOnSuccess(s -> Assert.fail()).onErrorReturn("".getBytes()).block(); } @Test diff --git a/sdk-autogen/pom.xml b/sdk-autogen/pom.xml index a375f40f4..4b74addcd 100644 --- a/sdk-autogen/pom.xml +++ b/sdk-autogen/pom.xml @@ -32,26 +32,25 @@ io.grpc grpc-netty-shaded + 1.39.0 runtime io.grpc grpc-protobuf + 1.39.0 io.grpc grpc-stub + 1.39.0 io.grpc grpc-testing + 1.39.0 test - - io.grpc - grpc-stub - 1.33.1 - diff --git a/sdk-tests/pom.xml b/sdk-tests/pom.xml index eb75d40d3..2ecaedd19 100644 --- a/sdk-tests/pom.xml +++ b/sdk-tests/pom.xml @@ -28,7 +28,7 @@ 1.2.0-SNAPSHOT ${project.build.directory}/generated-sources ${project.basedir}/proto - 1.33.1 + 1.39.0 3.13.0 0.14.0 diff --git a/sdk/pom.xml b/sdk/pom.xml index c12bd1545..bdc6f4a89 100644 --- a/sdk/pom.xml +++ b/sdk/pom.xml @@ -107,7 +107,7 @@ io.grpc grpc-testing - 1.33.1 + 1.39.0 test