Temporal IO running activities of a workflow outside the parent workflow JAR

shivam-lal
Mon, 13 May 2024 14:15:11 +0000
Community Support

I am using temporal SDKs with Java to run a temporal workflow, which has a few activities.
The last activity is to create and send a JMS message to a message queue for asynchronous processing. Since there are no steps after sending the JMS message, the temporal workflow is deemed to be completed. The process looks like this:

Temporal workflow -> Activity 1 -> Activity 2 -> Activity 3 (Send JMS message)

However, once the JMS message is received by the listener component, I want to continue the steps carried out in this listener component as activities of the same temporal workflow (which ended when the message was sent to the JMS queue).

How do I continue the activities of the existing workflow from the listener JMS component once the JMS message is sent from the temporal workflow?
The process that I require is:

Temporal workflow -> Activity 1 -> Activity 2 -> Activity 3 (Send JMS message)
Receive JMS message (in separate component/JAR) -> Activity 4 -> Activity 5

Reasons for using a JMS consumer for Activity 4 and 5 is to process these steps asynchronously and one at a time for multiple temporal workflow executions in the order JMS messages are received. Since the JMS consumer count is 1, a new message will not be consumed and processed until the activity 4 and 5 of the previous workflow execution are completed.

I have gone through the temporal documentation, but could not find anything to run Temporal activities outside of the code where the Temporal workflow is defined.

Stack overflow link for the same question: https://stackoverflow.com/questions/78472180/temporal-io-running-activities-of-a-workflow-outside-the-parent-workflow-jar

18 posts - 3 participants