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-17658 camel-debezium: additionalProperties are trimmed #6960

Merged

Conversation

JiriOndrusek
Copy link
Contributor

Issue: https://issues.apache.org/jira/browse/CAMEL-17658

Problem is caused not entirely by debezium component. Automatic properties configuration can "trim" property in specific cases.

  • Let say, that we have a property map.A.B=value, where map is an URI property defined as @UriParam(label = "common", prefix = "map.", multiValue = true,. Automatic configuration initialization will detect a HashMap object as a map property, but then it executes "set property A=value into HashMap (and property B is ignored)"
  • I'm trying to change mechanism to not ignore the remaining part of the property name and execute "set property A.B=value into HashMap"

I'm not sure whether this change could be approved, Therefore this is only draft and I'd like to see whether there will be some failing tests.

In case that this approach is not desired or potentially dangerous, I will fix it directly on debezium components - which is safe.

@davsclaus
Copy link
Contributor

Ah so are you saying the key in the map is a string with a dot?

As if you did this in regular Java

Map map = ...
map.put("A.B", "myValue")

@JiriOndrusek
Copy link
Contributor Author

Yes, it is exacty the case. Value in the map is with dot ( "&additionalProperties.database.connectionTimeZone=CET"). See apache/camel-quarkus#3488.

@JiriOndrusek
Copy link
Contributor Author

JiriOndrusek commented Feb 17, 2022

The reason why it should work is fact, that it works in "non-specific debezium parent component (see https://github.com/apache/camel/blob/main/components/camel-debezium/camel-debezium-common/camel-debezium-common-component/src/test/java/org/apache/camel/component/debezium/DebeziumComponentTest.java#L48)"

The difference is caused by the fact, that configurer is not used and the value is not trimmed. Therefore I think it should work in the same way with configurer.

@davsclaus
Copy link
Contributor

that test is a bit wrong as the component should be started (or init) before creating the endpoint so the component can prepare itself and setup its configurer

@JiriOndrusek
Copy link
Contributor Author

@davsclaus Do you mean the test for "non-specific debezum component" https://github.com/apache/camel/blob/main/components/camel-debezium/camel-debezium-common/camel-debezium-common-component/src/test/java/org/apache/camel/component/debezium/DebeziumComponentTest.java#L48 ?

In that case I have no argument that we want this behavior during automatic configuration.

I can fix problem in component itself (not changing PropertyBindingSupport). This kind of fix is safe and easy, do you prefer it?

@davsclaus
Copy link
Contributor

Yeah its a tricky code the property binding - let me try your patch.

@davsclaus
Copy link
Contributor

Your code is correct, the newName should include the remainder parts - this is the first time we hit this because of the dot keys in that component.

@davsclaus
Copy link
Contributor

Its a bit tough to build an unit test in camel-core as this requires having configurers and whatnot

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