Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

ExchangeProperties instantiation is picking up wrong name for the exchange (v3.5.1) #160

Open
LuisMuniz opened this issue Nov 21, 2022 · 0 comments

Comments

@LuisMuniz
Copy link
Contributor

When you define an exchange to be created in the exchanges array, you expect the exchange to be created with the provided name. (This is from runtime.groovy, not the application.yml file)

This is our configuration:

        exchanges = [
                [name: "mwc.workflow", type: 'direct', durable: 'true']
        ]

However, in our gitlab runner, there appears to be an environment variable defined as RABBITMQ_NAME (because we start a rabbitmq server as a gitlab-ci service, this environment variable is automatically set).
When such a variable is set, your logic will evaluate the exchange name to the value of the environment variable.

We have created a custom version of QueueBuilderImpl and ExchangeProperties that print out some diagnostic information, because the issue only appeared in our CI environment.

This is what we get when that variable is defined:

******************************
* parseExchanges
* exchanges=[[name:mwc.workflow, type:direct, durable:true]]
* item:[name:mwc.workflow, type:direct, durable:true]
                ******************************
                ******************************
                * new DiagnosticExchangeProperties
                * configuration=[rabbitmq.rabbitmq.type:direct, rabbitmq.rabbitmq.name:mwc.workflow, rabbitmq.rabbitmq:[name:mwc.workflow, type:direct, durable:true], rabbitmq.rabbitmq.durable:true]
                * configuration.getProperty('name', String)=/runner-q6uqneu3-project-292-concurrent-0-83cc70edbf81ed37-build-2/rabbitmq
                * configuration.getProperty('durable', Boolean, durable)=true
                * configuration.getProperty('type', String)=direct
                * DiagnosticExchangeProperties: arguments={}
durable=true
type=DIRECT
connection=null
class=class com.b2boost.diagnose.DiagnosticExchangeProperties
autoDelete=false
exchangeBindings=[]
name=/runner-q6uqneu3-project-292-concurrent-0-83cc70edbf81ed37-build-2/rabbitmq
                ******************************
                ******************************
* parsed: arguments={}
durable=true
type=DIRECT
connection=null
class=class com.b2boost.diagnose.DiagnosticExchangeProperties
autoDelete=false
exchangeBindings=[]
name=/runner-q6uqneu3-project-292-concurrent-0-83cc70edbf81ed37-build-2/rabbitmq
******************************

You can see that the exchanges map contains the right name, but then inside the ExchangeProperties constructor, when you call
configuration.getProperty('name', String), the resulting value is "/runner-e5wbmsje-project-292-concurrent-0-415c6488ad4e874a-build-2/rabbitmq"

This is the value of RABBITMQ_NAME

When I call the tests but previously use unset RABBITMQ_NAME, then the plugin succeeds in creating the exchange with the proper name:

******************************
* parseExchanges
* exchanges=[[name:mwc.workflow, type:direct, durable:true]]
* item:[name:mwc.workflow, type:direct, durable:true]
                ******************************
                ******************************
                * new DiagnosticExchangeProperties
                * configuration=[rabbitmq.rabbitmq:[name:mwc.workflow, type:direct, durable:true], rabbitmq.rabbitmq.durable:true, rabbitmq.rabbitmq.name:mwc.workflow, rabbitmq.rabbitmq.type:direct]
                * configuration.getProperty('name', String)=mwc.workflow
                * configuration.getProperty('durable', Boolean, durable)=true
                * configuration.getProperty('type', String)=direct
                * DiagnosticExchangeProperties: arguments={}
durable=true
type=DIRECT
connection=null
class=class com.b2boost.diagnose.DiagnosticExchangeProperties
autoDelete=false
exchangeBindings=[]
name=mwc.workflow
                ******************************
                ******************************
* parsed: arguments={}
durable=true
type=DIRECT
connection=null
class=class com.b2boost.diagnose.DiagnosticExchangeProperties
autoDelete=false
exchangeBindings=[]
name=mwc.workflow
******************************
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant