Package org.apache.camel.component.hbase
Class HBaseEndpoint
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.DefaultEndpoint
-
- org.apache.camel.component.hbase.HBaseEndpoint
-
- 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.10.0", scheme="hbase", title="HBase", syntax="hbase:tableName", category={BIGDATA,DATABASE,HADOOP}) public class HBaseEndpoint extends org.apache.camel.support.DefaultEndpoint
Reading and write from/to an HBase store (Hadoop database).
-
-
Constructor Summary
Constructors Constructor Description HBaseEndpoint(String uri, HBaseComponent component, String tableName)
-
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
doStop()
CellMappingStrategyFactory
getCellMappingStrategyFactory()
HBaseComponent
getComponent()
List<org.apache.hadoop.hbase.filter.Filter>
getFilters()
String
getMappingStrategyClassName()
String
getMappingStrategyName()
int
getMaxMessagesPerPoll()
int
getMaxResults()
String
getOperation()
HBaseRemoveHandler
getRemoveHandler()
Map<String,Object>
getRowMapping()
HBaseRow
getRowModel()
org.apache.hadoop.hbase.client.Table
getTable()
Gets connection to the table (secured or not, depends on the object initialization) please remember to close the table after useorg.apache.hadoop.security.UserGroupInformation
getUserGroupInformation()
boolean
isRemove()
void
setCellMappingStrategyFactory(CellMappingStrategyFactory cellMappingStrategyFactory)
To use a custom CellMappingStrategyFactory that is responsible for mapping cells.void
setFilters(List<org.apache.hadoop.hbase.filter.Filter> filters)
A list of filters to use.void
setMappingStrategyClassName(String mappingStrategyClassName)
The class name of a custom mapping strategy implementation.void
setMappingStrategyName(String mappingStrategyName)
The strategy to use for mapping Camel messages to HBase columns.void
setMaxMessagesPerPoll(int maxMessagesPerPoll)
Gets the maximum number of messages as a limit to poll at each polling.void
setMaxResults(int maxResults)
The maximum number of rows to scan.void
setOperation(String operation)
The HBase operation to performvoid
setRemove(boolean remove)
If the option is true, Camel HBase Consumer will remove the rows which it processes.void
setRemoveHandler(HBaseRemoveHandler removeHandler)
To use a custom HBaseRemoveHandler that is executed when a row is to be removed.void
setRowMapping(Map<String,Object> rowMapping)
To map the key/values from the Map to aHBaseRow
.void
setRowModel(HBaseRow rowModel)
An instance of org.apache.camel.component.hbase.model.HBaseRow which describes how each row should be modeledvoid
setUserGroupInformation(org.apache.hadoop.security.UserGroupInformation userGroupInformation)
Defines privileges to communicate with HBase such as using kerberos.-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doStart, equals, getCamelContext, 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
-
-
-
-
Constructor Detail
-
HBaseEndpoint
public HBaseEndpoint(String uri, HBaseComponent component, String tableName)
-
-
Method Detail
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception
- Throws:
Exception
-
getComponent
public HBaseComponent getComponent()
- Overrides:
getComponent
in classorg.apache.camel.support.DefaultEndpoint
-
getMaxResults
public int getMaxResults()
-
setMaxResults
public void setMaxResults(int maxResults)
The maximum number of rows to scan.
-
getFilters
public List<org.apache.hadoop.hbase.filter.Filter> getFilters()
-
setFilters
public void setFilters(List<org.apache.hadoop.hbase.filter.Filter> filters)
A list of filters to use.
-
getOperation
public String getOperation()
-
setOperation
public void setOperation(String operation)
The HBase operation to perform
-
getCellMappingStrategyFactory
public CellMappingStrategyFactory getCellMappingStrategyFactory()
-
setCellMappingStrategyFactory
public void setCellMappingStrategyFactory(CellMappingStrategyFactory cellMappingStrategyFactory)
To use a custom CellMappingStrategyFactory that is responsible for mapping cells.
-
getMappingStrategyName
public String getMappingStrategyName()
-
setMappingStrategyName
public void setMappingStrategyName(String mappingStrategyName)
The strategy to use for mapping Camel messages to HBase columns. Supported values: header, or body.
-
getMappingStrategyClassName
public String getMappingStrategyClassName()
-
setMappingStrategyClassName
public void setMappingStrategyClassName(String mappingStrategyClassName)
The class name of a custom mapping strategy implementation.
-
getRowModel
public HBaseRow getRowModel()
-
setRowModel
public void setRowModel(HBaseRow rowModel)
An instance of org.apache.camel.component.hbase.model.HBaseRow which describes how each row should be modeled
-
isRemove
public boolean isRemove()
-
setRemove
public void setRemove(boolean remove)
If the option is true, Camel HBase Consumer will remove the rows which it processes.
-
getRemoveHandler
public HBaseRemoveHandler getRemoveHandler()
-
setRemoveHandler
public void setRemoveHandler(HBaseRemoveHandler removeHandler)
To use a custom HBaseRemoveHandler that is executed when a row is to be removed.
-
getMaxMessagesPerPoll
public int getMaxMessagesPerPoll()
-
setMaxMessagesPerPoll
public void setMaxMessagesPerPoll(int maxMessagesPerPoll)
Gets the maximum number of messages as a limit to poll at each polling. Is default unlimited, but use 0 or negative number to disable it as unlimited.
-
getUserGroupInformation
public org.apache.hadoop.security.UserGroupInformation getUserGroupInformation()
-
setUserGroupInformation
public void setUserGroupInformation(org.apache.hadoop.security.UserGroupInformation userGroupInformation)
Defines privileges to communicate with HBase such as using kerberos.
-
setRowMapping
public void setRowMapping(Map<String,Object> rowMapping)
To map the key/values from the Map to aHBaseRow
. The following keys is supported:- rowId - The id of the row. This has limited use as the row usually changes per Exchange.
- rowType - The type to covert row id to. Supported operations: CamelHBaseScan.
- family - The column family. Supports a number suffix for referring to more than one columns.
- qualifier - The column qualifier. Supports a number suffix for referring to more than one columns.
- value - The value. Supports a number suffix for referring to more than one columns
- valueType - The value type. Supports a number suffix for referring to more than one columns. Supported operations: CamelHBaseGet, and CamelHBaseScan.
-
doInit
protected void doInit() throws Exception
- Overrides:
doInit
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.DefaultEndpoint
- Throws:
Exception
-
getTable
public org.apache.hadoop.hbase.client.Table getTable() throws IOException
Gets connection to the table (secured or not, depends on the object initialization) please remember to close the table after use- Returns:
- table, remember to close!
- Throws:
IOException
-
-