DescribeTaskRequest Not Working As Expected for Java SDK

Hello!

I tried to follow the instructions here for making a DescribeTaskQueueRequest and it’s not going as expected using the java-sdk.

When I use the tctl equivalent it returns expected data.

I believe we’re still on Temporal v1.10.0, but I tested locally with a more current version of Temporal and the same issue happens. Returns 0 pollers even though I suspect that to be false.
In fact, I can also see via the UI as well that the task queue does have pollers.

So where am I going wrong with the java-sdk? Ultimately, we want to guard against accidentally deleting a worker from a task queue so we want to implement this as a health check as part of our deployments.

Thanks!

        TASK_QUEUE_MAP.forEach((key, value) -> {
            LOGGER.info("{} -- {}", key, value);
            final var tq = TaskQueue.newBuilder().setName(value).build();
            final var describeTaskQueue = DescribeTaskQueueRequest.newBuilder()
                .setNamespace(namespace)
                .setTaskQueue(tq)
                .build();
            final var result = test.blockingStub().describeTaskQueue(describeTaskQueue);
            LOGGER.info("Here is you pollers list:\n\n{}", result.getPollersCount()); // this always returns 0

Seems you are missing some properties to set and also its bit tricky as you have to set task queue type to “workflow” or “activity” worker.
This code worked for me to get count of workflow worker polling on task queue, hope it helps.

 DescribeTaskQueueResponse res =
        service
            .blockingStub()
            .describeTaskQueue(
                DescribeTaskQueueRequest.newBuilder()
                    .setTaskQueue(
                        TaskQueue.newBuilder()
                            .setKind(TaskQueueKind.TASK_QUEUE_KIND_NORMAL)
                            .setName(TASK_QUEUE)
                            .build())
                    .setNamespace(NAMESPACE)
                    .setTaskQueueType(TaskQueueType.TASK_QUEUE_TYPE_WORKFLOW)
                    .setIncludeTaskQueueStatus(true)
                    .build());
1 Like