Closed AsyncTaskSola closed 8 months ago
Use autoCreateExchange
parameter. As documentation says
If
autoCreateExchange
is true, the sink will create the exchange if an exchange by that name doesn't exist. Exchange is not created by default.
Tested and unable to reproduce
hello , I use this nuget ,when I setting this config in code .Find have a question,the rabbitmq can connect ,but can't build a exchange .Or is there something wrong with my configuration ?Nuget 6.0 and RabbitMQ 3.8.34 Log.Logger = new LoggerConfiguration() .Enrich.FromLogContext() .Enrich.WithExceptionDetails() .WriteTo.RabbitMQ((clientConfiguration, sinkconfig) => { //ConnecttoRbbitMq(); clientConfiguration.Username = "guest"; clientConfiguration.Password = "guest"; clientConfiguration.Exchange = "rqlogstashExchange"; clientConfiguration.ExchangeType = ExchangeType.Direct; clientConfiguration.DeliveryMode = RabbitMQDeliveryMode.NonDurable; clientConfiguration.RouteKey = "rqlogstash"; clientConfiguration.Port = 5672; clientConfiguration.Hostnames.Add("127.0.0.1"); sinkconfig.TextFormatter = new JsonFormatter(); }) .ReadFrom.Configuration(configuration) .CreateLogger();