@UriEndpoint(scheme="gridfs",
title="MongoDBGridFS",
syntax="gridfs:connectionBean",
label="database,nosql")
public class GridFsEndpoint
extends org.apache.camel.impl.DefaultEndpoint
Modifier and Type | Class and Description |
---|---|
static class |
GridFsEndpoint.QueryStrategy |
Modifier and Type | Field and Description |
---|---|
static String |
GRIDFS_CHUNKSIZE |
static String |
GRIDFS_FILE_ID_PRODUCED |
static String |
GRIDFS_METADATA |
static String |
GRIDFS_OPERATION |
Constructor and Description |
---|
GridFsEndpoint(String uri,
GridFsComponent component) |
Modifier and Type | Method and Description |
---|---|
org.apache.camel.Consumer |
createConsumer(org.apache.camel.Processor processor) |
org.apache.camel.Producer |
createProducer() |
protected void |
doStart() |
String |
getBucket()
Sets the name of the GridFS bucket within the database.
|
String |
getConnectionBean() |
String |
getDatabase() |
com.mongodb.DB |
getDB() |
long |
getDelay() |
String |
getFileAttributeName() |
com.mongodb.DBCollection |
getFilesCollection() |
com.mongodb.gridfs.GridFS |
getGridFs() |
long |
getInitialDelay() |
com.mongodb.Mongo |
getMongoConnection() |
String |
getOperation() |
String |
getPersistentTSCollection() |
String |
getPersistentTSObject() |
String |
getQuery() |
GridFsEndpoint.QueryStrategy |
getQueryStrategy() |
com.mongodb.ReadPreference |
getReadPreference() |
com.mongodb.WriteConcern |
getWriteConcern() |
com.mongodb.WriteConcern |
getWriteConcernRef() |
void |
initializeConnection() |
boolean |
isSingleton() |
void |
setBucket(String bucket) |
void |
setConnectionBean(String connectionBean)
Name of
Mongo to use. |
void |
setDatabase(String database)
Sets the name of the MongoDB database to target
|
void |
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 |
setGridFs(com.mongodb.gridfs.GridFS gridFs) |
void |
setInitialDelay(long initialDelay)
Sets the initialDelay before the consumer will start polling.
|
void |
setMongoConnection(com.mongodb.Mongo mongoConnection)
Sets the Mongo instance that represents the backing connection
|
void |
setOperation(String operation)
Sets the operation this endpoint will execute against GridRS.
|
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 GridFsConsumer
|
void |
setQueryStrategy(String s)
Sets the QueryStrategy that is used for polling for new files.
|
void |
setReadPreference(String readPreference)
Sets a MongoDB
ReadPreference on the Mongo connection. |
void |
setWriteConcern(String writeConcern)
Set the
WriteConcern for write operations on MongoDB using the standard ones. |
void |
setWriteConcernRef(String writeConcernRef)
Set the
WriteConcern for write operations on MongoDB, passing in the bean ref to a custom WriteConcern which exists in the Registry. |
configureConsumer, configurePollingConsumer, configureProperties, createEndpointConfiguration, createEndpointUri, createExchange, createExchange, createExchange, createPollingConsumer, doStop, equals, getCamelContext, getComponent, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isBridgeErrorHandler, isLenientProperties, isPollingConsumerBlockWhenFull, isSynchronous, setBridgeErrorHandler, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public static final String GRIDFS_OPERATION
public static final String GRIDFS_METADATA
public static final String GRIDFS_CHUNKSIZE
public static final String GRIDFS_FILE_ID_PRODUCED
public GridFsEndpoint(String uri, GridFsComponent component)
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
Exception
public boolean isSingleton()
protected void doStart() throws Exception
doStart
in class org.apache.camel.impl.DefaultEndpoint
Exception
public String getConnectionBean()
public void setConnectionBean(String connectionBean)
Mongo
to use.public com.mongodb.Mongo getMongoConnection()
public void setMongoConnection(com.mongodb.Mongo mongoConnection)
mongoConnection
- the connection to the databasepublic com.mongodb.DB getDB()
public String getDatabase()
public void setDatabase(String database)
database
- name of the MongoDB databasepublic String getBucket()
database
- name of the MongoDB databasepublic void setBucket(String bucket)
public String getQuery()
public void setQuery(String query)
query
- public long getDelay()
public void setDelay(long delay)
delay
- public long getInitialDelay()
public void setInitialDelay(long initialDelay)
initialDelay
- public void setQueryStrategy(String s)
s
- GridFsEndpoint.QueryStrategy
public GridFsEndpoint.QueryStrategy getQueryStrategy()
public void setPersistentTSCollection(String s)
s
- public String getPersistentTSCollection()
public void setPersistentTSObject(String id)
s
- public String getPersistentTSObject()
public void setFileAttributeName(String f)
f
- public String getFileAttributeName()
public void setWriteConcern(String writeConcern)
WriteConcern
for write operations on MongoDB using the standard ones.
Resolved from the fields of the WriteConcern class by calling the WriteConcern.valueOf(String)
method.writeConcern
- the standard name of the WriteConcernpublic com.mongodb.WriteConcern getWriteConcern()
public void setWriteConcernRef(String writeConcernRef)
WriteConcern
for write operations on MongoDB, passing in the bean ref to a custom WriteConcern which exists in the Registry.
You can also use standard WriteConcerns by passing in their key. See the setWriteConcern
method.writeConcernRef
- the name of the bean in the registry that represents the WriteConcern to usepublic com.mongodb.WriteConcern getWriteConcernRef()
public void setReadPreference(String readPreference)
ReadPreference
on the Mongo connection. Read preferences set directly on the connection will be
overridden by this setting.
The ReadPreference.valueOf(String)
utility method is used to resolve the passed readPreference
value. Some examples for the possible values are nearest
, primary
or secondary
etc.readPreference
- the name of the read preference to setpublic com.mongodb.ReadPreference getReadPreference()
public void setOperation(String operation)
public String getOperation()
public com.mongodb.gridfs.GridFS getGridFs()
public void setGridFs(com.mongodb.gridfs.GridFS gridFs)
public com.mongodb.DBCollection getFilesCollection()
Apache Camel