This repository was archived by the owner on Jul 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMeshHandshakeFunction.cs
More file actions
40 lines (37 loc) · 1.5 KB
/
MeshHandshakeFunction.cs
File metadata and controls
40 lines (37 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Azure;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;
using NHS.MESH.Client.Contracts.Services;
using ServiceLayer.Mesh.Configuration;
namespace ServiceLayer.Mesh.Functions
{
public class MeshHandshakeFunction(
ILogger<MeshHandshakeFunction> logger,
IMeshOperationService meshOperationService,
IMeshHandshakeFunctionConfiguration configuration)
{
[Function("MeshHandshakeFunction")]
public async Task Run([TimerTrigger("%MeshHandshakeTimerExpression%")] TimerInfo myTimer)
{
logger.LogInformation("{FunctionName} started", nameof(MeshHandshakeFunction));
try
{
var response = await meshOperationService.MeshHandshakeAsync(configuration.NbssMeshMailboxId);
if (response.IsSuccessful)
{
logger.LogInformation("Mesh handshake completed successfully for mailbox {MailboxId}. Status: {Status}",
response.Response.MailboxId, response.IsSuccessful);
}
else
{
logger.LogWarning("Mesh handshake failed for mailbox {MailboxId}. Error: {Error}",
configuration.NbssMeshMailboxId, response.Error);
}
}
catch (Exception ex)
{
logger.LogError(ex, "An error occurred during mesh handshake for mailbox {MailboxId}.", configuration.NbssMeshMailboxId);
}
}
}
}