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.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,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,NOSQL}) public class GridFsEndpoint extends org.apache.camel.support.DefaultEndpointInteract with MongoDB GridFS.
-
-
Field Summary
Fields Modifier and Type Field Description static StringGRIDFS_CHUNKSIZEstatic StringGRIDFS_FILE_ID_PRODUCEDstatic StringGRIDFS_METADATAstatic StringGRIDFS_OBJECT_IDstatic StringGRIDFS_OPERATION
-
Constructor Summary
Constructors Constructor Description GridFsEndpoint(String uri, GridFsComponent component)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.apache.camel.ProducercreateProducer()protected voiddoInit()protected voiddoShutdown()StringgetBucket()Sets the name of the GridFS bucket within the database.StringgetConnectionBean()StringgetDatabase()com.mongodb.client.MongoDatabasegetDB()longgetDelay()StringgetFileAttributeName()com.mongodb.client.MongoCollection<com.mongodb.client.gridfs.model.GridFSFile>getFilesCollection()com.mongodb.client.gridfs.GridFSBucketgetGridFsBucket()longgetInitialDelay()com.mongodb.client.MongoClientgetMongoConnection()StringgetOperation()StringgetPersistentTSCollection()StringgetPersistentTSObject()StringgetQuery()QueryStrategygetQueryStrategy()com.mongodb.ReadPreferencegetReadPreference()com.mongodb.WriteConcerngetWriteConcern()voidinitializeConnection()voidsetBucket(String bucket)voidsetConnectionBean(String connectionBean)Name ofMongoClientto use.voidsetDatabase(String database)Sets the name of the MongoDB database to targetvoidsetDelay(long delay)Sets the delay between polls within the Consumer.voidsetFileAttributeName(String f)If the QueryType uses a FileAttribute, this sets the name of the attribute that is used.voidsetGridFsBucket(com.mongodb.client.gridfs.GridFSBucket gridFs)voidsetInitialDelay(long initialDelay)Sets the initialDelay before the consumer will start polling.voidsetMongoConnection(com.mongodb.client.MongoClient mongoConnection)Sets the Mongo instance that represents the backing connectionvoidsetOperation(String operation)Sets the operation this endpoint will execute against GridFs.voidsetPersistentTSCollection(String s)If the QueryType uses a persistent timestamp, this sets the name of the collection within the DB to store the timestamp.voidsetPersistentTSObject(String id)If the QueryType uses a persistent timestamp, this is the ID of the object in the collection to store the timestamp.voidsetQuery(String query)Additional query parameters (in JSON) that are used to configure the query used for finding files in the GridFsConsumervoidsetQueryStrategy(String s)Sets the QueryStrategy that is used for polling for new files.voidsetQueryStrategy(QueryStrategy queryStrategy)Sets the QueryStrategy that is used for polling for new files.voidsetReadPreference(com.mongodb.ReadPreference readPreference)Sets a MongoDBReadPreferenceon the Mongo connection.voidsetReadPreference(String readPreference)Sets a MongoDBReadPreferenceon the Mongo connection.voidsetWriteConcern(com.mongodb.WriteConcern writeConcern)Set theWriteConcernfor write operations on MongoDB using the standard ones.voidsetWriteConcern(String writeConcern)Set theWriteConcernfor 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, doStart, doStop, 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, 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
-
-
-
-
Field Detail
-
GRIDFS_OPERATION
public static final String GRIDFS_OPERATION
- See Also:
- Constant Field Values
-
GRIDFS_METADATA
public static final String GRIDFS_METADATA
- See Also:
- Constant Field Values
-
GRIDFS_CHUNKSIZE
public static final String GRIDFS_CHUNKSIZE
- See Also:
- Constant Field Values
-
GRIDFS_FILE_ID_PRODUCED
public static final String GRIDFS_FILE_ID_PRODUCED
- See Also:
- Constant Field Values
-
GRIDFS_OBJECT_ID
public static final String GRIDFS_OBJECT_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GridFsEndpoint
public GridFsEndpoint(String uri, GridFsComponent component)
-
-
Method Detail
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception- Throws:
Exception
-
doInit
protected void doInit() throws Exception- Overrides:
doInitin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
doShutdown
protected void doShutdown() throws Exception- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
getConnectionBean
public String getConnectionBean()
-
setConnectionBean
public void setConnectionBean(String connectionBean)
Name ofMongoClientto 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
public String getDatabase()
-
setDatabase
public void setDatabase(String database)
Sets the name of the MongoDB database to target- Parameters:
database- name of the MongoDB database
-
getBucket
public String getBucket()
Sets the name of the GridFS bucket within the database. Default is fs.
-
setBucket
public void setBucket(String bucket)
-
getQuery
public String getQuery()
-
setQuery
public void setQuery(String query)
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
public void setQueryStrategy(String s)
Sets the QueryStrategy that is used for polling for new files. Default is Timestamp
-
setQueryStrategy
public void setQueryStrategy(QueryStrategy queryStrategy)
Sets the QueryStrategy that is used for polling for new files. Default is Timestamp
-
getQueryStrategy
public QueryStrategy getQueryStrategy()
-
setPersistentTSCollection
public void setPersistentTSCollection(String s)
If the QueryType uses a persistent timestamp, this sets the name of the collection within the DB to store the timestamp.
-
getPersistentTSCollection
public String getPersistentTSCollection()
-
setPersistentTSObject
public void setPersistentTSObject(String id)
If the QueryType uses a persistent timestamp, this is the ID of the object in the collection to store the timestamp.
-
getPersistentTSObject
public String getPersistentTSObject()
-
setFileAttributeName
public void setFileAttributeName(String f)
If the QueryType uses a FileAttribute, this sets the name of the attribute that is used. Default is "camel-processed".
-
getFileAttributeName
public String getFileAttributeName()
-
setWriteConcern
public void setWriteConcern(String writeConcern)
Set theWriteConcernfor 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:
- possible options
-
setWriteConcern
public void setWriteConcern(com.mongodb.WriteConcern writeConcern)
Set theWriteConcernfor 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:
- possible options
-
getWriteConcern
public com.mongodb.WriteConcern getWriteConcern()
-
setReadPreference
public void setReadPreference(String readPreference)
Sets a MongoDBReadPreferenceon 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 passedreadPreferencevalue. Some examples for the possible values arenearest,primaryorsecondaryetc.- Parameters:
readPreference- the name of the read preference to set
-
setReadPreference
public void setReadPreference(com.mongodb.ReadPreference readPreference)
Sets a MongoDBReadPreferenceon 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 passedreadPreferencevalue. Some examples for the possible values arenearest,primaryorsecondaryetc.- Parameters:
readPreference- the name of the read preference to set
-
getReadPreference
public com.mongodb.ReadPreference getReadPreference()
-
setOperation
public void setOperation(String operation)
Sets the operation this endpoint will execute against GridFs.
-
getOperation
public String 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()
-
-