3

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?

4
  • This is an interesting question since Event Hubs will allow only one active deployment against a certain consumer group. I wonder if you are deploying both production and staging targeting the same EH consumer group. Commented Oct 2, 2020 at 17:04
  • Yes, I'm actually specifying the consumer group in the function so the staging slot should be using the same as production. It seems strange to make a consumer group for staging, especially given that it would double my cost. Maybe the way I'm using the staging slot as a primer into prod is misguided? Commented Oct 2, 2020 at 19:54
  • Since these are different slots for the same deployment, I would expect service to trigger only production slot function and avoid duplicates. Maybe someone from Functions can help to correct my understanding. Commented Oct 2, 2020 at 21:06
  • @SerkantKaraca - do you have anyone from that team you could mention for assistance? Commented Oct 4, 2020 at 12:16

1 Answer 1

3

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.

1
  • The "Deployment slot setting" option was exactly what I needed here. Thank you! Commented Nov 19, 2020 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.