Worker tries to pick up wrong flow

Hi,

Im in the situation that a workers keeps polling a ‘wrong’ flow.
Both are on same namespace, how to avoid/fix this?

WorkflowClientOptions.newBuilder()
                .setNamespace(NAMESPACE_MANUAL_TASKS)
                .build();

Application: DOG
worker config:

        Worker worker = factory.newWorker(DRIVER_TASK_QUEUE);

        worker.registerWorkflowImplementationTypes(DetermineDriverWorkflowImpl.class);
        worker.registerActivitiesImplementations(determineDriverActivities.toArray()); 

Application: MASS
worker config

        Worker worker = factory.newWorker(MANUAL_TASK_QUEUE);

        worker.registerWorkflowImplementationTypes(ManualTaskWorkFlowImpl.class);
        worker.registerActivitiesImplementations(manualTaskActivities.toArray());

Application: MASS log

WARN 147944 --- [ANUAL_FLOWS": 1] i.t.i.replay.ReplayWorkflowTaskHandler   : Workflow task processing failure. startedEventId=6, WorkflowId=DRIVER-ea04e67f-1b2c-4659-ae6e-783369a71018, RunId=8c681a01-cbc4-4b44-ac3e-fcbd9eaeee4d. If seen continuously the workflow might be stuck.

java.lang.Error: Unknown workflow type "DetermineDriverWorkflow". Known types are [ManualTaskWorkFlow]
	at io.temporal.internal.sync.POJOWorkflowImplementationFactory.getWorkflowDefinition(POJOWorkflowImplementationFactory.java:240) ~[temporal-sdk-1.20.1.jar:na]

Hello

Make sure the taskqueue you schedule (start) the workflow and the one used in the factory to create the worker are the same. And that you register the implementation of the workflow execution in the worker

I guess you have to register DetermineDriverWorkflowImpl.class in Application: MASS

When you create the workflowStub, you set the taskqueue, something like:


IGreetingWorkflow workflow = client.newWorkflowStub(wfClass, WorkflowOptions.newBuilder()
                        .setTaskQueue("MyTaskqueue")
                        .build());

Workflow taks for this workflow execution with be added to “MyTaskqueue” (workflow queueue in the server)

When you create the worker, you have to specify the workflow task the worker will be polling tasks from:

Worker worker = factory.newWorker("MyTaskqueue");

and register the workflows and/or activities implementation:

        worker.registerWorkflowImplementationTypes(HelloActivity.GreetingWorkflowImpl.class);
        worker.registerActivitiesImplementations(new HelloActivity.GreetingActivitiesImpl());

I think either you are scheduling the workflow in the wrong taskqueue or you are missing registering the workflow implementation in the worker.

Antonio

It was indeed the parent flow that was creating the flow for the wrong Queue. Was mainly focusing on the both child applications/flows.

Thanks, @antonio.perez for the pointer