I am currently working on a prototype for using Azure Function on App Service Plan with a Service Bus trigger and a staging slot. The issue is that after the swap, all running processes are failing. In our production environment we have Functions that can run up to 15 minutes and CANNOT have a retry logic and also contain Durable Functions. For me it looks like, after the swap the function fails to lock the message again. The Question is, is this behavior expected? If not, what would I need to change to fix it?
Code:
Everything in <> is just a placeholder and is filled in on the real thing.
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace ServiceBusFunctions
{
public class ServiceBusReceiver
{
private readonly ILogger<ServiceBusReceiver> _logger;
public ServiceBusReceiver(ILogger<ServiceBusReceiver> log)
{
_logger = log;
}
[FunctionName("ServiceBusReceiver")]
public async Task Run([ServiceBusTrigger("<Topic Name>", "<Subscription Name>", Connection = "ServiceBusConnection")] string mySbMsg)
{
//Delay 5 min
await Task.Delay(300000);
_logger.LogInformation("Received");
}
}
}
Pipeline:
The pipeline are just a few simple powershell scripts which start and swap and stop the slot.
Other things I have tried:
Giving the Slot access to the Service Bus
Add and remove 'WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG': '1'
Thread.Sleep in the Function (in async and sync functions)
Removing the appendAppsettings module
Using a Shared Access Key to access the Servie Bus
Problem
I am currently working on a prototype for using Azure Function on App Service Plan with a Service Bus trigger and a staging slot. The issue is that after the swap, all running processes are failing. In our production environment we have Functions that can run up to 15 minutes and CANNOT have a retry logic and also contain Durable Functions. For me it looks like, after the swap the function fails to lock the message again. The Question is, is this behavior expected? If not, what would I need to change to fix it?
Code:
Everything in <> is just a placeholder and is filled in on the real thing.
Bicep:
Module:
Function:
Pipeline:
The pipeline are just a few simple powershell scripts which start and swap and stop the slot.
Other things I have tried:
Logs: