简体   繁体   中英

Send new input data to already running Orchestrator function via Http Trigger

I am currently building an Azure Durable Function that gets triggered via Http trigger. When sending the initial request to the Http Trigger I am including an API Token, which then gets passed as input to the Orchestrator, which passes this token on to the activities. Now I noticed the problem that this token sometimes expires before the Orchestrator is done, creating authentication issues.

I am already polling the intial Http trigger every few minutes and retrieving the status of the Orchestrator using the DurableOrchestrationClient.get_status() method, so I was wondering if I could somehow pass a new token to the running Orchestrator via the Http trigger every time I am doing such a polling. This would solve my authetication issue.

Looking in the docs there seems to be no functionality to simply pass new input, all I have found so far is the option to create external events that can be sent to a running orchestrator. As detailed in this link: https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-instance-management?tabs=python#send-events-to-instances

Is this my best bet of solving it?

I would avoid relying on an external party to pass in new tokens, the Orchestrator should not have to rely on such calls in order to successfully complete.

Assuming you use Azure Active Directory or a similar system, my suggestion would be to use On Behalf Flow . You would send an initial API token to your Orchestrator, also to authenticate the call to the Orchestrator. Then you use this token to get new tokens for your downstream services. With this, you will also receive refresh tokens which can be used to get new access tokens.

If you don't want/need to authenticate the Orchestrator call with the initial API token, you can also pass in a refresh token as suggested by cetver in the comments.

In this example: "Web API A" would be your Orchestrator: 代表调用者获取令牌

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM