RabbitMq bus.Publish method fails and not throwing any exception

77 Views Asked by At

I have a service that publishes to RabbitMq queue,the Publish method was still working fine but now after a few days does not Publish messages and is not throwing any errors,i have tried debbuging and tripple checking my RabbitQ settings and everything looks fine.If anyone can help,what could be the reason that the code stops after the Publish method is executed and no error is thrown,the application just stops?

My Code below

try
  {
    var Employees= await _empRepository.GetPhase1Employees(); //List of EmployeeEvent model
    //batch of 5
    int batchSize = 5;

    for (int i = 0; i < Employees.Count; i += batchSize)
    {
      var batchEmployees = Employees.Skip(i).Take(batchSize).ToList();

      var response = new { Employees = batchEmployees };
      var createEmployeeEventMsg = Impromptu.ActLike<IEmployeeEvent>(response);
      await _bus.Publish<IEmployeeEvent>((object)createEmployeeEventMsg);//fails and stops here
    }
  }
  catch (Exception ex)
  {
    _loggerService.LogInformation("Could not Publish Employees", ex.Message);
  }
}

I tried Debbuging and stepping through the code,but my problem is no error is thrown hence i dont know what the issue might be.

0

There are 0 best solutions below