using DotNetCore.CAP; namespace Ds.Module.MediatR { public class DistributedEventBus : IDistrbutedEventBus { private readonly ICapPublisher _capPublisher; public DistributedEventBus(ICapPublisher capPublisher) { _capPublisher = capPublisher; } public void Publish(string name, T? contentObj, string? callbackName = null) where T : IIntegrationEvent { _capPublisher.Publish(name, contentObj, callbackName); } public void Publish(string name, T? contentObj, IDictionary headers) where T : IIntegrationEvent { _capPublisher.Publish(name, contentObj, headers); } public async Task PublishAsync(string name, T? contentObj, string? callbackName = null, CancellationToken cancellationToken = default) where T : IIntegrationEvent { await _capPublisher.PublishAsync(name, contentObj, callbackName, cancellationToken); } public async Task PublishAsync(string name, T? contentObj, IDictionary headers, CancellationToken cancellationToken = default) where T : IIntegrationEvent { await _capPublisher.PublishAsync(name, contentObj, headers, cancellationToken); } public void PublishDelay(TimeSpan delayTime, string name, T? contentObj, IDictionary headers) where T : IIntegrationEvent { _capPublisher.PublishDelay(delayTime, name, contentObj, headers); } public void PublishDelay(TimeSpan delayTime, string name, T? contentObj, string? callbackName = null) where T : IIntegrationEvent { _capPublisher.PublishDelay(delayTime, name, contentObj, callbackName); } public async Task PublishDelayAsync(TimeSpan delayTime, string name, T? contentObj, IDictionary headers, CancellationToken cancellationToken = default) where T : IIntegrationEvent { await _capPublisher.PublishDelayAsync(delayTime, name, contentObj, headers, cancellationToken); } public async Task PublishDelayAsync(TimeSpan delayTime, string name, T? contentObj, string? callbackName = null, CancellationToken cancellationToken = default) where T : IIntegrationEvent { await _capPublisher.PublishDelayAsync(delayTime, name, contentObj, callbackName, cancellationToken); } } }