Does quering a workflow create task in task queue

When we run a query,

How is the worker notified to fullfill the query?

Will a query create a task in the task queue and the worker listening to that queue will fullfill it?

1 Like

Yes, queries also create tasks, but they do not affect the workflow history (are not recorded in history)

Thanks @tihomir . At the time of workflow creation we mention the task queue name so that the intended worker can pick the record from the same task queue and execute that. We are using temporal service client jar to call “Query method” where we are just providing “workflow id” at the time of calling the query method. Is Query task also gets created under the same task queue (workflow task queue)? Who decides that at run time as we are not mentioning that while calling?

Are you using
client.getWorkflowServiceStubs().blockingStub().queryWorkflow(queryWorkflowRequest) or calling the query method on a workflow stub directly or .query(...) on an untyped stub? Trying to understand what you are doing.

Yup we are following the first option you mentioned @tihomir . Please find below dummy code.

		WorkflowQuery workflowQuery = WorkflowQuery.newBuilder().setQueryType("methodName").build();

        QueryWorkflowRequest query = QueryWorkflowRequest.newBuilder()
        QueryWorkflowResponse response = workflowServiceBlockingStub.queryWorkflow(query);

The workflow task queue name is stored in the Temporal DB. So when a workflow is queried by ID the task queue is taken from the DB.

Thanks for clarifying this @maxim