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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.camel.Consumer
    createConsumer(org.apache.camel.Processor processor)
     
    org.apache.camel.Producer
     
    protected void
     
    protected void
     
    Sets the name of the GridFS bucket within the database.
     
     
    com.mongodb.client.MongoDatabase
     
    long
     
     
    com.mongodb.client.MongoCollection<com.mongodb.client.gridfs.model.GridFSFile>
     
    com.mongodb.client.gridfs.GridFSBucket
     
    long
     
    com.mongodb.client.MongoClient
     
     
     
     
     
     
    com.mongodb.ReadPreference
     
    com.mongodb.WriteConcern
     
    void
     
    void
    setBucket(String bucket)
     
    void
    setConnectionBean(String connectionBean)
    Name of MongoClient 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
    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 connection
    void
    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 GridFsConsumer
    void
    Sets the QueryStrategy that is used for polling for new files.
    void
    Sets the QueryStrategy that is used for polling for new files.
    void
    setReadPreference(com.mongodb.ReadPreference readPreference)
    Sets a MongoDB ReadPreference on the Mongo connection.
    void
    setReadPreference(String readPreference)
    Sets a MongoDB ReadPreference on the Mongo connection.
    void
    setWriteConcern(com.mongodb.WriteConcern writeConcern)
    Set the WriteConcern for write operations on MongoDB using the standard ones.
    void
    setWriteConcern(String writeConcern)
    Set the WriteConcern 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

  • Method Details

    • createProducer

      public org.apache.camel.Producer createProducer() throws Exception
      Throws:
      Exception
    • createConsumer

      public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
      Throws:
      Exception
    • initializeConnection

      public void initializeConnection() throws Exception
      Throws:
      Exception
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class org.apache.camel.support.DefaultEndpoint
      Throws:
      Exception
    • doShutdown

      protected void doShutdown() throws Exception
      Overrides:
      doShutdown in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • getConnectionBean

      public String getConnectionBean()
    • setConnectionBean

      public void setConnectionBean(String connectionBean)
      Name of MongoClient 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 the 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.
      Parameters:
      writeConcern - the standard name of the WriteConcern
      See Also:
    • setWriteConcern

      public void setWriteConcern(com.mongodb.WriteConcern writeConcern)
      Set the 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.
      Parameters:
      writeConcern - the standard name of the WriteConcern
      See Also:
    • getWriteConcern

      public com.mongodb.WriteConcern getWriteConcern()
    • setReadPreference

      public void setReadPreference(String readPreference)
      Sets a MongoDB 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.

      Parameters:
      readPreference - the name of the read preference to set
    • setReadPreference

      public void setReadPreference(com.mongodb.ReadPreference readPreference)
      Sets a MongoDB 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.

      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()