Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.encoding>UTF-8</project.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<caffeine.version>3.1.8</caffeine.version>
<junit.version>4.13.2</junit.version>
<mysql-connector.version>8.0.33</mysql-connector.version>
<okhttp.version>4.10.0</okhttp.version>
<protobuf.version>3.22.2</protobuf.version>
<testcontainers.version>1.17.6</testcontainers.version>
<mysql-connector.version>8.4.0</mysql-connector.version>
<okhttp.version>4.12.0</okhttp.version>
<protobuf.version>4.26.1</protobuf.version>
<testcontainers.version>1.19.8</testcontainers.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -110,9 +110,9 @@
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.19.2:exe:${os.detected.classifier}</protocArtifact>
<protocArtifact>com.google.protobuf:protoc:4.26.1:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.47.0:exe:${os.detected.classifier}</pluginArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.64.0:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/io/eigr/spawn/api/ActorRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.github.benmanes.caffeine.cache.Cache;
import com.google.protobuf.Any;
import com.google.protobuf.Empty;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;
import io.eigr.functions.protocol.Protocol;
import io.eigr.functions.protocol.actors.ActorOuterClass;
import io.eigr.spawn.api.exceptions.ActorCreationException;
Expand Down Expand Up @@ -104,7 +104,7 @@ protected static void spawnAllActors(List<ActorOuterClass.ActorId> actorIds, Spa
* @return an Optional containing, or not, the response object to the Action call
* @since 0.0.1
*/
public <T extends GeneratedMessageV3> Optional<T> invoke(String action, Class<T> outputType) throws ActorInvocationException {
public <T extends GeneratedMessage> Optional<T> invoke(String action, Class<T> outputType) throws ActorInvocationException {
Optional<T> res = invokeActor(action, Empty.getDefaultInstance(), outputType, Optional.empty());
return res.map(outputType::cast);

Expand All @@ -122,7 +122,7 @@ public <T extends GeneratedMessageV3> Optional<T> invoke(String action, Class<T>
* @return an Optional containing, or not, the response object to the Action call
* @since 0.0.1
*/
public <T extends GeneratedMessageV3> Optional<T> invoke(String action, Class<T> outputType, InvocationOpts opts) throws ActorInvocationException {
public <T extends GeneratedMessage> Optional<T> invoke(String action, Class<T> outputType, InvocationOpts opts) throws ActorInvocationException {
Optional<T> res = invokeActor(action, Empty.getDefaultInstance(), outputType, Optional.ofNullable(opts));
return res.map(outputType::cast);

Expand All @@ -139,7 +139,7 @@ public <T extends GeneratedMessageV3> Optional<T> invoke(String action, Class<T>
* @return an Optional containing, or not, the response object to the Action call
* @since 0.0.1
*/
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T> invoke(String action, S value, Class<T> outputType) throws ActorInvocationException {
public <T extends GeneratedMessage, S extends GeneratedMessage> Optional<T> invoke(String action, S value, Class<T> outputType) throws ActorInvocationException {
Optional<T> res = invokeActor(action, value, outputType, Optional.empty());
return res.map(outputType::cast);

Expand All @@ -158,7 +158,7 @@ public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T>
* @return an Optional containing, or not, the response object to the Action call
* @since 0.0.1
*/
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T> invoke(String action, S value, Class<T> outputType, InvocationOpts opts) throws ActorInvocationException {
public <T extends GeneratedMessage, S extends GeneratedMessage> Optional<T> invoke(String action, S value, Class<T> outputType, InvocationOpts opts) throws ActorInvocationException {
Optional<T> res = invokeActor(action, value, outputType, Optional.ofNullable(opts));
return res.map(outputType::cast);

Expand All @@ -172,7 +172,7 @@ public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T>
* @param action name of the action to be called.
* @since 0.0.1
*/
public <T extends GeneratedMessageV3> void invokeAsync(String action) throws ActorInvocationException {
public <T extends GeneratedMessage> void invokeAsync(String action) throws ActorInvocationException {
InvocationOpts opts = InvocationOpts.builder().async(true).build();
invokeActor(action, Empty.getDefaultInstance(), null, Optional.of(opts));
}
Expand All @@ -187,7 +187,7 @@ public <T extends GeneratedMessageV3> void invokeAsync(String action) throws Act
* Please see the {@link io.eigr.spawn.api.InvocationOpts} class for more information
* @since 0.0.1
*/
public <T extends GeneratedMessageV3> void invokeAsync(String action, InvocationOpts opts) throws ActorInvocationException {
public <T extends GeneratedMessage> void invokeAsync(String action, InvocationOpts opts) throws ActorInvocationException {
InvocationOpts mergedOpts = InvocationOpts.builder()
.async(true)
.delaySeconds(opts.getDelaySeconds())
Expand All @@ -207,7 +207,7 @@ public <T extends GeneratedMessageV3> void invokeAsync(String action, Invocation
* @param value the action argument object.
* @since 0.0.1
*/
public <T extends GeneratedMessageV3> void invokeAsync(String action, T value) throws ActorInvocationException {
public <T extends GeneratedMessage> void invokeAsync(String action, T value) throws ActorInvocationException {
InvocationOpts opts = InvocationOpts.builder().async(true).build();
invokeActorAsync(action, value, Optional.of(opts));
}
Expand All @@ -223,7 +223,7 @@ public <T extends GeneratedMessageV3> void invokeAsync(String action, T value) t
* Please see the {@link io.eigr.spawn.api.InvocationOpts} class for more information
* @since 0.0.1
*/
public <T extends GeneratedMessageV3> void invokeAsync(String action, T value, InvocationOpts opts) throws ActorInvocationException {
public <T extends GeneratedMessage> void invokeAsync(String action, T value, InvocationOpts opts) throws ActorInvocationException {
InvocationOpts mergedOpts = InvocationOpts.builder()
.async(true)
.delaySeconds(opts.getDelaySeconds())
Expand Down Expand Up @@ -258,7 +258,7 @@ public boolean isUnNamedActor() {
return false;
}

private <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T> invokeActor(
private <T extends GeneratedMessage, S extends GeneratedMessage> Optional<T> invokeActor(
String cmd, S argument, Class<T> outputType, Optional<InvocationOpts> options) throws ActorInvocationException {
Objects.requireNonNull(this.actorId, "ActorId cannot be null");

Expand Down Expand Up @@ -318,7 +318,7 @@ private <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<T>
return Optional.empty();
}

private <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeActorAsync(
private <T extends GeneratedMessage, S extends GeneratedMessage> void invokeActorAsync(
String cmd, S argument, Optional<InvocationOpts> options) {
Objects.requireNonNull(this.actorId, "ActorId cannot be null");

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/io/eigr/spawn/api/actors/Value.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.eigr.spawn.api.actors;

import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;
import io.eigr.spawn.api.actors.workflows.Broadcast;
import io.eigr.spawn.api.actors.workflows.Forward;
import io.eigr.spawn.api.actors.workflows.Pipe;
Expand Down Expand Up @@ -57,11 +57,11 @@ public static Value at() {
return new Value();
}

public <R extends GeneratedMessageV3> R getResponse() {
public <R extends GeneratedMessage> R getResponse() {
return (R) response;
}

public <S extends GeneratedMessageV3> S getState() {
public <S extends GeneratedMessage> S getState() {
return (S) state;
}

Expand Down Expand Up @@ -89,17 +89,17 @@ public ResponseType getType() {
return type;
}

public <R extends GeneratedMessageV3> Value response(R value) {
public <R extends GeneratedMessage> Value response(R value) {
this.response = value;
return this;
}

public <S extends GeneratedMessageV3> Value state(S state) {
public <S extends GeneratedMessage> Value state(S state) {
this.state = state;
return this;
}

public <S extends GeneratedMessageV3> Value state(S state, boolean checkpoint) {
public <S extends GeneratedMessage> Value state(S state, boolean checkpoint) {
this.state = state;
this.checkpoint = checkpoint;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.eigr.spawn.api.actors.annotations.stateful;

import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand All @@ -14,7 +14,7 @@

String name() default "";

Class<? extends GeneratedMessageV3> stateType();
Class<? extends GeneratedMessage> stateType();

long deactivatedTimeout() default 60000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.eigr.spawn.api.actors.annotations.stateful;

import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand All @@ -14,7 +14,7 @@

String name() default "";

Class<? extends GeneratedMessageV3> stateType();
Class<? extends GeneratedMessage> stateType();

long deactivatedTimeout() default 60000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.eigr.spawn.api.actors.annotations.stateful;

import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand All @@ -14,7 +14,7 @@

String name() default "";

Class<? extends GeneratedMessageV3> stateType();
Class<? extends GeneratedMessage> stateType();

long deactivatedTimeout() default 60000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.eigr.spawn.api.actors.workflows;

import com.google.protobuf.Any;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;
import io.eigr.functions.protocol.Protocol;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;
import java.util.Optional;

public final class Broadcast<T extends GeneratedMessageV3> {
public final class Broadcast<T extends GeneratedMessage> {

private final Optional<String> channel;
private final Optional<String> action;
Expand All @@ -21,12 +21,12 @@ private Broadcast(Optional<String> channel, Optional<String> action, T payload)
}

@NotNull
public static <T extends GeneratedMessageV3> Broadcast to(String channel, String action, T payload) {
public static <T extends GeneratedMessage> Broadcast to(String channel, String action, T payload) {
return new Broadcast<T>(Optional.of(channel), Optional.of(action), payload);
}

@NotNull
public static <T extends GeneratedMessageV3> Broadcast to(String channel, T payload) {
public static <T extends GeneratedMessage> Broadcast to(String channel, T payload) {
return new Broadcast<T>(Optional.ofNullable(channel), Optional.empty(), payload);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.eigr.spawn.api.actors.workflows;

import com.google.protobuf.Any;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;
import io.eigr.functions.protocol.Protocol;
import io.eigr.functions.protocol.actors.ActorOuterClass;
import io.eigr.spawn.api.InvocationOpts;
Expand All @@ -11,7 +11,7 @@
import java.util.Optional;
import java.util.StringJoiner;

public final class SideEffect<T extends GeneratedMessageV3> {
public final class SideEffect<T extends GeneratedMessage> {

private final ActorRef actor;
private final String command;
Expand All @@ -32,11 +32,11 @@ private SideEffect(ActorRef actor, String command, T payload, InvocationOpts opt
this.opts = Optional.of(opts);
}

public static <T extends GeneratedMessageV3> SideEffect to(ActorRef actor, String command, T payload) {
public static <T extends GeneratedMessage> SideEffect to(ActorRef actor, String command, T payload) {
return new SideEffect(actor, command, payload);
}

public static <T extends GeneratedMessageV3> SideEffect to(ActorRef actor, String command, T payload, InvocationOpts opts) {
public static <T extends GeneratedMessage> SideEffect to(ActorRef actor, String command, T payload, InvocationOpts opts) {
return new SideEffect(actor, command, payload, opts);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private Protocol.ActorInvocationResponse handleRequest(HttpExchange exchange) th
Any value = actorInvocationRequest.getValue();

Optional<Value> maybeValueResponse = callAction(system, actor, parent, commandName, value, context);
log.info("Actor {} return ActorInvocationResponse for command {}. Result value: {}",
log.debug("Actor {} return ActorInvocationResponse for command {}. Result value: {}",
actor, commandName, maybeValueResponse);

if (maybeValueResponse.isPresent()) {
Expand Down