I have an application that send some events for an Azure Service Bus Queue and a Azure Function as consumer, so I have this code for my Azure Function:
[FunctionName("application-events-consumer")]
public async Task Run([ServiceBusTrigger("events", Connection = "ServiceBusConnectionString")]
Message message,
string messageId,
ILogger log)
{
log.LogInformation($"MessageId={messageId}");
var jsonData = Encoding.UTF8.GetString(message.Body);
var settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
var deserialized = JsonConvert.DeserializeObject(jsonData, settings);
await _mediator.Publish(deserialized);
}
The problem is: We cannot run Azure Service Bus locally, so I thought about use Azure Storage Queue just for locally development because It has an emulator, I didn't have any problem to send my events to the Azure Storage Queue because I'm using an abstraction but I have a problem to read my events from the queue because my azure function uses a bind specific for Azure Service Bus so I can't read event from Azure Storage Queue, is it possible to use a bind for both cases? Azure Storage Queue and Azure Service Bus depending on my Connection String?