You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jpeschke <pe...@etone.de> on 2015/03/11 17:11:45 UTC

MongoDB Consumer Endpoint: ReadPreference cannot be set?

Hello,
When trying to use the "readPreference" parameter in a mongodb consumer
endpoint, an illegal argument exception will be thrown during
initialisation:

/operation, writeConcern, writeConcernRef, readPreference, dynamicity,
invokeGetLastError options cannot appear on a consumer endpoint/

I do not quiet understand this behaviour:
In my case, I use a tailable cursor consumer that should "listen" for
updates on a capped collection. These updates are immutable (they don't get
changed once they have been inserted), so for performance optimization, it
would make perfectly sense to perform those read operations on the secondary
hosts in the replica set.

The only reason I see for forbidding the definition of a different read
preference here is that we need a write operation if persistent tail
tracking is enabled and this should be performed on the primary. But as the
MongoDB Java API would allow you to define a readPrefercne=primary only on
the persistent tail tracking collection, this isn't a conflict, is it?

Best regards,
Joerg



--
View this message in context: http://camel.465427.n5.nabble.com/MongoDB-Consumer-Endpoint-ReadPreference-cannot-be-set-tp5764015.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: MongoDB Consumer Endpoint: ReadPreference cannot be set?

Posted by jpeschke <pe...@etone.de>.
Hi Raul,
Thank you for your reply. I will see what I can do, if I find the time, I
will patch it myself, otherwise I will at least open a ticket in JIRA.

Thanks a lot,

Joerg



--
View this message in context: http://camel.465427.n5.nabble.com/MongoDB-Consumer-Endpoint-ReadPreference-cannot-be-set-tp5764015p5764032.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: MongoDB Consumer Endpoint: ReadPreference cannot be set?

Posted by Raul Kripalani <ra...@evosent.com>.
I added a unit test and merged your PR. Thanks for your contribution to
Camel, and looking forward to many more!

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Fri, Mar 13, 2015 at 3:09 PM, jpeschke <pe...@etone.de> wrote:

> I created  a JIRA ticket <https://issues.apache.org/jira/browse/CAMEL-8483
> >
> and  a Pull Request on GitHub <https://github.com/apache/camel/pull/434>
> for this.
>
> First time contributingto Camel, exciting :). I hope, I didn't break
> anything.
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/MongoDB-Consumer-Endpoint-ReadPreference-cannot-be-set-tp5764015p5764100.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: MongoDB Consumer Endpoint: ReadPreference cannot be set?

Posted by jpeschke <pe...@etone.de>.
I created  a JIRA ticket <https://issues.apache.org/jira/browse/CAMEL-8483>  
and  a Pull Request on GitHub <https://github.com/apache/camel/pull/434>  
for this. 

First time contributingto Camel, exciting :). I hope, I didn't break
anything.





--
View this message in context: http://camel.465427.n5.nabble.com/MongoDB-Consumer-Endpoint-ReadPreference-cannot-be-set-tp5764015p5764100.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: MongoDB Consumer Endpoint: ReadPreference cannot be set?

Posted by Raul Kripalani <ra...@evosent.com>.
Hi Joerg,

Thanks for your feedback! Indeed this can probably be improved.

Could you please open a ticket in our Jira?

How would you feel about submitting a pull request?

Thanks!

Sent from my iPad

> On 11 Mar 2015, at 16:13, jpeschke <pe...@etone.de> wrote:
>
> Hello,
> When trying to use the "readPreference" parameter in a mongodb consumer
> endpoint, an illegal argument exception will be thrown during
> initialisation:
>
> /operation, writeConcern, writeConcernRef, readPreference, dynamicity,
> invokeGetLastError options cannot appear on a consumer endpoint/
>
> I do not quiet understand this behaviour:
> In my case, I use a tailable cursor consumer that should "listen" for
> updates on a capped collection. These updates are immutable (they don't get
> changed once they have been inserted), so for performance optimization, it
> would make perfectly sense to perform those read operations on the secondary
> hosts in the replica set.
>
> The only reason I see for forbidding the definition of a different read
> preference here is that we need a write operation if persistent tail
> tracking is enabled and this should be performed on the primary. But as the
> MongoDB Java API would allow you to define a readPrefercne=primary only on
> the persistent tail tracking collection, this isn't a conflict, is it?
>
> Best regards,
> Joerg
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/MongoDB-Consumer-Endpoint-ReadPreference-cannot-be-set-tp5764015.html
> Sent from the Camel - Users mailing list archive at Nabble.com.