Hello Team,
below is the temporal SDK version i am using.
<dependency>
<groupId>io.temporal</groupId>
<artifactId>temporal-sdk</artifactId>
<version>1.19.1</version>
</dependency>
I am using the java sdk
Below is my Workflow
@WorkflowInterface
public interface CreateRebetWorkFlow {
@WorkflowMethod
public String createRebet(String payload);
}
@ActivityInterface(namePrefix = "CreateRebet_")
public interface CreateRebetActivities {
public String testA(String payload);
public String testB(String payload);
public String testc(String payload);
public String testd(String payload);
}
Below is another work flow
@WorkflowInterface
public interface ProcessPaymentWorkflow {
@WorkflowMethod
String processPayment(String payload);
}
Is it possible to execute the async activity and trigger a work flow in the activity.
below is the code for activity impl
public class CreateRebetActivitiesImpl implements CreateRebetActivities {
public String testA(String payload){
System.out.println("testA")
}
public String testB(String payload){System.out.println("testB"){
public String testC(String payload){System.out.println("testc")}
public String testD(String payload){
**System.out.println("testD")**
** // code to Start work flow ProcessPaymentWorkflow**
}
}
Below is the code for workflow impl
public class CreateRebetWorkFlowImpl implements CreateRebetWorkFlow {
public String createRedeem(String payload) {
activity.testA("testA");
activity.testB("testB");
activity.testC("testC");
Promise<String> promise = Async.function(() -> {
activity.testD("testD");
}
//If i do promise.get() above async activity is getting triggred and starting the workflow in testD()(ProcessPaymentWorkflow) is getting triggred
//But without promise.get() above async activity is not getting triggred and starting the workflow in testD()(ProcessPaymentWorkflow) is not getting triggred. But the workflow(CreateRebetWorkFlow) is getting completed.
// Requirment is once testA,testB,testC gets completed send result to user and testD should be executed Asyn(dont wait for the execution to be completed) which updates certain DB calls.
//What i am expecting is i dont want to wait for the async activity for(testD) to get completed and the underlaying code should be executed and starting ProcessPaymentWorkflow in the testD() should be executed.
}
}