Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for RabbitMq.Client v7.x #216

Open
WoozChucky opened this issue Nov 11, 2024 · 2 comments
Open

Add Support for RabbitMq.Client v7.x #216

WoozChucky opened this issue Nov 11, 2024 · 2 comments

Comments

@WoozChucky
Copy link

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)
@WoozChucky WoozChucky changed the title Add Support for RabbitMq.Client v7.0x Add Support for RabbitMq.Client v7.x Nov 11, 2024
@ArieGato
Copy link
Owner

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

@ArieGato
Copy link
Owner

Hi @WoozChucky

Support for the 7.0 client has been added to master. I want to add another breaking change, so there will be no Release soon. You could give it a go here:

https://github.com/ArieGato/serilog-sinks-rabbitmq/pkgs/nuget/Serilog.Sinks.RabbitMQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants