HBase
The connector provides sources, flows and sinks to interact with HBase database.
HBase is a column family NoSQL Database backed by HDFS. For more information about HBase, please visit the HBase documentation.
Project Info: Alpakka HBase | |
---|---|
Artifact | com.lightbend.akka
akka-stream-alpakka-hbase
1.1.2
|
JDK versions | OpenJDK 8 |
Scala versions | 2.12.7, 2.11.12, 2.13.0 |
JPMS module name | akka.stream.alpakka.hbase |
License | |
Readiness level |
Since 0.4, 2016-12-22
|
Home page | https://doc.akka.io/docs/alpakka/current |
API documentation | |
Forums | |
Release notes | In the documentation |
Issues | Github issues |
Sources | https://github.com/akka/alpakka |
Artifacts
- sbt
libraryDependencies += "com.lightbend.akka" %% "akka-stream-alpakka-hbase" % "1.1.2"
- Maven
<dependency> <groupId>com.lightbend.akka</groupId> <artifactId>akka-stream-alpakka-hbase_2.12</artifactId> <version>1.1.2</version> </dependency>
- Gradle
dependencies { compile group: 'com.lightbend.akka', name: 'akka-stream-alpakka-hbase_2.12', version: '1.1.2' }
The table below shows direct dependencies of this module and the second tab shows all libraries it depends on transitively.
- Direct dependencies
Organization Artifact Version License com.sun.xml.bind jaxb-impl 2.2.3-1 CDDL 1.1 com.typesafe.akka akka-stream_2.12 2.5.23 Apache License, Version 2.0 org.apache.hadoop hadoop-common 2.5.2 The Apache Software License, Version 2.0 org.apache.hadoop hadoop-mapreduce-client-core 2.5.2 The Apache Software License, Version 2.0 org.apache.hbase hbase-common 1.2.6.1 Apache License, Version 2.0 org.apache.hbase hbase-shaded-client 1.2.6.1 Apache License, Version 2.0 org.scala-lang scala-library 2.12.7 BSD 3-Clause - Dependency tree
com.sun.xml.bind jaxb-impl 2.2.3-1 CDDL 1.1 javax.xml.bind jaxb-api 2.2.2 CDDL 1.1 javax.activation activation 1.1 Common Development and Distribution License (CDDL) v1.0 javax.xml.stream stax-api 1.0-2 GNU General Public Library com.typesafe.akka akka-stream_2.12 2.5.23 Apache License, Version 2.0 com.typesafe.akka akka-actor_2.12 2.5.23 Apache License, Version 2.0 com.typesafe config 1.3.3 Apache License, Version 2.0 org.scala-lang.modules scala-java8-compat_2.12 0.8.0 BSD 3-clause org.scala-lang scala-library 2.12.7 BSD 3-Clause org.scala-lang scala-library 2.12.7 BSD 3-Clause com.typesafe.akka akka-protobuf_2.12 2.5.23 Apache License, Version 2.0 org.scala-lang scala-library 2.12.7 BSD 3-Clause com.typesafe ssl-config-core_2.12 0.3.7 Apache-2.0 com.typesafe config 1.3.3 Apache License, Version 2.0 org.scala-lang.modules scala-parser-combinators_2.12 1.1.1 BSD 3-clause org.scala-lang scala-library 2.12.7 BSD 3-Clause org.scala-lang scala-library 2.12.7 BSD 3-Clause org.reactivestreams reactive-streams 1.0.2 CC0 org.scala-lang scala-library 2.12.7 BSD 3-Clause org.apache.hadoop hadoop-common 2.5.2 The Apache Software License, Version 2.0 com.google.code.findbugs jsr305 1.3.9 The Apache Software License, Version 2.0 com.google.guava guava 12.0.1 The Apache Software License, Version 2.0 com.google.protobuf protobuf-java 2.5.0 New BSD license com.jcraft jsch 0.1.42 BSD com.sun.jersey jersey-core 1.9 CDDL 1.1 com.sun.jersey jersey-json 1.9 CDDL 1.1 com.sun.xml.bind jaxb-impl 2.2.3-1 CDDL 1.1 javax.xml.bind jaxb-api 2.2.2 CDDL 1.1 javax.activation activation 1.1 Common Development and Distribution License (CDDL) v1.0 javax.xml.stream stax-api 1.0-2 GNU General Public Library org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-jaxrs 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-xc 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jettison jettison 1.1 com.sun.jersey jersey-server 1.9 CDDL 1.1 asm asm 3.1 commons-cli commons-cli 1.2 The Apache Software License, Version 2.0 commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 commons-collections commons-collections 3.2.2 Apache License, Version 2.0 commons-configuration commons-configuration 1.6 The Apache Software License, Version 2.0 commons-beanutils commons-beanutils-core 1.8.0 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 commons-collections commons-collections 3.2.2 Apache License, Version 2.0 commons-digester commons-digester 1.8 The Apache Software License, Version 2.0 commons-beanutils commons-beanutils 1.7.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 commons-lang commons-lang 2.6 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 commons-el commons-el 1.0 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 commons-httpclient commons-httpclient 3.1 Apache License commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 commons-io commons-io 2.4 The Apache Software License, Version 2.0 commons-lang commons-lang 2.6 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 commons-net commons-net 3.1 The Apache Software License, Version 2.0 javax.servlet.jsp jsp-api 2.1 javax.servlet servlet-api 2.5 net.java.dev.jets3t jets3t 0.9.0 Apache License, Version 2.0 com.jamesmurty.utils java-xmlbuilder 0.4 Apache License, Version 2.0 commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 org.apache.httpcomponents httpclient 4.2.5 Apache License commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 org.apache.httpcomponents httpcore 4.2.4 Apache License org.apache.httpcomponents httpcore 4.2.4 Apache License org.apache.avro avro 1.7.4 The Apache Software License, Version 2.0 com.thoughtworks.paranamer paranamer 2.3 BSD org.apache.commons commons-compress 1.4.1 The Apache Software License, Version 2.0 org.tukaani xz 1.0 Public Domain org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License org.xerial.snappy snappy-java 1.0.4.1 The Apache Software License, Version 2.0 org.apache.commons commons-compress 1.4.1 The Apache Software License, Version 2.0 org.tukaani xz 1.0 Public Domain org.apache.commons commons-math3 3.1.1 The Apache Software License, Version 2.0 org.apache.hadoop hadoop-annotations 2.5.2 The Apache Software License, Version 2.0 org.apache.hadoop hadoop-auth 2.5.2 The Apache Software License, Version 2.0 commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 org.apache.directory.server apacheds-kerberos-codec 2.0.0-M15 The Apache Software License, Version 2.0 org.apache.directory.api api-asn1-api 1.0.0-M20 The Apache Software License, Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License org.apache.directory.api api-util 1.0.0-M20 The Apache Software License, Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License org.apache.directory.server apacheds-i18n 2.0.0-M15 The Apache Software License, Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License org.slf4j slf4j-api 1.7.7 MIT License org.apache.httpcomponents httpclient 4.2.5 Apache License commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 org.apache.httpcomponents httpcore 4.2.4 Apache License org.slf4j slf4j-api 1.7.7 MIT License org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.mortbay.jetty jetty-util 6.1.26 Apache Software License - Version 2.0 org.mortbay.jetty jetty 6.1.26 Apache Software License - Version 2.0 org.mortbay.jetty jetty-util 6.1.26 Apache Software License - Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License tomcat jasper-compiler 5.5.23 The Apache Software License, Version 2.0 tomcat jasper-runtime 5.5.23 The Apache Software License, Version 2.0 commons-el commons-el 1.0 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 javax.servlet servlet-api 2.5 xmlenc xmlenc 0.52 The BSD License org.apache.hadoop hadoop-mapreduce-client-core 2.5.2 The Apache Software License, Version 2.0 com.google.inject.extensions guice-servlet 3.0 The Apache Software License, Version 2.0 com.google.inject guice 3.0 The Apache Software License, Version 2.0 aopalliance aopalliance 1.0 Public Domain javax.inject javax.inject 1 The Apache Software License, Version 2.0 org.sonatype.sisu.inject cglib 2.2.1-v20090111 The Apache Software License, Version 2.0 asm asm 3.1 com.google.protobuf protobuf-java 2.5.0 New BSD license io.netty netty 3.6.2.Final Apache License, Version 2.0 org.apache.avro avro 1.7.4 The Apache Software License, Version 2.0 com.thoughtworks.paranamer paranamer 2.3 BSD org.apache.commons commons-compress 1.4.1 The Apache Software License, Version 2.0 org.tukaani xz 1.0 Public Domain org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License org.xerial.snappy snappy-java 1.0.4.1 The Apache Software License, Version 2.0 org.apache.hadoop hadoop-annotations 2.5.2 The Apache Software License, Version 2.0 org.apache.hadoop hadoop-yarn-common 2.5.2 The Apache Software License, Version 2.0 com.google.guava guava 12.0.1 The Apache Software License, Version 2.0 com.google.inject.extensions guice-servlet 3.0 The Apache Software License, Version 2.0 com.google.inject guice 3.0 The Apache Software License, Version 2.0 aopalliance aopalliance 1.0 Public Domain javax.inject javax.inject 1 The Apache Software License, Version 2.0 org.sonatype.sisu.inject cglib 2.2.1-v20090111 The Apache Software License, Version 2.0 asm asm 3.1 com.google.inject guice 3.0 The Apache Software License, Version 2.0 aopalliance aopalliance 1.0 Public Domain javax.inject javax.inject 1 The Apache Software License, Version 2.0 org.sonatype.sisu.inject cglib 2.2.1-v20090111 The Apache Software License, Version 2.0 asm asm 3.1 com.google.protobuf protobuf-java 2.5.0 New BSD license com.sun.jersey.contribs jersey-guice 1.9 CDDL 1.1 com.google.inject.extensions guice-servlet 3.0 The Apache Software License, Version 2.0 com.google.inject guice 3.0 The Apache Software License, Version 2.0 aopalliance aopalliance 1.0 Public Domain javax.inject javax.inject 1 The Apache Software License, Version 2.0 org.sonatype.sisu.inject cglib 2.2.1-v20090111 The Apache Software License, Version 2.0 asm asm 3.1 com.google.inject guice 3.0 The Apache Software License, Version 2.0 aopalliance aopalliance 1.0 Public Domain javax.inject javax.inject 1 The Apache Software License, Version 2.0 org.sonatype.sisu.inject cglib 2.2.1-v20090111 The Apache Software License, Version 2.0 asm asm 3.1 javax.inject javax.inject 1 The Apache Software License, Version 2.0 com.sun.jersey jersey-core 1.9 CDDL 1.1 com.sun.jersey jersey-json 1.9 CDDL 1.1 com.sun.xml.bind jaxb-impl 2.2.3-1 CDDL 1.1 javax.xml.bind jaxb-api 2.2.2 CDDL 1.1 javax.activation activation 1.1 Common Development and Distribution License (CDDL) v1.0 javax.xml.stream stax-api 1.0-2 GNU General Public Library org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-jaxrs 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-xc 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jettison jettison 1.1 com.sun.jersey jersey-server 1.9 CDDL 1.1 asm asm 3.1 commons-cli commons-cli 1.2 The Apache Software License, Version 2.0 commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 commons-io commons-io 2.4 The Apache Software License, Version 2.0 commons-lang commons-lang 2.6 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 javax.servlet servlet-api 2.5 javax.xml.bind jaxb-api 2.2.2 CDDL 1.1 javax.activation activation 1.1 Common Development and Distribution License (CDDL) v1.0 javax.xml.stream stax-api 1.0-2 GNU General Public Library org.apache.commons commons-compress 1.4.1 The Apache Software License, Version 2.0 org.tukaani xz 1.0 Public Domain org.apache.hadoop hadoop-annotations 2.5.2 The Apache Software License, Version 2.0 org.apache.hadoop hadoop-yarn-api 2.5.2 The Apache Software License, Version 2.0 com.google.guava guava 12.0.1 The Apache Software License, Version 2.0 com.google.protobuf protobuf-java 2.5.0 New BSD license commons-lang commons-lang 2.6 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 org.apache.hadoop hadoop-annotations 2.5.2 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-jaxrs 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-xc 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 The Apache Software License, Version 2.0 org.codehaus.jackson jackson-core-asl 1.9.13 The Apache Software License, Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License org.slf4j slf4j-api 1.7.7 MIT License org.apache.hbase hbase-common 1.2.6.1 Apache License, Version 2.0 com.github.stephenc.findbugs findbugs-annotations 1.3.9-1 Apache License, Version 2.0 com.google.guava guava 12.0.1 The Apache Software License, Version 2.0 com.google.protobuf protobuf-java 2.5.0 New BSD license commons-codec commons-codec 1.9 The Apache Software License, Version 2.0 commons-collections commons-collections 3.2.2 Apache License, Version 2.0 commons-io commons-io 2.4 The Apache Software License, Version 2.0 commons-lang commons-lang 2.6 The Apache Software License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 junit junit 4.12 Eclipse Public License 1.0 org.hamcrest hamcrest-core 1.3 New BSD License org.apache.hbase hbase-annotations 1.2.6.1 Apache License, Version 2.0 com.github.stephenc.findbugs findbugs-annotations 1.3.9-1 Apache License, Version 2.0 junit junit 4.12 Eclipse Public License 1.0 org.hamcrest hamcrest-core 1.3 New BSD License org.apache.hbase hbase-protocol 1.2.6.1 Apache License, Version 2.0 com.github.stephenc.findbugs findbugs-annotations 1.3.9-1 Apache License, Version 2.0 com.google.protobuf protobuf-java 2.5.0 New BSD license commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 junit junit 4.12 Eclipse Public License 1.0 org.hamcrest hamcrest-core 1.3 New BSD License org.apache.hbase hbase-annotations 1.2.6.1 Apache License, Version 2.0 com.github.stephenc.findbugs findbugs-annotations 1.3.9-1 Apache License, Version 2.0 junit junit 4.12 Eclipse Public License 1.0 org.hamcrest hamcrest-core 1.3 New BSD License org.apache.htrace htrace-core 3.1.0-incubating The Apache Software License, Version 2.0 org.mortbay.jetty jetty-util 6.1.26 Apache Software License - Version 2.0 org.apache.hbase hbase-shaded-client 1.2.6.1 Apache License, Version 2.0 com.github.stephenc.findbugs findbugs-annotations 1.3.9-1 Apache License, Version 2.0 commons-logging commons-logging 1.2 The Apache Software License, Version 2.0 junit junit 4.12 Eclipse Public License 1.0 org.hamcrest hamcrest-core 1.3 New BSD License org.apache.htrace htrace-core 3.1.0-incubating The Apache Software License, Version 2.0 org.slf4j slf4j-api 1.7.7 MIT License org.scala-lang scala-library 2.12.7 BSD 3-Clause
Converters
Converters map the domain object to a list of HBase mutations (Append
, Delete
, Increment
, Put
).
Put
- Scala
-
implicit def toBytes(string: String): Array[Byte] = Bytes.toBytes(string) case class Person(id: Int, name: String) val hBaseConverter: Person => immutable.Seq[Mutation] = { person => val put = new Put(s"id_${person.id}") put.addColumn("info", "name", person.name) List(put) }
- Java
-
Function<Person, List<Mutation>> hBaseConverter = person -> { try { Put put = new Put(String.format("id_%d", person.id).getBytes("UTF-8")); put.addColumn( "info".getBytes("UTF-8"), "name".getBytes("UTF-8"), person.name.getBytes("UTF-8")); return Collections.singletonList(put); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return Collections.emptyList(); } };
Append
- Scala
-
val appendHBaseConverter: Person => immutable.Seq[Mutation] = { person => // Append to a cell val append = new Append(s"id_${person.id}") append.add("info", "aliases", person.name) List(append) }
- Java
-
Function<Person, List<Mutation>> appendHBaseConverter = person -> { try { Append append = new Append(String.format("id_%d", person.id).getBytes("UTF-8")); append.add( "info".getBytes("UTF-8"), "aliases".getBytes("UTF-8"), person.name.getBytes("UTF-8")); return Collections.singletonList(append); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return Collections.emptyList(); } };
Delete
- Scala
-
val deleteHBaseConverter: Person => immutable.Seq[Mutation] = { person => // Delete the specified row val delete = new Delete(s"id_${person.id}") List(delete) }
- Java
-
Function<Person, List<Mutation>> deleteHBaseConverter = person -> { try { Delete delete = new Delete(String.format("id_%d", person.id).getBytes("UTF-8")); return Collections.singletonList(delete); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return Collections.emptyList(); } };
Increment
- Scala
-
val incrementHBaseConverter: Person => immutable.Seq[Mutation] = { person => // Increment a cell value val increment = new Increment(s"id_${person.id}") increment.addColumn("info", "numberOfChanges", 1) List(increment) }
- Java
-
Function<Person, List<Mutation>> incrementHBaseConverter = person -> { try { Increment increment = new Increment(String.format("id_%d", person.id).getBytes("UTF-8")); increment.addColumn("info".getBytes("UTF-8"), "numberOfChanges".getBytes("UTF-8"), 1); return Collections.singletonList(increment); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return Collections.emptyList(); } };
Complex and noop mutations
To ignore an object return an empty List
- this will have no effect on HBase. You can also combine mutations to perform complex business logic:
- Scala
-
val mutationsHBaseConverter: Person => immutable.Seq[Mutation] = { person => if (person.id != 0) { if (person.name.isEmpty) { // Delete the specified row val delete = new Delete(s"id_${person.id}") List(delete) } else { // Insert or update a row val put = new Put(s"id_${person.id}") put.addColumn("info", "name", person.name) val increment = new Increment(s"id_${person.id}") increment.addColumn("info", "numberOfChanges", 1) List(put, increment) } } else { List.empty } }
- Java
-
Function<Person, List<Mutation>> complexHBaseConverter = person -> { try { byte[] id = String.format("id_%d", person.id).getBytes("UTF-8"); byte[] infoFamily = "info".getBytes("UTF-8"); if (person.id != 0 && person.name.isEmpty()) { Delete delete = new Delete(id); return Collections.singletonList(delete); } else if (person.id != 0) { Put put = new Put(id); put.addColumn(infoFamily, "name".getBytes("UTF-8"), person.name.getBytes("UTF-8")); Increment increment = new Increment(id); increment.addColumn(infoFamily, "numberOfChanges".getBytes("UTF-8"), 1); return Arrays.asList(put, increment); } else { return Collections.emptyList(); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); return Collections.emptyList(); } };
If you return a list of mutations they will be applied in the same order. The list of mutations are not applied in an transaction, each mutation is independent.
Settings
HBase combinators require HTableSettings
. If the table referenced in the settings does not exist, it will be created on demand.
- Scala
-
val tableSettings = HTableSettings(HBaseConfiguration.create(), TableName.valueOf("person"), immutable.Seq("info"), hBaseConverter)
- Java
-
HTableSettings<Person> tableSettings = HTableSettings.create( HBaseConfiguration.create(), TableName.valueOf("person1"), Collections.singletonList("info"), hBaseConverter);
Source
- Scala
-
val scan = new Scan(new Get(Bytes.toBytes("id_100"))) val f = HTableStage .source(scan, tableSettings) .runWith(Sink.seq)
- Java
-
Scan scan = new Scan(new Get("id_300".getBytes("UTF-8"))); CompletionStage<List<Result>> f = HTableStage.source(scan, tableSettings).runWith(Sink.seq(), materializer);
Flow
- Scala
-
val flow = HTableStage.flow[Person](tableSettings) val f = Source(11 to 20).map(i => Person(i, s"zozo_$i")).via(flow).runWith(Sink.fold(0)((a, d) => a + d.id))
- Java
-
Flow<Person, Person, NotUsed> flow = HTableStage.flow(tableSettings); Pair<NotUsed, CompletionStage<List<Person>>> run = Source.from(Arrays.asList(200, 201, 202, 203, 204)) .map((i) -> new Person(i, String.format("name_%d", i))) .via(flow) .toMat(Sink.seq(), Keep.both()) .run(materializer);
Sink
- Scala
-
val sink = HTableStage.sink[Person](tableSettings) val f = Source(1 to 10).map(i => Person(i, s"zozo_$i")).runWith(sink)
- Java
-
final Sink<Person, CompletionStage<Done>> sink = HTableStage.sink(tableSettings); CompletionStage<Done> o = Source.from(Arrays.asList(100, 101, 102, 103, 104)) .map((i) -> new Person(i, String.format("name %d", i))) .runWith(sink, materializer);
HBase administration commands
To manage HBase database, startup HBase shell ($HBASE_HOME/bin/shell
), and run following commands:
list // list tables
scan "person" // select * from person
disable "person" // Disable table "person", before drop
drop "person"