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

cfenv not parsing RMQ hostnames correctly #167

Open
mma-pivotal opened this issue Oct 28, 2021 · 0 comments
Open

cfenv not parsing RMQ hostnames correctly #167

mma-pivotal opened this issue Oct 28, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@mma-pivotal
Copy link

Issue Description

When a developer uses service broker to attach a multi-node RMQ cluster to his application, cfenv will only parse the 1st node and ignore the others.

Here is an example of what the ENV variables looks like for a multi-node RMQ cluster.

  "p.rabbitmq": [{
    xxx 
    "credentials": {
      xxx
      "hostname": "q-i0.rabbitmq-server.bosh.rabbitmq.bosh",
      "hostnames": [
                            "q-i0.rabbitmq-server.bosh.rabbitmq.bosh",
                            "q-i1.rabbitmq-server.bosh.rabbitmq.bosh",
                            "q-i2.rabbitmq-server.bosh.rabbitmq.bosh"
                              ],
                           }

Note that both hostname and hostnames are listed and hostnames contains the hostname for all 3 nodes.

From the official service broker documentation, both hostname and hostnames are top-level properties for AMQP connection.

The top level properties uri, uris, vhost, username, password, hostname, and hostnames provide access to the AMQP 0.9.1 protocol.

However, AmqpCfEnvProcessor calls cfCredentials.getHost() which only parse host and hostname from ENV.

This leads to application totally ignoring the other nodes in RMQ cluster.

An example of ENV parsed by AmqpCfEnvProcessor can be found below.

      "name": "AmqpCfEnvProcessor",
      "properties": {
        "spring.rabbitmq.host": {
          "value": "q-i0.rabbitmq-server.bosh.rabbitmq.bosh"
        },
        "spring.rabbitmq.password": {
          "value": "******"
        },
        "spring.rabbitmq.username": {
          "value": "09db23ac-0c02-46a9-8959-20729bcf1770"
        },
        "spring.rabbitmq.ssl.enabled": {
          "value": "true"
        },
        "spring.rabbitmq.port": {
          "value": "5671"
        },
        "spring.rabbitmq.virtualHost": {
          "value": "b7124f11-7685-4873-a3e4-24ac9ed3cdba"
        }
      }

As you can see, there is only 1 host.

Expected behavior
AmqpCfEnvProcessor able to parse all nodes from the hostnames ENV variable.

@pivotal-david-osullivan pivotal-david-osullivan added the enhancement New feature or request label Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants