You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/04/01 09:14:15 UTC

[camel] 15/18: CAMEL-17792: Add doc about the message headers of camel-mongodb-gridfs

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 63ee0fec22ed8f8e703f486029d23069daf1376a
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Thu Mar 31 19:02:41 2022 +0200

    CAMEL-17792: Add doc about the message headers of camel-mongodb-gridfs
---
 .../component/mongodb/gridfs/mongodb-gridfs.json   | 13 +++++++++
 .../src/main/docs/mongodb-gridfs-component.adoc    |  4 ++-
 .../component/mongodb/gridfs/GridFsConstants.java  | 26 +++++++++++++++++
 .../component/mongodb/gridfs/GridFsConsumer.java   |  8 ++---
 .../component/mongodb/gridfs/GridFsEndpoint.java   |  9 ++----
 .../component/mongodb/gridfs/GridFsProducer.java   | 34 +++++++++++-----------
 .../gridfs/integration/GridFsConsumerIT.java       |  8 ++---
 .../integration/GridFsProducerOperationsIT.java    | 11 ++++---
 8 files changed, 74 insertions(+), 39 deletions(-)

diff --git a/components/camel-mongodb-gridfs/src/generated/resources/org/apache/camel/component/mongodb/gridfs/mongodb-gridfs.json b/components/camel-mongodb-gridfs/src/generated/resources/org/apache/camel/component/mongodb/gridfs/mongodb-gridfs.json
index eb2d0bd..700ce6a 100644
--- a/components/camel-mongodb-gridfs/src/generated/resources/org/apache/camel/component/mongodb/gridfs/mongodb-gridfs.json
+++ b/components/camel-mongodb-gridfs/src/generated/resources/org/apache/camel/component/mongodb/gridfs/mongodb-gridfs.json
@@ -26,6 +26,19 @@
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
     "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
   },
