ArieGato / serilog-sinks-rabbitmq

Serilog Sink for RabbitMq
Apache License 2.0
56 stars 53 forks source link

Add Support for RabbitMq.Client v7.x #216

Open WoozChucky opened 6 days ago

WoozChucky commented 6 days ago

Is your feature request related to a problem? Please describe. Since I updated my project that also makes use of the RabbitMq.Client library to version 7.0, the sink no longer works and throws a MissingMethodException.

I've tried going back to version 6.8.3 or RabbitMq.Client and the issue goes away. That's not a long term solution as we already migrated much of our codebase to 7.0 wich introduces breaking changes in the RabbitMq.Client public api.

Describe the solution you'd like Updated the Sink code that makes use of the RabbitMq.Client version 7.x

Describe alternatives you've considered Forked repo and working on updating myself.

Additional context Code sample that throws the exception: image

System.MissingMethodException: Method not found: 'Void RabbitMQ.Client.ConnectionFactory.set_AuthMechanisms(System.Collections.Generic.IList`1<RabbitMQ.Client.IAuthMechanismFactory>)'.
   at Serilog.Sinks.RabbitMQ.RabbitMQConnectionFactory.GetConnectionFactory()
   at Serilog.Sinks.RabbitMQ.RabbitMQConnectionFactory..ctor(RabbitMQClientConfiguration rabbitMQConfiguration, CancellationTokenSource cancellationTokenSource) in /_/src/Serilog.Sinks.RabbitMQ/Sinks/RabbitMQ/RabbitMQConnectionFactory.cs:line 35
   at Serilog.Sinks.RabbitMQ.RabbitMQClient..ctor(RabbitMQClientConfiguration configuration) in /_/src/Serilog.Sinks.RabbitMQ/Sinks/RabbitMQ/RabbitMQClient.cs:line 39
   at Serilog.Sinks.RabbitMQ.RabbitMQSink..ctor(RabbitMQClientConfiguration configuration, RabbitMQSinkConfiguration rabbitMQSinkConfiguration, ILogEventSink failureSink) in /_/src/Serilog.Sinks.RabbitMQ/Sinks/RabbitMQ/RabbitMQSink.cs:line 46
   at Serilog.LoggerConfigurationRabbitMQExtensions.GetPeriodicBatchingSink(RabbitMQClientConfiguration clientConfiguration, RabbitMQSinkConfiguration sinkConfiguration, ILogEventSink failureSink) in /_/src/Serilog.Sinks.RabbitMQ/LoggerConfigurationRabbitMQExtensions.cs:line 363
   at Serilog.LoggerConfigurationRabbitMQExtensions.RegisterSink(LoggerSinkConfiguration loggerSinkConfiguration, RabbitMQClientConfiguration clientConfiguration, RabbitMQSinkConfiguration sinkConfiguration, Action`1 failureSinkConfiguration) in /_/src/Serilog.Sinks.RabbitMQ/LoggerConfigurationRabbitMQExtensions.cs:line 330
   at Serilog.LoggerConfigurationRabbitMQExtensions.RabbitMQ(LoggerSinkConfiguration loggerConfiguration, String[] hostnames, String username, String password, String exchange, String exchangeType, RabbitMQDeliveryMode deliveryMode, String routeKey, Int32 port, String vHost, String clientProvidedName, UInt16 heartbeat, Boolean sslEnabled, String sslServerName, SslProtocols sslVersion, SslPolicyErrors sslAcceptablePolicyErrors, Boolean sslCheckCertificateRevocation, Int32 batchPostingLimit, TimeSpan period, Nullable`1 queueLimit, ITextFormatter formatter, Boolean autoCreateExchange, Int32 maxChannels, LogEventLevel levelSwitch, EmitEventFailureHandling emitEventFailure, Action`1 failureSinkConfiguration) in /_/src/Serilog.Sinks.RabbitMQ/LoggerConfigurationRabbitMQExtensions.cs:line 181
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
ArieGato commented 6 days ago

@WoozChucky thanks for report this issue. There's an issue for this already. #156