public Task<bool> PublishAsync(EventPublishModel model) { if (model.Type == MQPublishType.NotPublish) { return Task.FromResult(false); } else { var bufferBlock = _dataflowBufferBlockFactory.Create<EventPublishModel>(model.MQProviderName, this.LazyPublishAsync); if (model.Type == MQPublishType.Synchronous) { return bufferBlock.SendAsync(model); } else { return bufferBlock.SendAsync(model, false); } } }
public Task<bool> PublishAsync(IEvent evt, string topic, string mqProviderName, MQPublishType publishType = MQPublishType.Asynchronous) { EventPublishModel wrap = new EventPublishModel(evt, topic, mqProviderName, publishType); return this.PublishAsync(wrap); }