mdevilliers / SignalR.RabbitMq

MessageBus implementation using RabbitMq as the backing store.
MIT License
89 stars 40 forks source link

Field not found: 'RabbitMQ.Client.ConnectionFactory.VirtualHost' #34

Closed daleua closed 9 years ago

daleua commented 9 years ago

Hi Mark,

I'm trying to use the SignalR.RabbitMQ project and so far seems to be working fine when I use the solution from this repository.

However, when I try to use i from an existing application that uses also RabbitMQ.Client, seems to clash somehow and gives the error in the title.

Do you have any idea what might be the issue? I tried to change RabbitMQ.Client versions, change them in a copy of your code... sometimes I get a different Field error (UserName) instead of VirtualHost.

I also posted a question in stackoverflow with more information: http://stackoverflow.com/questions/28153986/field-not-found-rabbitmq-client-connectionfactory-virtualhost

Thanks,

David

mdevilliers commented 9 years ago

Hey David - it might be that nuget has downloaded later versions of the RabbitMQ/EasyNetQ nuget packages than I have tested with and these might have introduced a runtime error . I have always tried to be very inclusive with the versions required.

Could you look at your packages folder and print the versions of RabbitMQ and EasyNetQ? And I can try and recreate the error here. A stack trace would be cool as well..

Thanks,

Mark

kntajus commented 9 years ago

This happens with the latest versions, which are currently EasyNetQ 0.42.0.357 and RabbitMQ.Client 3.4.3. The RabbitMQ.Client.ConnectionFactory.VirtualHost property looks like it disappeared between versions 3.3.5 and 3.4.0 of RabbitMQ.Client.

mdevilliers commented 9 years ago

Hey - I've just tried it locally with those versions and was unable to recreate the error. It does seem to be intermittent from the StackOverflow question.

@Kntajus can you provide a stack trace e.g. is it a runtime exception? I've checked both versions of the library and the virtualhost property is still there. The RabbitMQ.Client library has changed how it implements it recently moving it from a field to an auto property.

kntajus commented 9 years ago

Yep, it's runtime:

System.MissingFieldException: Field not found: 'RabbitMQ.Client.ConnectionFactory.VirtualHost'. at SignalR.RabbitMQ.RabbitMqScaleoutConfiguration..ctor(ConnectionFactory connectionfactory, String exchangeName, String queueName, String stampExchangeName)

The relevant code that causes this is the following:

        var factory = new ConnectionFactory
        {
            HostName = SignalrRabbitServer,
            Port = SignalrRabbitPort,
            UserName = SignalrRabbitUsername,
            Password = SignalrRabbitPassword
        };
        const string exchangeName = "SignalR.RabbitMQ-Example";
        var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName);
mdevilliers commented 9 years ago

@Kntajus @daleua

I think I've resolved all of the dependency problems - it seems the rabbitmq guys had a breaking change in their api, and then the easynetq team have had issues with the newtonsoft json library.

Anyway I've upgraded all of the dependencies to the latest and also taken the opportunity to upgrade to .net 4.5 in line with asp.net and signalr.

I've published the latest nuget package to the appveyor project nuget feed. The url is - https://ci.appveyor.com/nuget/signalr-rabbitmq-lws7u6issmhl

Instructions to add a nuget package source are at - https://docs.nuget.org/consume/Package-Manager-Dialog#user-content-package-sources

I would appreciate if you guys could give it a whirl and I'll update the official nuget feed in due course.

Thanks for your time,

Mark

daleua commented 9 years ago

Thanks Mark, I'll have a look as soon as... left this behind for a bit but I need to get back to it soon.

daleua commented 9 years ago

So far so good :) I'm going to put it on a test environment to confirm definitely it's working fine.

Thanks Mark for your help.

daleua commented 9 years ago

Yes, works great :) I had to change everything to use SignalR 2.2 with Owin and all references to EasyNetQ and RabbitMQ Client to use the latest versions but is all now working together.

kntajus commented 9 years ago

All working for me too :)

mdevilliers commented 9 years ago

Coolio - all pushed to nuget - version 2.2.3. Thanks for all of your help,

Mark