Expose workflow condition properties

Hi guys,

my question is related to a general architectural view. We have conditions in our workflow implementation class in order to control the workflow. How can I expose this condition in order to request the status via REST GET endpoint within a Spring Boot application? Maybe you have a best practice for that use case or a proper approach to solve the problem.

BW Maik

Hi, can you give more info about the use case?
My guess is to create rest endpoints in your app that use client apis to query your existing workflow execution and return the result back to user, but need more info to be sure thats what you are asking for.

Hi @tihomir,

we have a frontend, which communicates via REST endpoint to our Spring Boot Backend. An example use case is, a Button should only be visible in the frontend when a specific condition in the workflow was set to true. And if so, the user clicks the button, a request is send to the backend. In the endpoint a signal is send into the workflow in order to complete it. Before this point of time, our workflow is RUNNING and several times in an await state.

To sum it up, we want to have a user, who completes the workflow manually, but only if all other or specific steps have been done before. In our use case the workflow steps a reflected by boolean properties, which are used to control the waiting of a workflow.

Thanks for the info

One option could be once you start the clients workflow to periodically query it , if the workflow state query returns is true, enable the button in ui for user. User clicking on the button then would send a signal to this workflow confirming completion.
Depending on your load and time requirements you could possibly use advanced visibility as well, meaning your workflow would upsert a custom search attribute value based on your business logic and then instead of querying it directly could periodically check via visibility query, for example:
“WorkflowId=‘’ AND ExecutionStatus=‘Running’ AND MyCustomAttr=‘true’”.

Another option could be a “push” meaning once your workflow performs all the steps and comes to a point where user confirmation is needed, to run an activity/local activity (see this post for detailed info) to trigger an endpoint on your app side as notification that the user button for confirmation should be enabled.

Thanks for your answer.

Blockquote One option could be once you start the clients workflow to periodically query it , if the workflow state query returns is true, enable the button in ui for user.

Does that part of the answer belongs to advanced visibility? Because I would need a query without using elastic search. Our DevOps team set Temporal up without it. Do I have any possibility to query the state or an attribute of the workflow without elastic search? If so, a sample of how to query it would be nice. Actual, I’ve no clue how to handle it.

Does that part of the answer belongs to advanced visibility?

No, you can query a workflow execution directly, see docs here.

Yes this solution will probably work for our use case! Damn it, I haven’t seen this in the docs. Thanks for your patience.

Best Maik