You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2017/10/20 11:06:16 UTC
[camel] branch camel-2.19.x updated: CAMEL-11922: Persistent tail
tracking picks random tail tracker from mongoDB collection
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch camel-2.19.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.19.x by this push:
new e764fe2 CAMEL-11922: Persistent tail tracking picks random tail tracker from mongoDB collection
e764fe2 is described below
commit e764fe27e8ed298a30fb25cd94c32c64945aae09
Author: Igor Paliychuk <ma...@gmail.com>
AuthorDate: Thu Oct 19 11:30:33 2017 +0300
CAMEL-11922: Persistent tail tracking picks random tail tracker from mongoDB collection
---
.../apache/camel/component/mongodb/MongoDbTailTrackingManager.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingManager.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingManager.java
index 68cf83a..1b5ae98 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingManager.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingManager.java
@@ -20,6 +20,8 @@ import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
+import com.mongodb.client.model.FindOneAndUpdateOptions;
+import com.mongodb.client.model.ReturnDocument;
import org.bson.types.BSONTimestamp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,8 +66,9 @@ public class MongoDbTailTrackingManager {
}
BasicDBObject updateObj = new BasicDBObject().append("$set", new BasicDBObject(config.field, lastVal));
- dbCol.updateOne(trackingObj, updateObj);
- trackingObj = dbCol.find().first();
+ FindOneAndUpdateOptions options = new FindOneAndUpdateOptions()
+ .returnDocument(ReturnDocument.AFTER);
+ trackingObj = dbCol.findOneAndUpdate(trackingObj, updateObj, options);
}
public synchronized Object recoverFromStore() {
--
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].