How to get task queue name inside activity?

I want to assert that activities are being run on the correct task queue: e.g. I want every activity that calls a specific 3rd-party API to only ever run on a specific task queue with maxTaskQueueActivitiesPerSecond set based on that API’s rate limit.

In the Typescript SDK, is there a way to get the current task queue name inside an activity? (Also open to other approaches to enforcing this)

Hi @Kasra

you can do

Context.current().info.taskQueue

Also open to other approaches to enforcing this

I can only think of using interceptors as an alternative

export const interceptors: WorkflowInterceptorsFactory = () => ({
    outbound: [{
        async scheduleActivity(input: ActivityInput, next) {
            //input.options.taskQueue
            return next(input);
        }
    }]
});

not sure if it is a good option,

let me kwon if it helps,
Antonio

That’s what I needed! Thank you.