IBM InfoSphere Streams Version 4.1.0

Operator HBASEPut

Primitive operator image not displayed. Problem loading file: ../../image/tk$com.ibm.streamsx.hbase/op$com.ibm.streamsx.hbase$HBASEPut.svg

The HBASEPut operator puts tuples in HBASE. It includes support for checkAndPut. If the value is a primitive type, a Put method must have a row, columnFamily, columnQualifier,and value specified. The row and value are derived from the input tuple, which is specified by the rowAttrName and valueAttrName parameters. The columnFamily and columnQualifier can be specified in the same way, by using the columnFamilyAttrName and columnQualifierAttrName parameters. Alternatively, they can be the same for all tuples, by setting the staticColumnFamily and staticColumnQualifier parameters.

Here is an example:
           () as allSink = HBASEPut(full)
            {
                    param
                            tableName : "streamsSample_lotr" ;
                            rowAttrName : "character" ;
                            columnFamilyAttrName : "colF" ;
                            columnQualifierAttrName : "colQ" ;
                            valueAttrName : "value" ;
            }
If the value is a tuple type, then the attribute names of the tuple are interpreted as the columnQualifiers for the correponding values. Here is an snippet from the PutRecord sample application. We create the toHBASE stream:
            stream<rstring key, tuple<rstring title, rstring author_fname,
                    rstring author_lname, rstring year, rstring rating> bookData> toHBASE =
                    Functor(bookStream)
            {
                  //// ...
            }
Then we can use HBASEPut as follows:
            () as putsink = HBASEPut(toHBASE)
            {
                    param
                            rowAttrName : "key" ;
                            tableName : "streamsSample_books" ;
                            staticColumnFamily : "all" ;
                            valueAttrName : "bookData" ;
            }

To support locking, HBASE supports a conditional put operation. This operator supports that operation by using the checkAttrName parameter. If that parameter is set, then the input attribute it refers to must be a valid check type. For more information, see the parameter description. On a put operation, the condition is checked.If it passes, the put operation happens; if not, the put operation fails. To check the success or failure of the put operation, use an optional output port. The attribute that is specified in the successAttr parameter on the output port is set to true if the put operation occurs, and false otherwise.

Behavior in a consistent region

The HBASEPut operator can be in a consistent region, but it cannot be the start of a consistent region. At drain points, it flushes its internal buffer. At resets, it clears its internal buffer.The operator ensures at-least-once tuple processing, but does not guarentee exactly-once tuple processing. If there is a reset, the same entry might be put twice. If you use this operator with the HBASEGet operator to do a get, modify, and put operation on the same entry in a consistent region, you could end up doingthe modification twice. That scenario is not recommended. If you need exactly-once tuple processing, it might be possible to use checkAndPut with sequence numbers.

Summary

Ports
This operator has 1 input port and 1 output port.
Windowing
This operator does not accept any windowing configurations.
Parameters
This operator supports 11 parameters. (batchSize, checkAttrName, columnFamilyAttrName, columnQualifierAttrName, hbaseSite, rowAttrName, staticColumnFamily, staticColumnQualifier, successAttr, tableName, valueAttrName)
Metrics
This operator does not report any metrics.

Properties

Implementation
Java™

Input Ports

Ports (0)

Tuple to put into HBASE

Properties

Output Ports

Assignments
Java operators do not support output assignments.
Ports (0)

Optional port for success or failure information.

Properties

Parameters

This operator supports 11 parameters.
batchSize

Maximum number of Puts or Deletes to buffer before sending to HBase. Larger numbers are more efficient, but increase the risk of lost changes on operator crash. In a consistent region, a drain flushes the buffer to HBase.

Properties
checkAttrName

Name of the attribute specifying the tuple to check for before applying the Put or Delete. The type of the attribute is tuple with attributes columnFamily and columnQualifier, or a tuple with attributes columnFamily, columnQualifier, and value. In the first case, the Put or Delete will be allowed to proceed only when there is no entry for the row, columnFamily, columnQualifer combination. When the the type of the attribute given by checkAttrName contains an attribute value, the Put or Delete operation will only succeed when the entry specified the row, columnFamily, and columnQualifier has the given value.

Properties
columnFamilyAttrName

Name of the attribute on the input tuple containing the columnFamily. Cannot be used with staticColumnFmily.

Properties
columnQualifierAttrName

Name of the attribute on the input tuple containing the columnQualifier. Cannot be used with staticColumnQualifier.

Properties
hbaseSite

The hbase-site.xml file. This is the recommended way to specify the HBASE configuration. If not specified, then HBASE_HOME must be set when the operator runs, and it will use $HBASE_SITE/conf/hbase-site.xml

Properties
rowAttrName

Name of the attribute on the input tuple containing the row. It is required.

Properties
staticColumnFamily

If this parameter is specified, it will be used as the columnFamily for all operations. (Compare to columnFamilyAttrName.) For HBASEScan, it can have cardinality greater than one.

Properties
staticColumnQualifier

If this parameter is specified, it will be used as the columnQualifier for all tuples. HBASEScan allows it to be specified multiple times.

Properties
successAttr

Attribute on the output port to be set to true if the check passes and the action is successful

Properties
tableName

Name of the HBASE table. If it does not exist, the operator will throw an exception on startup

Properties
valueAttrName

This parmeter specifies the name of the attribute that contains the value that is put into the table.

Properties

Libraries

Operator class library
Library Path: ../../impl/lib/com.ibm.streamsx.hbase.jar, ../../opt/downloaded/*