+  "headers": {
+    "CamelFileContentType": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type of the file." },
+    "CamelFileLength": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "long", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The size of the file." },
+    "CamelFileLastModified": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "Date", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The size of the file." },
+    "CamelFileName": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the file." },
+    "Content-Type": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content type of the file." },
+    "CamelFileNameProduced": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The file name produced." },
+    "gridfs.metadata": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Any additional metadata stored along with the file in JSON format." },
+    "gridfs.operation": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform." },
+    "gridfs.chunksize": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of bytes per chunk for the uploaded file." },
+    "gridfs.fileid": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.bson.types.ObjectId", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ObjectId of the file produced" },
+    "gridfs.objectid": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "org.bson.types.ObjectId", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The ObjectId of the file." }
+  },
   "properties": {
     "connectionBean": { "kind": "path", "displayName": "Connection Bean", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Name of com.mongodb.client.MongoClient to use." },
     "bucket": { "kind": "parameter", "displayName": "Bucket", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "fs", "description": "Sets the name of the GridFS bucket within the database. Default is fs." },
diff --git a/components/camel-mongodb-gridfs/src/main/docs/mongodb-gridfs-component.adoc b/components/camel-mongodb-gridfs/src/main/docs/mongodb-gridfs-component.adoc
index 9f8bc08..a8d79e1 100644
--- a/components/camel-mongodb-gridfs/src/main/docs/mongodb-gridfs-component.adoc
+++ b/components/camel-mongodb-gridfs/src/main/docs/mongodb-gridfs-component.adoc
@@ -44,7 +44,9 @@ include::partial$component-endpoint-options.adoc[]
 // endpoint options: START
 
 // endpoint options: END
-
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
 
 == Configuration of database in Spring XML
 
diff --git a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConstants.java b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConstants.java
index fea34be..f05dde5 100644
--- a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConstants.java
+++ b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConstants.java
@@ -16,14 +16,40 @@
  */
 package org.apache.camel.component.mongodb.gridfs;
 
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.Metadata;
+
 public final class GridFsConstants {
 
+    @Metadata(label = "consumer", description = "The content type of the file.", javaType = "String")
+    public static final String FILE_CONTENT_TYPE = Exchange.FILE_CONTENT_TYPE;
+    @Metadata(label = "consumer", description = "The size of the file.", javaType = "long")
+    public static final String FILE_LENGTH = Exchange.FILE_LENGTH;
+    @Metadata(label = "consumer", description = "The size of the file.", javaType = "Date")
+    public static final String FILE_LAST_MODIFIED = Exchange.FILE_LAST_MODIFIED;
+    @Metadata(label = "producer", description = "The name of the file.", javaType = "String")
+    public static final String FILE_NAME = Exchange.FILE_NAME;
+    @Metadata(label = "producer", description = "The content type of the file.", javaType = "String")
+    public static final String CONTENT_TYPE = Exchange.CONTENT_TYPE;
+    @Metadata(label = "producer", description = "The file name produced.", javaType = "String")
+    public static final String FILE_NAME_PRODUCED = Exchange.FILE_NAME_PRODUCED;
+
     public static final String GRIDFS_FILE_ATTRIBUTE_DONE = "done";
     public static final String GRIDFS_FILE_ATTRIBUTE_PROCESSING = "processing";
     public static final String GRIDFS_FILE_KEY_CONTENT_TYPE = "contentType";
     public static final String GRIDFS_FILE_KEY_FILENAME = "filename";
     public static final String GRIDFS_FILE_KEY_UPLOAD_DATE = "uploadDate";
     public static final String PERSISTENT_TIMESTAMP_KEY = "timestamp";
+    @Metadata(description = "Any additional metadata stored along with the file in JSON format.", javaType = "String")
+    public static final String GRIDFS_METADATA = "gridfs.metadata";
+    @Metadata(label = "producer", description = "The operation to perform.", javaType = "String")
+    public static final String GRIDFS_OPERATION = "gridfs.operation";
+    @Metadata(label = "producer", description = "The number of bytes per chunk for the uploaded file.", javaType = "Integer")
+    public static final String GRIDFS_CHUNKSIZE = "gridfs.chunksize";
+    @Metadata(label = "producer", description = "The ObjectId of the file produced", javaType = "org.bson.types.ObjectId")
+    public static final String GRIDFS_FILE_ID_PRODUCED = "gridfs.fileid";
+    @Metadata(label = "producer", description = "The ObjectId of the file.", javaType = "org.bson.types.ObjectId")
+    public static final String GRIDFS_OBJECT_ID = "gridfs.objectid";
 
     private GridFsConstants() {
     }
diff --git a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConsumer.java b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConsumer.java
index fe7639e..69941a7 100644
--- a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConsumer.java
+++ b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsConsumer.java
@@ -152,13 +152,13 @@ public class GridFsConsumer extends DefaultConsumer implements Runnable {
                     if (metadata != null) {
                         String contentType = metadata.get(GRIDFS_FILE_KEY_CONTENT_TYPE, String.class);
                         if (contentType != null) {
-                            exchange.getIn().setHeader(Exchange.FILE_CONTENT_TYPE, contentType);
+                            exchange.getIn().setHeader(GridFsConstants.FILE_CONTENT_TYPE, contentType);
                         }
-                        exchange.getIn().setHeader(GridFsEndpoint.GRIDFS_METADATA, metadata.toJson());
+                        exchange.getIn().setHeader(GridFsConstants.GRIDFS_METADATA, metadata.toJson());
                     }
 
-                    exchange.getIn().setHeader(Exchange.FILE_LENGTH, file.getLength());
-                    exchange.getIn().setHeader(Exchange.FILE_LAST_MODIFIED, file.getUploadDate());
+                    exchange.getIn().setHeader(GridFsConstants.FILE_LENGTH, file.getLength());
+                    exchange.getIn().setHeader(GridFsConstants.FILE_LAST_MODIFIED, file.getUploadDate());
                     exchange.getIn().setBody(downloadStream, InputStream.class);
                     try {
                         getProcessor().process(exchange);
diff --git a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsEndpoint.java b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsEndpoint.java
index 3b47f8f..517ec63 100644
--- a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsEndpoint.java
+++ b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsEndpoint.java
@@ -41,15 +41,10 @@ import org.slf4j.LoggerFactory;
  * Interact with MongoDB GridFS.
  */
 @UriEndpoint(firstVersion = "2.18.0", scheme = "mongodb-gridfs", title = "MongoDB GridFS",
-             syntax = "mongodb-gridfs:connectionBean", category = { Category.DATABASE, Category.NOSQL })
+             syntax = "mongodb-gridfs:connectionBean", category = { Category.DATABASE, Category.NOSQL },
+             headersClass = GridFsConstants.class)
 public class GridFsEndpoint extends DefaultEndpoint {
 
-    public static final String GRIDFS_OPERATION = "gridfs.operation";
-    public static final String GRIDFS_METADATA = "gridfs.metadata";
-    public static final String GRIDFS_CHUNKSIZE = "gridfs.chunksize";
-    public static final String GRIDFS_FILE_ID_PRODUCED = "gridfs.fileid";
-    public static final String GRIDFS_OBJECT_ID = "gridfs.objectid";
-
     private static final Logger LOG = LoggerFactory.getLogger(GridFsEndpoint.class);
 
     @UriPath
diff --git a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsProducer.java b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsProducer.java
index 3481a46..1d68bcf 100644
--- a/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsProducer.java
+++ b/components/camel-mongodb-gridfs/src/main/java/org/apache/camel/component/mongodb/gridfs/GridFsProducer.java
@@ -45,18 +45,18 @@ public class GridFsProducer extends DefaultProducer {
     public void process(Exchange exchange) throws Exception {
         String operation = endpoint.getOperation();
         if (operation == null) {
-            operation = exchange.getIn().getHeader(GridFsEndpoint.GRIDFS_OPERATION, String.class);
+            operation = exchange.getIn().getHeader(GridFsConstants.GRIDFS_OPERATION, String.class);
         }
         if (operation == null || "create".equals(operation)) {
-            final String filename = exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
-            Integer chunkSize = exchange.getIn().getHeader(GridFsEndpoint.GRIDFS_CHUNKSIZE, Integer.class);
+            final String filename = exchange.getIn().getHeader(GridFsConstants.FILE_NAME, String.class);
+            Integer chunkSize = exchange.getIn().getHeader(GridFsConstants.GRIDFS_CHUNKSIZE, Integer.class);
 
             GridFSUploadOptions options = new GridFSUploadOptions();
             if (chunkSize != null && chunkSize > 0) {
                 options.chunkSizeBytes(chunkSize);
             }
 
-            String metaData = exchange.getIn().getHeader(GridFsEndpoint.GRIDFS_METADATA, String.class);
+            String metaData = exchange.getIn().getHeader(GridFsConstants.GRIDFS_METADATA, String.class);
             if (metaData != null) {
                 Document document = Document.parse(metaData);
                 if (document != null) {
@@ -64,7 +64,7 @@ public class GridFsProducer extends DefaultProducer {
                 }
             }
 
-            final String ct = exchange.getIn().getHeader(Exchange.CONTENT_TYPE, String.class);
+            final String ct = exchange.getIn().getHeader(GridFsConstants.CONTENT_TYPE, String.class);
             if (ct != null) {
                 Document metadata = options.getMetadata();
                 if (metadata == null) {
@@ -78,38 +78,38 @@ public class GridFsProducer extends DefaultProducer {
             ObjectId objectId = endpoint.getGridFsBucket().uploadFromStream(filename, ins, options);
 
             //add headers with the id and file name produced by the driver.
-            exchange.getIn().setHeader(Exchange.FILE_NAME_PRODUCED, filename);
-            exchange.getIn().setHeader(GridFsEndpoint.GRIDFS_FILE_ID_PRODUCED, objectId);
-            exchange.getIn().setHeader(GridFsEndpoint.GRIDFS_OBJECT_ID, objectId);
+            exchange.getIn().setHeader(GridFsConstants.FILE_NAME_PRODUCED, filename);
+            exchange.getIn().setHeader(GridFsConstants.GRIDFS_FILE_ID_PRODUCED, objectId);
+            exchange.getIn().setHeader(GridFsConstants.GRIDFS_OBJECT_ID, objectId);
         } else if ("remove".equals(operation)) {
-            final ObjectId objectId = exchange.getIn().getHeader(GridFsEndpoint.GRIDFS_OBJECT_ID, ObjectId.class);
+            final ObjectId objectId = exchange.getIn().getHeader(GridFsConstants.GRIDFS_OBJECT_ID, ObjectId.class);
             if (objectId != null) {
                 endpoint.getGridFsBucket().delete(objectId);
             } else {
-                final String filename = exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
+                final String filename = exchange.getIn().getHeader(GridFsConstants.FILE_NAME, String.class);
                 GridFSFile file = endpoint.getGridFsBucket().find(eq(GRIDFS_FILE_KEY_FILENAME, filename)).first();
                 if (file != null) {
                     endpoint.getGridFsBucket().delete(file.getId());
                 }
             }
         } else if ("findOne".equals(operation)) {
-            final String filename = exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
+            final String filename = exchange.getIn().getHeader(GridFsConstants.FILE_NAME, String.class);
             GridFSDownloadStream downloadStream = endpoint.getGridFsBucket().openDownloadStream(filename);
             GridFSFile file = downloadStream.getGridFSFile();
             Document metadata = file.getMetadata();
             if (metadata != null) {
-                exchange.getIn().setHeader(GridFsEndpoint.GRIDFS_METADATA, metadata.toJson());
+                exchange.getIn().setHeader(GridFsConstants.GRIDFS_METADATA, metadata.toJson());
 
                 Object contentType = metadata.get(GRIDFS_FILE_KEY_CONTENT_TYPE);
                 if (contentType != null) {
-                    exchange.getIn().setHeader(Exchange.FILE_CONTENT_TYPE, contentType);
+                    exchange.getIn().setHeader(GridFsConstants.FILE_CONTENT_TYPE, contentType);
                 }
             }
-            exchange.getIn().setHeader(Exchange.FILE_LENGTH, file.getLength());
-            exchange.getIn().setHeader(Exchange.FILE_LAST_MODIFIED, file.getUploadDate());
+            exchange.getIn().setHeader(GridFsConstants.FILE_LENGTH, file.getLength());
+            exchange.getIn().setHeader(GridFsConstants.FILE_LAST_MODIFIED, file.getUploadDate());
             exchange.getIn().setBody(downloadStream, InputStream.class);
         } else if ("listAll".equals(operation)) {
-            final String filename = exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
+            final String filename = exchange.getIn().getHeader(GridFsConstants.FILE_NAME, String.class);
             MongoCursor<GridFSFile> cursor;
             if (filename == null) {
                 cursor = endpoint.getGridFsBucket().find().cursor();
@@ -119,7 +119,7 @@ public class GridFsProducer extends DefaultProducer {
             exchange.getIn().setBody(new DBCursorFilenameReader(cursor), Reader.class);
         } else if ("count".equals(operation)) {
             long count;
-            final String filename = exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
+            final String filename = exchange.getIn().getHeader(GridFsConstants.FILE_NAME, String.class);
             if (filename == null) {
                 count = endpoint.getFilesCollection().countDocuments();
             } else {
diff --git a/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsConsumerIT.java b/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsConsumerIT.java
index a8e6af1..5a0ce71 100644
--- a/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsConsumerIT.java
+++ b/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsConsumerIT.java
@@ -25,7 +25,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.mongodb.gridfs.GridFsEndpoint;
+import org.apache.camel.component.mongodb.gridfs.GridFsConstants;
 import org.bson.types.ObjectId;
 import org.junit.jupiter.api.Test;
 
@@ -91,7 +91,7 @@ public class GridFsConsumerIT extends AbstractMongoDbITSupport {
                         exchange.getMessage().setHeaders(headers);
                     }
                 });
-        ObjectId objectId = result.getMessage().getHeader(GridFsEndpoint.GRIDFS_OBJECT_ID, ObjectId.class);
+        ObjectId objectId = result.getMessage().getHeader(GridFsConstants.GRIDFS_OBJECT_ID, ObjectId.class);
         assertNotNull(objectId);
 
         MockEndpoint mock = getMockEndpoint("mock:test");
@@ -100,7 +100,7 @@ public class GridFsConsumerIT extends AbstractMongoDbITSupport {
 
         template.requestBodyAndHeader(
                 "mongodb-gridfs:myDb?database={{mongodb.testDb}}&operation=remove&bucket=customFileFilterTest", null,
-                GridFsEndpoint.GRIDFS_OBJECT_ID, objectId);
+                GridFsConstants.GRIDFS_OBJECT_ID, objectId);
 
         Integer count = template.requestBodyAndHeaders(
                 "mongodb-gridfs:myDb?database={{mongodb.testDb}}&operation=count&bucket=customFileFilterTest", null, headers,
@@ -111,7 +111,7 @@ public class GridFsConsumerIT extends AbstractMongoDbITSupport {
     public void runTest(String target, GridFSBucket gridfs) throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:test");
         mock.expectedBodiesReceived(FILE_DATA);
-        mock.expectedHeaderReceived(GridFsEndpoint.GRIDFS_METADATA, "{\"contentType\": \"text/plain\"}");
+        mock.expectedHeaderReceived(GridFsConstants.GRIDFS_METADATA, "{\"contentType\": \"text/plain\"}");
 
         Map<String, Object> headers = new HashMap<>();
         assertFalse(gridfs.find(eq(GRIDFS_FILE_KEY_FILENAME, FILE_NAME)).cursor().hasNext());
diff --git a/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsProducerOperationsIT.java b/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsProducerOperationsIT.java
index 54e42b2..08218e8 100644
--- a/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsProducerOperationsIT.java
+++ b/components/camel-mongodb-gridfs/src/test/java/org/apache/camel/component/mongodb/gridfs/integration/GridFsProducerOperationsIT.java
@@ -25,7 +25,6 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mongodb.gridfs.GridFsConstants;
-import org.apache.camel.component.mongodb.gridfs.GridFsEndpoint;
 import org.bson.types.ObjectId;
 import org.junit.jupiter.api.Test;
 
@@ -50,7 +49,7 @@ public class GridFsProducerOperationsIT extends AbstractMongoDbITSupport {
                 from("direct:listAll")
                         .to("mongodb-gridfs:myDb?database={{mongodb.testDb}}&operation=listAll&bucket=" + getBucket());
                 from("direct:count")
-                        .setHeader(GridFsEndpoint.GRIDFS_OPERATION, constant("count"))
+                        .setHeader(GridFsConstants.GRIDFS_OPERATION, constant("count"))
                         .to("mongodb-gridfs:myDb?database={{mongodb.testDb}}&bucket=" + getBucket());
             }
         };
@@ -77,8 +76,8 @@ public class GridFsProducerOperationsIT extends AbstractMongoDbITSupport {
         assertEquals(FILE_DATA, new String(b, 0, i, StandardCharsets.UTF_8));
 
         headers.put(Exchange.FILE_NAME, "2-" + FILE_NAME);
-        headers.put(GridFsEndpoint.GRIDFS_CHUNKSIZE, 10);
-        headers.put(GridFsEndpoint.GRIDFS_METADATA, "{'foo': 'bar'}");
+        headers.put(GridFsConstants.GRIDFS_CHUNKSIZE, 10);
+        headers.put(GridFsConstants.GRIDFS_METADATA, "{'foo': 'bar'}");
 
         template.requestBodyAndHeaders("direct:create", FILE_DATA + "data2", headers);
         assertEquals(1, template.requestBodyAndHeaders("direct:count", null, headers, Long.class).longValue());
@@ -105,11 +104,11 @@ public class GridFsProducerOperationsIT extends AbstractMongoDbITSupport {
                         exchange.getMessage().setHeaders(headers);
                     }
                 });
-        ObjectId objectId = result.getMessage().getHeader(GridFsEndpoint.GRIDFS_OBJECT_ID, ObjectId.class);
+        ObjectId objectId = result.getMessage().getHeader(GridFsConstants.GRIDFS_OBJECT_ID, ObjectId.class);
         assertNotNull(objectId);
 
         template.requestBodyAndHeader("mongodb-gridfs:myDb?database={{mongodb.testDb}}&operation=remove&bucket=" + getBucket(),
-                null, GridFsEndpoint.GRIDFS_OBJECT_ID, objectId);
+                null, GridFsConstants.GRIDFS_OBJECT_ID, objectId);
 
         Integer count = template.requestBodyAndHeaders(
                 "mongodb-gridfs:myDb?database={{mongodb.testDb}}&operation=count&bucket=" + getBucket(), null, headers,