I am starting a workflow and have a workflowId constant for a Id, and i have put one of the activity on hold time and how do we send signal on workflowid from different App based on event , so we can stop the activity which is in Hold, i am looking java example
1 Like
Temporal doesn’t have a concept of “on-hold activity”. What do you mean by this?
1 Like
if a work flow with work flow Id going on with two activities
- with thread.sleep(1msec) → activity 1
- with thread.sleep(20000msec) → activity 2 → can we send a signal to that work flow to stop or mark it success? or do something on that activity 2 ,
- signal mean in temporal space signal to existing work flow id only righ
1 Like
@WorkflowInterface
public interface HelloWorkflowWorkflow extends Retryable {
@WorkflowMethod
String enrichCalls(String name);
@SignalMethod (name = "ExecutionWorkflow-v1")
void resolveHold();
}
Activity impl
public class CreateOrderImpl implements CreateOrder {
@Override
public String createOrder(String name) {
return "OrderCreated";
}
@Override
public String holdOrderWithRemorse(String name) {
try {
Thread.sleep(60000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return "Released";
}
}
worker imple
@Override
public String enrichCalls(String name){
System.out.println("HelloWorkflowWorkflowImpl.greetSomeone");
System.out.println();
String merch =activities.createOrder(name);
// System.out.println("Id dddd"+ merch);
String storeview =activities.holdOrderWithRemorse(name);
// System.out.println("storeview ddd"+ storeview);
return storeview;
}
@Override
public void resolveHold() {
System.out.println("resolvehold");
}
and
two app codes that trigger worker
HelloWorkflowWorkflow workflow = client.newWorkflowStub(HelloWorkflowWorkflow.class, options);
second app code
to send signal
WorkflowStub workflow = client.newUntypedWorkflowStub("HelloWorkflowWorkflow");
workflow.signal("ExecutionWorkflow-v1", null);
String greeting = workflow.enrichCalls("World2");
I don’t understand why you would sleep in an activity instead of using Workflow.await
or Workflow.sleep
.