Masstransit3 - Breaking change exchange bindings

52 views
Skip to first unread message

MichaelK

unread,
Nov 9, 2016, 10:22:54 PM11/9/16
to masstransit-discuss
Hi Everyone,

Trying to upgrade from MT2 -> MT3 and ran into an interesting issue. It looks like some of the exchanges that are being created using MT3 have different durable values than what they were in MT2. Below is the error.

RabbitMQ receive transport failed: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'durable' for exchange 'XXXX-Event' in vhost 'ABC': received 'false' but current is 'true'", classId=40, methodId=10, cause=

I did some digging and figured out what the problem is. In the RabbitMQExchangeBindingsExtensions file there is a function IsTemporaryMessageType (listed below)

 public static bool IsTemporaryMessageType(this Type messageType)
        {
            return (!messageType.IsPublic && messageType.IsClass)
                || (messageType.IsGenericType && messageType.GetGenericArguments().Any(IsTemporaryMessageType));
        }


The problem here is the IsPublic check. In something that I was never truly happy with the team decided to used Nested classed to group our Events. So for example we would have a class like so

public class FooEvents 
{
    public class Created
    {
        ......
    }

  public class Withdrawn
    {
        ......
    }
}

The problem is the IsTemporaryMessageType is checking for IsPublic and this fails. Checking for IsNestedPublic returns true. A fix for this would be to check both (IsPublic or IsNestedPublic) OR even better to use IsVisible which covers both scenarios. I was thinking of creating a pull request but my issue is that we can't upgrade to the latest version of Masstransit3 (3.4.1) as that depends on Newtonsoft.Json 9.0.1. I know there were some issues with Newtonsoft as of late due to casing. I think everything is lowercase now. I would rather play it safe and see if there is a workaround. Is there a way to overload this call maybe by swapping out my own RabbitMqReceiveEndpointConfigurator? (That is where the extension method gets called)

Chris Patterson

unread,
Nov 9, 2016, 10:45:44 PM11/9/16
to masstrans...@googlegroups.com
A pull request to change to IsVisible would be most welcome.

I've seen no issues with JSON 9.0.1 in production with MT.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/82a2f639-e55a-4dfe-8d96-02ae047a15be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages