Skip to content

Commit 06a3744

Browse files
committed
use list instead of vararg
1 parent 8554198 commit 06a3744

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/io/iworkflow/core/Client.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,22 +539,22 @@ public void publishToInternalChannel(
539539
* @param workflowId required
540540
* @param workflowRunId optional, can be empty
541541
* @param internalChannelName required
542-
* @param channelMessages optional, can be null. messages in batch
542+
* @param channelMessages messages in batch
543543
* @throws NoRunningWorkflowException if the workflow is not existing or not running
544544
*/
545545
public void publishToInternalChannelBatch(
546546
final Class<? extends ObjectWorkflow> workflowClass,
547547
final String workflowId,
548548
final String workflowRunId,
549549
final String internalChannelName,
550-
final Object... channelMessages) {
550+
final List<Object> channelMessages) {
551551
final String wfType = workflowClass.getSimpleName();
552552

553553
checkWorkflowTypeExists(wfType);
554554

555555
final Class<?> channelValueType = registry.getInternalChannelTypeStore(wfType).getType(internalChannelName);
556556

557-
List<InterStateChannelPublishing> rawMessages = new ArrayList<>(channelMessages.length);
557+
List<InterStateChannelPublishing> rawMessages = new ArrayList<>(channelMessages.size());
558558
for (Object channelValue : channelMessages) {
559559
if (channelValue != null && !channelValueType.isInstance(channelValue)) {
560560
throw new IllegalArgumentException(String.format("message value is not of channel type %s", channelValueType.getName()));

src/test/java/io/iworkflow/integ/InternalChannelTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.junit.jupiter.api.BeforeEach;
1111
import org.junit.jupiter.api.Test;
1212

13+
import java.util.Arrays;
1314
import java.util.concurrent.ExecutionException;
1415

1516
public class InternalChannelTest {
@@ -37,7 +38,7 @@ public void testWaitingInternalWorkflow() throws InterruptedException {
3738
final Integer input = 1;
3839
final String runId = client.startWorkflow(
3940
WaitingInternalChannelWorkflow.class, wfId, 10, input);
40-
client.publishToInternalChannelBatch(WaitingInternalChannelWorkflow.class, wfId, "", WaitingInternalChannelWorkflow.INTER_STATE_CHANNEL_NAME, 2, 3);
41+
client.publishToInternalChannelBatch(WaitingInternalChannelWorkflow.class, wfId, runId, WaitingInternalChannelWorkflow.INTER_STATE_CHANNEL_NAME, Arrays.asList(2, 3));
4142
final Integer output = client.getSimpleWorkflowResultWithWait(Integer.class, wfId);
4243
Assertions.assertEquals(6, output);
4344
}

0 commit comments

Comments
 (0)