-
Notifications
You must be signed in to change notification settings - Fork 0
Retrieving messages
Vivek Maurya edited this page Nov 17, 2022
·
1 revision
Here we are trying to retrieve messages using azure functions
as soon as a message is sent to the queue the function gets triggered and message is retrieved
public class ProcessOrder
{
private readonly IOrder _order;
private readonly ILogger<ProcessOrder> _logger;
public ProcessOrder(IOrder order, ILogger<ProcessOrder> logger)
{
_order = order;
_logger = logger;
}
[FunctionName("ProcessOrder")]
public void Run([QueueTrigger("order-queue", Connection = "OrderQueueConnection")]string message)
{
_logger.LogInformation($"C# Queue trigger function processed: {message}");
var order = JsonSerializer.Deserialize<Order>(message);
_order.ExecuteOrder(order);
}
}