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

CAMEL-14242: Fix binding parameters with arg.- is not possible when using endpointdsl and RabbitMQ #3385

Closed
wants to merge 1 commit into from

Conversation

mikadev
Copy link
Contributor

@mikadev mikadev commented Dec 4, 2019

Trying to fix this one (https://issues.apache.org/jira/browse/CAMEL-14242) not sure about side effect but it's seem to do the job

Trying to fix this one (https://issues.apache.org/jira/browse/CAMEL-14242) not sure about side effect but it's seem to do the job
@omarsmak omarsmak changed the title Trying to fix CAMEL-14242: Fix binding parameters with arg.- is not possible when using endpointdsl and RabbitMQ Dec 5, 2019
Copy link
Member

@omarsmak omarsmak left a comment

Choose a reason for hiding this comment

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

Thanks @mikadev for the PR. I think you are heading into the right direction to fix this, good job! Some comments I added. Also, I'd appreciate if you can add a simple unit test simulating this fix, you can take a look at the a previous unit test for an example, in order to test the input of args on what do you expect if you have an input param of "arg.queue.x-max-priority" -> "10" vs "queue.x-max-priority" -> "10".
P/S: Please for the next time, please take a look at the contribution guideline, most importantly here in regards to the commit message and PR title.

@@ -185,6 +185,8 @@ protected RabbitMQEndpoint createEndpoint(String uri,
}
}

@SuppressWarnings("unchecked")
Map<String, Object> args = resolveAndRemoveReferenceParameter(params, "args", Map.class, getArgs());
Copy link
Member

Choose a reason for hiding this comment

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

I think this is not needed, under by setProperties is doing the job to resolve the args param

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as my next comment

@@ -202,6 +204,7 @@ protected RabbitMQEndpoint createEndpoint(String uri,
endpoint.setAddresses(getAddresses());
endpoint.setThreadPoolSize(getThreadPoolSize());
endpoint.setExchangeName(exchangeName);
endpoint.setArgs(args);
Copy link
Member

Choose a reason for hiding this comment

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

Same here, I think this is not needed, as this being handled by setProperties(endpoint, params);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is all the point params parameter is always an empty map where args is setting using query parameters is my PR there is something wrong i don't know where i think we have to cleanup this component

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean? What are you trying to fix exactly here? Because I feel we are mixing things up here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I trying to first getting args argument when it passed as query parameters lets just fix this for beginning

Copy link
Member

Choose a reason for hiding this comment

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

But I thought if you pass it like this rabbitmq:foo?queue=foo&arg.queue.x-max-priority=10 it will work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean ? i really didn't understand

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The case is simple how i suppose to translate this weird way &arg.queue.x-max-priority=10 of passing parameter with the new DSL

Copy link
Member

Choose a reason for hiding this comment

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

In this PR, I suggested to remove some lines from the code. This line where we are commenting now and here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But this is the main point if your remove this line i'll get an empty map

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe if you can try this and i think you'll see what i'm trying to solve

@mikadev
Copy link
Contributor Author

mikadev commented Dec 5, 2019

Thanks @mikadev for the PR. I think you are heading into the right direction to fix this, good job! Some comments I added. Also, I'd appreciate if you can add a simple unit test simulating this fix, you can take a look at the a previous unit test for an example, in order to test the input of args on what do you expect if you have an input param of "arg.queue.x-max-priority" -> "10" vs "queue.x-max-priority" -> "10".
P/S: Please for the next time, please take a look at the contribution guideline, most importantly here in regards to the commit message and PR title.

The main point is not about if we have "arg.queue.x-max-priority" -> "10" or "queue.x-max-priority" -> "10" we simply don't get any value from args when is set using query parameters

@davsclaus
Copy link
Contributor

Okay thanks @mikadev for the PR. I polished and worked on a fix with an unit test.

@davsclaus davsclaus closed this Dec 5, 2019
@jbonofre
Copy link
Member

jbonofre commented Dec 6, 2019

Sorry for the delay, the fix looks good to me. I'm doing a full pass just for the context/tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants