0
votes

I am using the AWS SWF Flow framework for Java and I would like to inject a Logentries Logger inside the workers so I can easily monitor them.

Right now I am instantiating a Logback logger instance in each Workflow implementation, giving it the implementation identity. However, I also want to know which worker the implementation is running on.

public class CopyWorkflowImpl implements CopyWorkflow {
private Logger log; 
private CopyActivitiesClient operations = new CopyActivitiesClientImpl();

public CopyWorkflowImpl(){
    //TODO: somehow get worker ID ?
    log = LoggerFactory.getLogger("CopyWorkflowWorker");
}

I could see that the WorkflowWorker class has a getIdentity method exactly for that, however, I can't seem to access it inside the Workflow implementation. Do you have any ideas on how I could achieve that ?

1
You want to get the Id of the workflow worker that is actually working on the workflow inside a workflow execution? Or do you want to get the workflowExecutionId or runId during the execution of the workflow? You are in the scope of a workflow here, not an actual workflow worker.mkobit
I want to get the Id of the workflow worker that is actually working on the workflow inside a workflow execution. I know the scopes are different, but I thought that maybe there is a smart way to somehow get that.Ana Todor

1 Answers

1
votes

I don't think what you're trying to do is possible, and I think it's that way by design. Within the context of the workflow, it shouldn't matter which specific worker picks up a task, because all workers on one task list should behave the same. Outside the workflow, you can find it in the ActivityTaskStartedEventAttributes.