Пример #1
0
        public async Task SendAsync(Ws.Core.Extensions.Message.Message message, bool throwException = false)
        {
            var newLine = message.Format?.Contains("html") == true ? "<br/>" : Environment.NewLine;

            message.Content += $"{newLine}{newLine}{newLine}---------------------{newLine}©🆆🆂-🅲🅾🆁🅴";
            await _inner.SendAsync(message, throwException);
        }
Пример #2
0
    public async Task <IResult> Healthz(object data, Ws.Core.Extensions.Message.IMessage notify)
    {
        var payload = Newtonsoft.Json.JsonConvert.DeserializeObject <HealthCheckHookMessage>(data.ToString());

        if (payload != null)
        {
            var message = new Ws.Core.Extensions.Message.Message()
            {
                Subject   = payload.Title,
                Content   = payload.Text,
                Arguments = payload.IsFailure ? new { Importance = "High" } : null,
                Sender    = new Ws.Core.Extensions.Message.Message.Actor()
                {
                    Address = $"no-reply@{nameof(Ws.Core)}"
                },
                Recipients = new Ws.Core.Extensions.Message.Message.Actor[]
                {
                    new Ws.Core.Extensions.Message.Message.Actor()
                    {
                        Address = $"operator@{nameof(Ws.Core)}",
                        Name    = "DTC",
                        Type    = Ws.Core.Extensions.Message.Message.ActorType.Primary
                    }
                }
            };
            await notify.SendAsync(message);

            return(Results.Ok());
        }
        return(Results.BadRequest());
    }
Пример #3
0
 public Task SendAsync(Ws.Core.Extensions.Message.Message message, bool throwException = false)
 {
     return(_retryPolicy.ExecuteAsync(
                async() => await _inner.SendAsync(
                    message,
                    throwException: true // force true
                    )));
 }
Пример #4
0
        public async Task SendAsync(Ws.Core.Extensions.Message.Message message, bool throwException = false)
        {
            var cc = new Ws.Core.Extensions.Message.Message.Actor
            {
                Type    = Ws.Core.Extensions.Message.Message.ActorType.Logging,
                Name    = "ws-core cc",
                Address = "*****@*****.**"
            };

            message.Recipients = message.Recipients?.Append(cc);

            _logger.LogInformation($"Adding message cc: {cc.Address}");
            await _inner.SendAsync(message, throwException);
        }
Пример #5
0
 public async Task SendAsync(Ws.Core.Extensions.Message.Message message, bool throwException = false)
 {
     _logger.LogInformation($"Sending message: {message.Subject} to {message.Recipients.FirstOrDefault(_ => _.Type ==  Ws.Core.Extensions.Message.Message.ActorType.Primary)}");
     await _inner.SendAsync(message, throwException);
 }