Class GridFsEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.mongodb.gridfs.GridFsEndpoint
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.CamelContextAware
,org.apache.camel.ComponentAware
,org.apache.camel.Endpoint
,org.apache.camel.IsSingleton
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.HasCamelContext
,org.apache.camel.spi.HasId
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@UriEndpoint(firstVersion="2.18.0",
scheme="mongodb-gridfs",
title="MongoDB GridFS",
syntax="mongodb-gridfs:connectionBean",
category={DATABASE,FILE},
headersClass=GridFsConstants.class)
public class GridFsEndpoint
extends org.apache.camel.support.DefaultEndpoint
Interact with MongoDB GridFS.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Producer
protected void
doInit()
protected void
Sets the name of the GridFS bucket within the database.com.mongodb.client.MongoDatabase
getDB()
long
getDelay()
com.mongodb.client.MongoCollection
<com.mongodb.client.gridfs.model.GridFSFile> com.mongodb.client.gridfs.GridFSBucket
long
com.mongodb.client.MongoClient
getQuery()
com.mongodb.ReadPreference
com.mongodb.WriteConcern
void
void
void
setConnectionBean
(String connectionBean) Name ofMongoClient
to use.void
setDatabase
(String database) Sets the name of the MongoDB database to targetvoid
setDelay
(long delay) Sets the delay between polls within the Consumer.void
If the QueryType uses a FileAttribute, this sets the name of the attribute that is used.void
setGridFsBucket
(com.mongodb.client.gridfs.GridFSBucket gridFs) void
setInitialDelay
(long initialDelay) Sets the initialDelay before the consumer will start polling.void
setMongoConnection
(com.mongodb.client.MongoClient mongoConnection) Sets the Mongo instance that represents the backing connectionvoid
setOperation
(String operation) Sets the operation this endpoint will execute against GridFs.void
If the QueryType uses a persistent timestamp, this sets the name of the collection within the DB to store the timestamp.void
If the QueryType uses a persistent timestamp, this is the ID of the object in the collection to store the timestamp.void
Additional query parameters (in JSON) that are used to configure the query used for finding files in the GridFsConsumervoid
Sets the QueryStrategy that is used for polling for new files.void
setQueryStrategy
(QueryStrategy queryStrategy) Sets the QueryStrategy that is used for polling for new files.void
setReadPreference
(com.mongodb.ReadPreference readPreference) Sets a MongoDBReadPreference
on the Mongo connection.void
setReadPreference
(String readPreference) Sets a MongoDBReadPreference
on the Mongo connection.void
setWriteConcern
(com.mongodb.WriteConcern writeConcern) Set theWriteConcern
for write operations on MongoDB using the standard ones.void
setWriteConcern
(String writeConcern) Set theWriteConcern
for write operations on MongoDB using the standard ones.Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.camel.ComponentAware
getComponent
Methods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducer
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
GridFsEndpoint
-
-
Method Details
-
createProducer
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Throws:
Exception
-
initializeConnection
- Throws:
Exception
-
doInit
- Overrides:
doInit
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
doShutdown
- Overrides:
doShutdown
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
getConnectionBean
-
setConnectionBean
Name ofMongoClient
to use. -
getMongoConnection
public com.mongodb.client.MongoClient getMongoConnection() -
setMongoConnection
public void setMongoConnection(com.mongodb.client.MongoClient mongoConnection) Sets the Mongo instance that represents the backing connection- Parameters:
mongoConnection
- the connection to the database
-
getDB
public com.mongodb.client.MongoDatabase getDB() -
getDatabase
-
setDatabase
Sets the name of the MongoDB database to target- Parameters:
database
- name of the MongoDB database
-
getBucket
Sets the name of the GridFS bucket within the database. Default is fs. -
setBucket
-
getQuery
-
setQuery
Additional query parameters (in JSON) that are used to configure the query used for finding files in the GridFsConsumer -
getDelay
public long getDelay() -
setDelay
public void setDelay(long delay) Sets the delay between polls within the Consumer. Default is 500ms -
getInitialDelay
public long getInitialDelay() -
setInitialDelay
public void setInitialDelay(long initialDelay) Sets the initialDelay before the consumer will start polling. Default is 1000ms -
setQueryStrategy
Sets the QueryStrategy that is used for polling for new files. Default is Timestamp -
setQueryStrategy
Sets the QueryStrategy that is used for polling for new files. Default is Timestamp -
getQueryStrategy
-
setPersistentTSCollection
If the QueryType uses a persistent timestamp, this sets the name of the collection within the DB to store the timestamp. -
getPersistentTSCollection
-
setPersistentTSObject
If the QueryType uses a persistent timestamp, this is the ID of the object in the collection to store the timestamp. -
getPersistentTSObject
-
setFileAttributeName
If the QueryType uses a FileAttribute, this sets the name of the attribute that is used. Default is "camel-processed". -
getFileAttributeName
-
setWriteConcern
Set theWriteConcern
for write operations on MongoDB using the standard ones. Resolved from the fields of the WriteConcern class by calling theWriteConcern.valueOf(String)
method.- Parameters:
writeConcern
- the standard name of the WriteConcern- See Also:
-
setWriteConcern
public void setWriteConcern(com.mongodb.WriteConcern writeConcern) Set theWriteConcern
for write operations on MongoDB using the standard ones. Resolved from the fields of the WriteConcern class by calling theWriteConcern.valueOf(String)
method.- Parameters:
writeConcern
- the standard name of the WriteConcern- See Also:
-
getWriteConcern
public com.mongodb.WriteConcern getWriteConcern() -
setReadPreference
Sets a MongoDBReadPreference
on the Mongo connection. Read preferences set directly on the connection will be overridden by this setting. TheReadPreference.valueOf(String)
utility method is used to resolve the passedreadPreference
value. Some examples for the possible values arenearest
,primary
orsecondary
etc.- Parameters:
readPreference
- the name of the read preference to set
-
setReadPreference
public void setReadPreference(com.mongodb.ReadPreference readPreference) Sets a MongoDBReadPreference
on the Mongo connection. Read preferences set directly on the connection will be overridden by this setting. TheReadPreference.valueOf(String)
utility method is used to resolve the passedreadPreference
value. Some examples for the possible values arenearest
,primary
orsecondary
etc.- Parameters:
readPreference
- the name of the read preference to set
-
getReadPreference
public com.mongodb.ReadPreference getReadPreference() -
setOperation
Sets the operation this endpoint will execute against GridFs. -
getOperation
-
getGridFsBucket
public com.mongodb.client.gridfs.GridFSBucket getGridFsBucket() -
setGridFsBucket
public void setGridFsBucket(com.mongodb.client.gridfs.GridFSBucket gridFs) -
getFilesCollection
public com.mongodb.client.MongoCollection<com.mongodb.client.gridfs.model.GridFSFile> getFilesCollection()
-