Class CouchDbEndpoint
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultEndpoint
-
- org.apache.camel.component.couchdb.CouchDbEndpoint
-
- 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.11.0", scheme="couchdb", title="CouchDB", syntax="couchdb:protocol:hostname:port/database", category={DATABASE,NOSQL}) public class CouchDbEndpoint extends org.apache.camel.support.DefaultEndpointConsume changesets for inserts, updates and deletes in a CouchDB database, as well as get, save, update and delete documents from a CouchDB database.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_HEARTBEATstatic intDEFAULT_PORTstatic StringDEFAULT_STYLE
-
Constructor Summary
Constructors Constructor Description CouchDbEndpoint()CouchDbEndpoint(String endpointUri, String remaining, CouchDbComponent component)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CouchDbClientWrappercreateClient()org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor)org.apache.camel.ProducercreateProducer()StringgetDatabase()longgetHeartbeat()StringgetHostname()StringgetPassword()intgetPort()StringgetProtocol()CouchDbResumeStrategygetResumeStrategy()StringgetStyle()StringgetUsername()booleanisCreateDatabase()booleanisDeletes()booleanisUpdates()voidsetCreateDatabase(boolean createDatabase)Creates the database if it does not already existvoidsetDatabase(String database)Name of the database to usevoidsetDeletes(boolean deletes)Document deletes are published as eventsvoidsetHeartbeat(long heartbeat)How often to send an empty message to keep socket alive in millisvoidsetHostname(String hostname)Hostname of the running couchdb instancevoidsetPassword(String password)Password for authenticated databasesvoidsetPort(int port)Port number for the running couchdb instancevoidsetProtocol(String protocol)The protocol to use for communicating with the database.voidsetResumeStrategy(CouchDbResumeStrategy resumeStrategy)Sets a custom resume strategy for tracking changes from CouchDB.voidsetStyle(String style)Specifies how many revisions are returned in the changes array.voidsetUpdates(boolean updates)Document inserts/updates are published as eventsvoidsetUsername(String username)Username in case of authenticated databases-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, 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, doShutdown, 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
-
DEFAULT_STYLE
public static final String DEFAULT_STYLE
- See Also:
- Constant Field Values
-
DEFAULT_HEARTBEAT
public static final long DEFAULT_HEARTBEAT
- See Also:
- Constant Field Values
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CouchDbEndpoint
public CouchDbEndpoint()
-
CouchDbEndpoint
public CouchDbEndpoint(String endpointUri, String remaining, CouchDbComponent component) throws Exception
- Throws:
Exception
-
-
Method Detail
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception- Throws:
Exception
-
createClient
protected CouchDbClientWrapper createClient()
-
getProtocol
public String getProtocol()
-
setProtocol
public void setProtocol(String protocol)
The protocol to use for communicating with the database.
-
getHostname
public String getHostname()
-
setHostname
public void setHostname(String hostname)
Hostname of the running couchdb instance
-
getStyle
public String getStyle()
-
setStyle
public void setStyle(String style)
Specifies how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts.)
-
getUsername
public String getUsername()
-
setUsername
public void setUsername(String username)
Username in case of authenticated databases
-
getDatabase
public String getDatabase()
-
setDatabase
public void setDatabase(String database)
Name of the database to use
-
getPassword
public String getPassword()
-
setPassword
public void setPassword(String password)
Password for authenticated databases
-
getPort
public int getPort()
-
setPort
public void setPort(int port)
Port number for the running couchdb instance
-
getHeartbeat
public long getHeartbeat()
-
setHeartbeat
public void setHeartbeat(long heartbeat)
How often to send an empty message to keep socket alive in millis
-
isCreateDatabase
public boolean isCreateDatabase()
-
setCreateDatabase
public void setCreateDatabase(boolean createDatabase)
Creates the database if it does not already exist
-
isDeletes
public boolean isDeletes()
-
setDeletes
public void setDeletes(boolean deletes)
Document deletes are published as events
-
isUpdates
public boolean isUpdates()
-
setUpdates
public void setUpdates(boolean updates)
Document inserts/updates are published as events
-
getResumeStrategy
public CouchDbResumeStrategy getResumeStrategy()
-
setResumeStrategy
public void setResumeStrategy(CouchDbResumeStrategy resumeStrategy)
Sets a custom resume strategy for tracking changes from CouchDB. It allows tracking from a specific point (i.e.: since the given update sequence, the latest sequence, etc).
-
-