Skip to content

Commit 6ce5279

Browse files
committed
Adjusts
1 parent 4c0400f commit 6ce5279

File tree

7 files changed

+43
-6
lines changed

7 files changed

+43
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The second thing we have to do is add the spawn dependency to the project.
9393
<dependency>
9494
<groupId>com.github.eigr</groupId>
9595
<artifactId>spawn-java-std-sdk</artifactId>
96-
<version>v0.8.6</version>
96+
<version>v0.8.7</version>
9797
</dependency>
9898
```
9999
We're also going to configure a few things for our application build to work, including compiling the protobuf files.
@@ -127,7 +127,7 @@ See below a full example of the pom.xml file:
127127
<dependency>
128128
<groupId>com.github.eigr</groupId>
129129
<artifactId>spawn-java-std-sdk</artifactId>
130-
<version>v0.8.6</version>
130+
<version>v0.8.7</version>
131131
</dependency>
132132
<dependency>
133133
<groupId>ch.qos.logback</groupId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>io.eigr.spawn</groupId>
55
<artifactId>spawn-java-std-sdk</artifactId>
66
<packaging>jar</packaging>
7-
<version>0.8.6</version>
7+
<version>0.8.7</version>
88
<name>spawn-java-std-sdk</name>
99
<url>http://maven.apache.org</url>
1010

src/main/java/io/eigr/spawn/api/Spawn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,4 +425,4 @@ private Optional<Entity> getStatelessEntity(Class<?> actorKlass, Object arg, Act
425425
return Optional.empty();
426426
}
427427
}
428-
}
428+
}

src/main/java/io/eigr/spawn/internal/Entity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,4 +603,4 @@ private static ActorOuterClass.Kind getKind(ActorKind kind) {
603603
return ActorOuterClass.Kind.NAMED;
604604
}
605605
}
606-
}
606+
}

src/test/java/io/eigr/spawn/SpawnTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.eigr.spawn.api.exceptions.ActorCreationException;
88
import io.eigr.spawn.api.exceptions.ActorInvocationException;
99
import io.eigr.spawn.java.test.domain.Actor;
10+
import io.eigr.spawn.test.actors.ActorWithConstructor;
1011
import io.eigr.spawn.test.actors.JoeActor;
1112
import org.junit.Before;
1213
import org.junit.Test;
@@ -25,6 +26,7 @@ public void before() throws Exception {
2526
spawnSystem = new Spawn.SpawnSystem()
2627
.create("spawn-system")
2728
.withActor(JoeActor.class)
29+
.withActor(ActorWithConstructor.class, "Hello with Constructor", arg -> new ActorWithConstructor((String) arg))
2830
.withTransportOptions(
2931
TransportOpts.builder()
3032
.port(8091)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package io.eigr.spawn.test.actors;
2+
3+
import io.eigr.spawn.api.actors.ActorContext;
4+
import io.eigr.spawn.api.actors.Value;
5+
import io.eigr.spawn.api.actors.annotations.Action;
6+
import io.eigr.spawn.api.actors.annotations.stateful.StatefulNamedActor;
7+
import io.eigr.spawn.java.test.domain.Actor;
8+
9+
@StatefulNamedActor(name = "test_actor_constructor", stateType = Actor.State.class)
10+
public final class ActorWithConstructor {
11+
private final String defaultMessage;
12+
13+
public ActorWithConstructor(String defaultMessage) {
14+
this.defaultMessage = defaultMessage;
15+
}
16+
17+
@Action(inputType = Actor.Request.class)
18+
public Value setLanguage(Actor.Request msg, ActorContext<Actor.State> context) {
19+
if (context.getState().isPresent()) {
20+
}
21+
22+
return Value.at()
23+
.response(Actor.Reply.newBuilder()
24+
.setResponse(defaultMessage)
25+
.build())
26+
.state(updateState("java"))
27+
.reply();
28+
}
29+
30+
private Actor.State updateState(String language) {
31+
return Actor.State.newBuilder()
32+
.addLanguages(language)
33+
.build();
34+
}
35+
}

src/test/java/io/eigr/spawn/test/actors/JoeActor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import io.eigr.spawn.java.test.domain.Actor;
88

99
@StatefulNamedActor(name = "test_joe", stateType = Actor.State.class, channel = "test.channel")
10-
public class JoeActor {
10+
public final class JoeActor {
1111
@Action(inputType = Actor.Request.class)
1212
public Value setLanguage(Actor.Request msg, ActorContext<Actor.State> context) {
1313
if (context.getState().isPresent()) {

0 commit comments

Comments
 (0)