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}, headersClass=GridFsConstants.class) public class GridFsEndpoint extends org.apache.camel.support.DefaultEndpoint
Interact with MongoDB GridFS.
-
-
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.Consumer
createConsumer(org.apache.camel.Processor processor)
org.apache.camel.Producer
createProducer()
protected void
doInit()
protected void
doShutdown()
String
getBucket()
Sets the name of the GridFS bucket within the database.String
getConnectionBean()
String
getDatabase()
com.mongodb.client.MongoDatabase
getDB()
long
getDelay()
String
getFileAttributeName()
com.mongodb.client.MongoCollection<com.mongodb.client.gridfs.model.GridFSFile>
getFilesCollection()
com.mongodb.client.gridfs.GridFSBucket
getGridFsBucket()
long
getInitialDelay()
com.mongodb.client.MongoClient
getMongoConnection()
String
getOperation()
String
getPersistentTSCollection()
String
getPersistentTSObject()
String
getQuery()
QueryStrategy
getQueryStrategy()
com.mongodb.ReadPreference
getReadPreference()
com.mongodb.WriteConcern
getWriteConcern()
void
initializeConnection()
void
setBucket(String bucket)
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
setFileAttributeName(String f)
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
setPersistentTSCollection(String s)
If the QueryType uses a persistent timestamp, this sets the name of the collection within the DB to store the timestamp.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.void
setQuery(String query)
Additional query parameters (in JSON) that are used to configure the query used for finding files in the GridFsConsumervoid
setQueryStrategy(String s)
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, 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
-
-
-
-
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:
doInit
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
doShutdown
protected void doShutdown() throws Exception
- Overrides:
doShutdown
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
getConnectionBean
public String getConnectionBean()
-
setConnectionBean
public void setConnectionBean(String connectionBean)
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
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 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:
- possible options
-
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:
- possible options
-
getWriteConcern
public com.mongodb.WriteConcern getWriteConcern()
-
setReadPreference
public void setReadPreference(String 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
-
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
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()
-
-