Hi

There was a flaw by MongoDbEndpoint#setReadPreference() I tried to fix last
week. See also the documentation about the readPreference option:

https://camel.apache.org/mongodb.html

In the meanwhile I've noticed that this option doesn't work *at all* anyway
because:

- For example if you try to use
"readPreference=com.mongodb.ReadPreference$PrimaryReadPreference” the
reflection hack will not work (with the current logic) as the static member
class PrimaryReadPreference is private anyway (one would end up with
IllegalAccessException etc.) 
- One can't for example make use of the value
"com.mongodb.ReadPreference$TaggedReadPreference" (as the documentation
says) because this preference has no default constructor!

We also don't have any test case in the code base about this option.

As this option doesn't work anyway, my suggestion is to change the possible
values for this option to the ones com.mongodb.ReadPreference#valueOf()
allows. I've raised a JIRA including a proposed fix for this:

https://issues.apache.org/jira/browse/CAMEL-7369

I also think an option value like "readPreference=primaryPreferred" would
read much easier than
"readPreference=com.mongodb.TaggableReadPreference$PrimaryPreferredReadPreference"
etc.

The price we would pay for this would be non-backward compatibility with the
current behaviour but as the current implementation doesn't work anyway, I
guess this's not an issue at all.

Thoughts?

Babak



--
View this message in context: 
http://camel.465427.n5.nabble.com/About-a-bug-of-the-camel-mongodb-component-tp5750234.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to