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

Correct Shovel struct field types #172

Closed
wants to merge 4 commits into from

Conversation

pathcl
Copy link
Contributor

@pathcl pathcl commented Dec 28, 2020

DestinationURI/SourceURI it's an slice at least in rabbitmq 3.8.9

issue related: #103

@michaelklishin
Copy link
Owner

@pathcl thank you. How can I reproduce the issue this strives to address?

@michaelklishin michaelklishin changed the title Fix/shovel struct Correct Shovel struct field types Jan 18, 2021
@michaelklishin
Copy link
Owner

michaelklishin commented Jan 18, 2021

A really basic Shovel in 3.8 uses "singular" values for source and destination URIs:

[
  {
    "node": "rabbit@warp10",
    // ...
    "name": "amqp://",
    "vhost": "/",
    "type": "dynamic",
    "state": "running",
    "src_uri": "amqp://",
    "src_protocol": "amqp091",
    "dest_protocol": "amqp091",
    "dest_uri": "amqp://",
    "src_queue": "src-queue",
    "dest_queue": "dest-queue"
  }
]

@michaelklishin
Copy link
Owner

michaelklishin commented Jan 18, 2021

I now realize the difference: the above is from the Shovel management HTTP API endpoint and #171 uses the runtime parameters endpoint, which indeed can use slightly different values. In addition, there can be multiple URIs (that are tried until one of the succeeds).

@pathcl
Copy link
Contributor Author

pathcl commented Jan 18, 2021

@michaelklishin I also noticed if we use passwords like '#123' rabbit will complain with 400 error since we're not urlencoding

@michaelklishin
Copy link
Owner

michaelklishin commented Jan 18, 2021

Percent-encoding of various parts of URIs is a separate issue. Some would argue that libraries should not do that at all.
We already percent-encode hostnames (all HTTP API clients do) but I can't think of a client that does that to Shovel URIs.

Copy link
Owner

@michaelklishin michaelklishin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this PR, tests cannot compile because they provide a single URI (which is still perfectly valid) and not an array.

We have to support both types for these fields. I'm looking into it.

@pathcl pathcl deleted the fix/shovel-struct branch January 26, 2021 15:32
michaelklishin added a commit that referenced this pull request Jan 29, 2021
This is a 3.8-specific API endpoint feature but we still
support deserialization of 3.7 responses.

Closes #172.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants