Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIH-0000 POC add QueueStorage function for local docker env #272

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,25 @@
"System.Memory.Data": "1.0.2"
}
},
"Azure.Storage.Common": {
"type": "Transitive",
"resolved": "12.11.0",
"contentHash": "BPZ1JwYvehHGoTSXhXfAmwtFYejJghE6dkKvpZtPIL0DulzSIJdll9OZI+h5W+3wLYK0yn5hc1r6mvId0q4npA==",
"dependencies": {
"Azure.Core": "1.24.0",
"System.IO.Hashing": "6.0.0"
}
},
"Azure.Storage.Queues": {
"type": "Transitive",
"resolved": "12.10.0",
"contentHash": "RD+rDy2O763jJXpvaOd03I3NSIrGpjq5YPzVkPydXnhMIzvjrv3X6ogDl+QgZs1ssuRcqjCh0RBvaaW6tt2EYw==",
"dependencies": {
"Azure.Storage.Common": "12.11.0",
"System.Memory.Data": "1.0.2",
"System.Text.Json": "4.7.2"
}
},
"BookingsApi.Client": {
"type": "Transitive",
"resolved": "3.0.3",
Expand Down Expand Up @@ -615,6 +634,16 @@
"Microsoft.Extensions.Azure": "1.2.0"
}
},
"Microsoft.Azure.WebJobs.Extensions.Storage.Queues": {
"type": "Transitive",
"resolved": "5.0.1",
"contentHash": "NCNMBtMOdKreEriYYLhnL1BpYwn8x1bhYAMbB7qadEvyobFyQ4j0z877TDq6S03l0aZRi3WL9XhkeiubRxneZA==",
"dependencies": {
"Azure.Storage.Queues": "12.10.0",
"Microsoft.Azure.WebJobs": "3.0.32",
"Microsoft.Extensions.Azure": "1.1.1"
}
},
"Microsoft.Azure.WebJobs.Host.Storage": {
"type": "Transitive",
"resolved": "3.0.14",
Expand Down Expand Up @@ -1550,6 +1579,11 @@
"System.Runtime": "4.3.0"
}
},
"System.IO.Hashing": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Rfm2jYCaUeGysFEZjDe7j1R4x6Z6BzumS/vUT5a1AA/AWJuGX71PoGB0RmpyX3VmrGqVnAwtfMn39OHR8Y/5+g=="
},
"System.Linq": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -2287,6 +2321,7 @@
"Microsoft.AspNetCore.Hosting": "[2.2.7, )",
"Microsoft.Azure.WebJobs": "[3.0.33, )",
"Microsoft.Azure.WebJobs.Extensions.ServiceBus": "[5.8.0, )",
"Microsoft.Azure.WebJobs.Extensions.Storage.Queues": "[5.0.1, )",
"Microsoft.Extensions.Configuration.Abstractions": "[6.0.0, )",
"Microsoft.Extensions.Configuration.KeyPerFile": "[6.0.1, )",
"Microsoft.Extensions.Configuration.UserSecrets": "[6.0.1, )",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Threading.Tasks;
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace BookingQueueSubscriber;

public class BookingQueueStorage
{
private readonly IMessageHandlerFactory _messageHandlerFactory;

public BookingQueueStorage(IMessageHandlerFactory messageHandlerFactory)
{
_messageHandlerFactory = messageHandlerFactory;
}

[FunctionName("BookingQueueStorage")]
public async Task RunAsync([QueueTrigger("%queueName%", Connection = "AzureWebJobsStorage")] string myQueueItem, ILogger logger)
{
// get handler
EventMessage eventMessage;
try
{
eventMessage = MessageSerializer.Deserialise<EventMessage>(myQueueItem);
}
catch (Exception e)
{
logger.LogCritical(e, "Unable to deserialize into EventMessage \r\n {BookingQueueItem}", myQueueItem);
throw;
}

var handler = _messageHandlerFactory.Get(eventMessage.IntegrationEvent);
logger.LogInformation("using handler {Handler}", handler.GetType());

await handler.HandleAsync(eventMessage.IntegrationEvent);
logger.LogInformation("Process message {EventMessageId} - {EventMessageIntegrationEvent}", eventMessage.Id,
eventMessage.IntegrationEvent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.33" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.8.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage.Queues" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.KeyPerFile" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@
"Microsoft.Extensions.Azure": "1.2.0"
}
},
"Microsoft.Azure.WebJobs.Extensions.Storage.Queues": {
"type": "Direct",
"requested": "[5.0.1, )",
"resolved": "5.0.1",
"contentHash": "NCNMBtMOdKreEriYYLhnL1BpYwn8x1bhYAMbB7qadEvyobFyQ4j0z877TDq6S03l0aZRi3WL9XhkeiubRxneZA==",
"dependencies": {
"Azure.Storage.Queues": "12.10.0",
"Microsoft.Azure.WebJobs": "3.0.32",
"Microsoft.Extensions.Azure": "1.1.1"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Direct",
"requested": "[6.0.0, )",
Expand Down Expand Up @@ -282,6 +293,25 @@
"System.Memory.Data": "1.0.2"
}
},
"Azure.Storage.Common": {
"type": "Transitive",
"resolved": "12.11.0",
"contentHash": "BPZ1JwYvehHGoTSXhXfAmwtFYejJghE6dkKvpZtPIL0DulzSIJdll9OZI+h5W+3wLYK0yn5hc1r6mvId0q4npA==",
"dependencies": {
"Azure.Core": "1.24.0",
"System.IO.Hashing": "6.0.0"
}
},
"Azure.Storage.Queues": {
"type": "Transitive",
"resolved": "12.10.0",
"contentHash": "RD+rDy2O763jJXpvaOd03I3NSIrGpjq5YPzVkPydXnhMIzvjrv3X6ogDl+QgZs1ssuRcqjCh0RBvaaW6tt2EYw==",
"dependencies": {
"Azure.Storage.Common": "12.11.0",
"System.Memory.Data": "1.0.2",
"System.Text.Json": "4.7.2"
}
},
"BookingsApi.Common.DotNet6": {
"type": "Transitive",
"resolved": "3.0.3",
Expand Down Expand Up @@ -1578,6 +1608,11 @@
"System.Runtime": "4.3.0"
}
},
"System.IO.Hashing": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Rfm2jYCaUeGysFEZjDe7j1R4x6Z6BzumS/vUT5a1AA/AWJuGX71PoGB0RmpyX3VmrGqVnAwtfMn39OHR8Y/5+g=="
},
"System.Linq": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down
Loading