Using Azure Function Deployment Slots with EventHub

Viewed 478

I have an Azure function app that processes data from an EventHub. My current CI/CD process uses deployment slots to deploy:

  1. Deploy function to staging slot
  2. Validate staging slot with a smoke test
  3. Swap staging with production

The CI/CD flow itself is working without issue. However, during the time my staging slot is active, I'm essentially double-processing messages off the EventHub as there are two active function apps.

What is the best practice way to handle CI/CD for integration apps like this? Is there a way to pin events to a certain slot with EventHub in the function binding? Perhaps it's unavoidable and doubling-down on idempotentency is the solution?

1 Answers

You could leverage slot sticky app settings to define which consumer group to use, which would get applied to during swap.

Do make sure you are using setting the consumer group property to an app setting reference.

With this approach, you could have a separate consumer group for the smoke test and on swap, the production consumer group would be used.

Related