Skip to content

Commit 4355e17

Browse files
committed
Pass correct arguments
1 parent 2b5dcfc commit 4355e17

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/main/java/io/eigr/spawn/api/actors/ActorRef.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,33 @@ public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> Optional<Obj
9191
}
9292

9393
public <T extends GeneratedMessageV3> void invokeAsync(String cmd, Class<T> outputType) throws Exception {
94-
invokeActor(cmd, Empty.getDefaultInstance(), outputType, Optional.empty());
94+
InvocationOpts opts = InvocationOpts.builder().async(true).build();
95+
invokeActor(cmd, Empty.getDefaultInstance(), outputType, Optional.of(opts));
9596
}
9697

9798
public <T extends GeneratedMessageV3> void invokeAsync(String cmd, Class<T> outputType, InvocationOpts opts) throws Exception {
98-
invokeActor(cmd, Empty.getDefaultInstance(), outputType, Optional.ofNullable(opts));
99+
InvocationOpts mergedOpts = InvocationOpts.builder()
100+
.async(true)
101+
.delay(opts.getDelay())
102+
.scheduledTo(opts.getScheduledTo())
103+
.build();
104+
105+
invokeActor(cmd, Empty.getDefaultInstance(), outputType, Optional.ofNullable(mergedOpts));
99106
}
100107

101108
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeAsync(String cmd, S value, Class<T> outputType) throws Exception {
102-
invokeActor(cmd, value, outputType, Optional.empty());
109+
InvocationOpts opts = InvocationOpts.builder().async(true).build();
110+
invokeActor(cmd, value, outputType, Optional.of(opts));
103111
}
104112

105113
public <T extends GeneratedMessageV3, S extends GeneratedMessageV3> void invokeAsync(String cmd, S value, Class<T> outputType, InvocationOpts opts) throws Exception {
106-
invokeActor(cmd, value, outputType, Optional.ofNullable(opts));
114+
InvocationOpts mergedOpts = InvocationOpts.builder()
115+
.async(true)
116+
.delay(opts.getDelay())
117+
.scheduledTo(opts.getScheduledTo())
118+
.build();
119+
120+
invokeActor(cmd, value, outputType, Optional.of(mergedOpts));
107121
}
108122

109123
public String getActorSystem() {

0 commit comments

Comments
 (0)