Queries Flashcards

(5 cards)

1
Q

What is

A

A Query is used to access the state of a Workflow without impacting its execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Query Interface

A

@WorkflowInterface
public interface MyWorkflow {

@WorkflowMethod
String workflow(String input);

@QueryMethod
String queryStatus(/arguments/);

}
Define a method that will declare the Query Type and its return value. Annotate the method with @QueryMethod

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Query Handler

A

Implementation of the method annotated with @QueryMethod
public class MyWorkflowImpl implements MyWorkflow {
private String status;
// Workflow code omitted for brevity
public String queryStatus(/arguments/) {
return this.status;
}
}
This example sets up a handler for the queryStatus() method we defined earlier. When this Query is invoked, it retrieves the value of the status which is stored in an instance variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Query Constraints

A

Query cannot include any logic that causes Command generation (such as executing Activities). Queries are intended to be read-only operations that do not alter the Workflow’s state. Including such logic causes unexpected behavior.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly