Getting Exception: The following exception when I am trying to create workflow stub within an Activity.
I did start the workflow and Worker.
Please help…
java.lang.IllegalStateException: Null workflowId. Was workflow started?
at io.temporal.internal.sync.WorkflowStubImpl.checkStarted(WorkflowStubImpl.java:370)
at io.temporal.internal.sync.WorkflowStubImpl.signal(WorkflowStubImpl.java:88)
at io.temporal.internal.sync.WorkflowInvocationHandler$SyncWorkflowInvocationHandler.signalWorkflow(WorkflowInvocationHandler.java:297)
at io.temporal.internal.sync.WorkflowInvocationHandler$SyncWorkflowInvocationHandler.invoke(WorkflowInvocationHandler.java:274)
at io.temporal.internal.sync.WorkflowInvocationHandler.invoke(WorkflowInvocationHandler.java:178)
at com.sun.proxy.$Proxy12.setCustomActivityId(Unknown Source)
at io.workshop.c1intro.AccountActivitiesImpl.notify(AccountActivitiesImpl.java:53)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Activity Code:
public class AccountActivitiesImpl implements AccountActivities {
public static final WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
public static final WorkflowClient client = WorkflowClient.newInstance(service);
public static final String taskQueue = "myTaskQueue";
NotifyUserAccounts workflow;
@Override
public String notify(String accountId) throws Exception{
You want to create a workflow stub with workflow options when the stub is used to start a workflow execution.
Also, public String notify(String accountId) throws Exception{
signaling a workflow is an async operation, the client will never get the exception thrown by this method.
Can you please clarify the later statement, is it that Signal will be sent via a separate thread hence any exception encountered while sending the signal will not be caught in the activity Implementation method.
However such exception will be caught in in the signal method.
@Krishnendu_Kunti signalWorkflow is a request that the server persists once it receives it. You will get an exception if the client can not connect to the server or the workflow execution does not exist …
The worker running the workflow execution (the one you are signaling), is continuously polling for task to execute. If it has pollers and slots available to execute workflowTasks, the worker will pull the task and deliver the signal to the workflow execution.
let me know if it helps
In your case, it looks like you are signaling the same workflow execution. What is your use case if I can ask?
Thanks for the clarification. We have a scenario where we will be using same activity more than once , where we want to display the activity with different Name.
Say we have a DB table migrate activity with method migrate , instead of calling this migrate every time we would like to show it as migrate_table1, migrate_2… etc.
We plan to achieve it by saving the activity Id and Activity given name in custom search attribute. Since we cant update search attribute inside an activity we plan to sent the details to workflow before we start an activity.
Since we will send the name / id using Signal even before we stat the Activity the Workflow instance should be available.
The requirement here is to capture same activity with different names (which I think is not possible using Dynamic Activity), Temporal already has an enhancement identified for the same.
I was able to test out Dynamic activity and it works as mentioned, however here is the problem statement:
We have existing library of activities, which users would include in their workflows , however some users might want to capture those activities with different Names. For instance there is an activity called migrate_table , but in context of workflow user may want to name it as migrate_Employee_table.
If we use Dynamic activity then I am assuming that Dynamic activity will form a Wrapper and internally call migrate_table code.
It is possible to write such a generic wrapper but the input parameter mapping needs to be coded explicitly for each such call , hence an overhead for the user (which we do not want).
Currently we are saving given activity name and activity Id as search parameters.
Please suggest what will be a good design to handle this requirement.
Need one help, I have created the following untyped stub (inside an Activity) and tried call signal method in workflow. … I am getting the following exception: