feat(notifications): no-SDK EWS SOAP mail sender with typed transient/permanent classification
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ZB.MOM.WW.ScadaBridge.NotificationService.Ews;
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.NotificationService;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers the shared SMTP delivery primitives consumed by the central Notification
|
||||
/// Registers the shared email delivery primitives consumed by the central Notification
|
||||
/// Outbox's <c>EmailNotificationDeliveryAdapter</c>: <see cref="NotificationOptions"/>,
|
||||
/// <see cref="OAuth2TokenService"/>, and the <see cref="ISmtpClientWrapper"/> factory.
|
||||
/// <see cref="OAuth2TokenService"/>, the <see cref="ISmtpClientWrapper"/> factory, and —
|
||||
/// for the EWS transport — <see cref="IEwsMailSender"/> with its named HTTP client.
|
||||
/// Central-only — sites no longer deliver notifications (see
|
||||
/// <c>Component-NotificationService.md</c>), and the orphaned site-shaped
|
||||
/// <c>NotificationDeliveryService</c> + <c>INotificationDeliveryService</c> contract
|
||||
@@ -30,6 +32,11 @@ public static class ServiceCollectionExtensions
|
||||
services.AddSingleton<OAuth2TokenService>();
|
||||
services.AddSingleton<Func<ISmtpClientWrapper>>(_ => () => new MailKitSmtpClientWrapper());
|
||||
|
||||
// EWS transport: a named client so the EWS calls get their own handler pool, and a
|
||||
// stateless singleton sender (credentials travel per request, never on the client).
|
||||
services.AddHttpClient(EwsSoapMailSender.HttpClientName);
|
||||
services.TryAddSingleton<IEwsMailSender, EwsSoapMailSender>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user