Exemplo n.º 1
0
 public async Task<bool> Publish(string topic, EventModel model, IRabbitProducer producer)
 {
     var message = new PublishMessage(model, this._serializer);
     bool ret = await producer.Publish(topic, topic, message);
     this.EnqueuePool(producer);
     return ret;
 }
Exemplo n.º 2
0
 public Task <bool> Publish(string exchange, string routingKey, PublishMessage message)
 {
     try
     {
         var data = this._serializer.Serialize(message);
         this._channel.Model.BasicPublish(exchange, routingKey, null, data);
         return(Task.FromResult(true));
     }
     catch (Exception ex)
     {
         this._logger.LogError(ex, $"{providerName}-{exchange}&{routingKey} RabbitMQ publishing failed");
         return(Task.FromResult(false));
     }
 }