public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await Task.Run(() =>
     {
         IDictionary <string, Object> data = new Dictionary <string, object>();
         data.Add("type", "RabbitMQHealthCheckFromBus");
         try
         {
             bus.Publish("Test", "healthcheck.rabbitmq");
             data.Add("Connected", bus.IsConnected);
             string description = "RabbitMQHealthCheck is healthy";
             ReadOnlyDictionary <string, Object> rodata = new ReadOnlyDictionary <string, object>(data);
             return HealthCheckResult.Healthy(description, rodata);
         }
         catch (Exception ex)
         {
             string description = "RabbitMQHealthCheck is failed with exception " + ex.Message;
             ReadOnlyDictionary <string, Object> rodata = new ReadOnlyDictionary <string, object>(data);
             return HealthCheckResult.Unhealthy(description, data: rodata);
         }
     }));
 }
Ejemplo n.º 2
0
 static void publishWarehouse(EasyNetQ.IBus bus, Order order)
 {
     bus.Publish(order, order.Customer.origin);
 }