grails-rabbitmq-native icon indicating copy to clipboard operation
grails-rabbitmq-native copied to clipboard

Using v 4.0.0 with the delayed-message plugin causes a bug related to ExchangeType enum

Open jkingexpapp opened this issue 5 years ago • 1 comments

I have defined rabbitmg block in application.groovy as such:

`rabbitmq {

connections = [
    [
        host: rabbitInfo.hostname,
        username: rabbitInfo.username,
        password: rabbitInfo.password,
        virtualHost: rabbitInfo.virtualHost ?: '/'
    ]
]

queues = [
    [
        name: "webhookRetry",
        durable: true,
        exchange: "delayExchange",
        binding: 'webhookRetryDelayed.#'
    ]
]

exchanges = [
    [
        name: "delayedExchange",
        type: "x-delayed-message",
        durable: true,
        arguments: [
            'x-delayed-type': "topic"
        ]
    ]
]

}`

When starting the application, eventually QueueBuilderImpl.configure() is called. This in turn calls parse(topConfig as Map), which then calls parseExchanges(configuration.exchanges as Collection). Inside this method, building a list of ExchangeProperties objects is attempted: this.exchanges << new ExchangeProperties(fixPropertyResolution(item)). This is the argument being passes to fixPropertyResolution(item):
image

fixPropertyResolution(item) returns: image

The issue occurs in the constructor for ExchangeProperties class: image

It tries to set the type like so: type = ExchangeType.lookup(configuration.getProperty('type', String))

This is what is returned from configuration.getProperty('type', String): image

Then that return value is passed to the lookup method for the ExchangeType enum which fails because it is doing a .valueOf on 'x-delayed-message', but only these types are defined:

image

We have a grails 3 project also that is running an older version of grails-rabbitmq-native and it seems that the ExchangeType enum (and many several other classes and methods) are not present in the 3.x release?

I was just wanting to see what the best way forward would be here.

Any feedback would be greatly appreciated.

Thanks

jkingexpapp avatar Jan 19 '20 16:01 jkingexpapp

I have the same problem on 3.4.1. Wondering if we can make a manual flag or something to allow the type to override the lookup. I am using the same delayed message plugin. Or add the x-delayed-message to the enum.

dbpatel219 avatar Mar 03 '21 15:03 dbpatel219