V - Type of values to read from / write to couchbasepublic abstract class BaseCouchbaseTableFunction<V>
extends org.apache.samza.table.remote.BaseTableFunction
CouchbaseTableReadFunction and CouchbaseTableWriteFunction| Modifier and Type | Field and Description |
|---|---|
protected com.couchbase.client.java.Bucket |
bucket |
protected java.lang.String |
bucketName |
protected java.util.List<java.lang.String> |
clusterNodes |
protected org.apache.samza.table.remote.couchbase.CouchbaseEnvironmentConfigs |
environmentConfigs |
protected java.time.Duration |
timeout |
protected java.time.Duration |
ttl |
protected org.apache.samza.serializers.Serde<V> |
valueSerde |
| Constructor and Description |
|---|
BaseCouchbaseTableFunction(java.lang.String bucketName,
java.lang.Class<V> valueClass,
java.lang.String... clusterNodes)
Constructor for BaseCouchbaseTableFunction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
init(org.apache.samza.context.Context context,
org.apache.samza.table.AsyncReadWriteTable table) |
boolean |
isRetriable(java.lang.Throwable exception)
Check whether the exception is caused by one of the temporary failure exceptions, which are
likely to be retriable.
|
<T extends BaseCouchbaseTableFunction<V>> |
withBootstrapCarrierDirectPort(int bootstrapCarrierDirectPort)
If carrier publication bootstrap is enabled and not SSL, sets the port to use.
|
<T extends BaseCouchbaseTableFunction<V>> |
withBootstrapCarrierSslPort(int bootstrapCarrierSslPort)
If carrier publication bootstrap and SSL are enabled, sets the port to use.
|
<T extends BaseCouchbaseTableFunction<V>> |
withBootstrapHttpDirectPort(int bootstrapHttpDirectPort)
If Http bootstrap is enabled and not SSL, sets the port to use.
|
<T extends BaseCouchbaseTableFunction<V>> |
withBootstrapHttpSslPort(int bootstrapHttpSslPort)
If Http bootstrap and SSL are enabled, sets the port to use.
|
<T extends BaseCouchbaseTableFunction<V>> |
withSerde(org.apache.samza.serializers.Serde<V> valueSerde)
Serde is used to serialize and deserialize values to/from byte array.
|
<T extends BaseCouchbaseTableFunction<V>> |
withSslEnabledAndCertAuthEnabled(boolean certAuthEnabled)
Enable certificate-based authentication and set sslEnabled to be true.
|
<T extends BaseCouchbaseTableFunction<V>> |
withSslKeystoreFileAndPassword(java.lang.String sslKeystoreFile,
java.lang.String sslKeystorePassword)
Defines the location and password of the SSL Keystore file (default value null).
|
<T extends BaseCouchbaseTableFunction<V>> |
withSslTruststoreFileAndPassword(java.lang.String sslTruststoreFile,
java.lang.String sslTruststorePassword)
Defines the location and password of the SSL TrustStore keystore file (default value null).
|
<T extends BaseCouchbaseTableFunction<V>> |
withTimeout(java.time.Duration timeout)
Set the timeout limit on the read / write operations.
|
<T extends BaseCouchbaseTableFunction<V>> |
withTtl(java.time.Duration ttl)
Set the TTL for the data writen to Couchbase.
|
<T extends BaseCouchbaseTableFunction<V>> |
withUsernameAndPassword(java.lang.String username,
java.lang.String password)
Enable role-based authentication with username and password.
|
protected transient com.couchbase.client.java.Bucket bucket
protected org.apache.samza.serializers.Serde<V> valueSerde
protected java.time.Duration timeout
protected java.time.Duration ttl
protected final java.util.List<java.lang.String> clusterNodes
protected final java.lang.String bucketName
protected final org.apache.samza.table.remote.couchbase.CouchbaseEnvironmentConfigs environmentConfigs
public BaseCouchbaseTableFunction(java.lang.String bucketName,
java.lang.Class<V> valueClass,
java.lang.String... clusterNodes)
bucketName - Name of the Couchbase bucketvalueClass - type of valuesclusterNodes - Some Hosts of the Couchbase cluster. Recommended to provide more than one nodes so that if
the first node could not be connected, other nodes can be tried.public void init(org.apache.samza.context.Context context,
org.apache.samza.table.AsyncReadWriteTable table)
init in interface org.apache.samza.table.remote.TableFunctioninit in class org.apache.samza.table.remote.BaseTableFunctionpublic void close()
public boolean isRetriable(java.lang.Throwable exception)
exception - exception thrown by the table providerpublic <T extends BaseCouchbaseTableFunction<V>> T withTimeout(java.time.Duration timeout)
T - type of this instancetimeout - Timeout durationpublic <T extends BaseCouchbaseTableFunction<V>> T withTtl(java.time.Duration ttl)
T - type of this instancettl - TTL durationpublic <T extends BaseCouchbaseTableFunction<V>> T withSerde(org.apache.samza.serializers.Serde<V> valueSerde)
JsonObject, a Serde must be provided.T - type of this instancevalueSerde - value serdepublic <T extends BaseCouchbaseTableFunction<V>> T withUsernameAndPassword(java.lang.String username, java.lang.String password)
T - type of this instanceusername - usernamepassword - passwordpublic <T extends BaseCouchbaseTableFunction<V>> T withSslEnabledAndCertAuthEnabled(boolean certAuthEnabled)
T - type of this instancecertAuthEnabled - allows to enable X.509 client certificate authenticationpublic <T extends BaseCouchbaseTableFunction<V>> T withSslKeystoreFileAndPassword(java.lang.String sslKeystoreFile, java.lang.String sslKeystorePassword)
withSslTruststoreFileAndPassword(java.lang.String, java.lang.String) this keystore will be used to initialize
both the key factory as well as the trust factory with java SSL. This
needs to be the case for backwards compatibility, but if you do not need
X.509 client cert authentication you might as well just use withSslTruststoreFileAndPassword(java.lang.String, java.lang.String)
alone.T - type of this instancesslKeystoreFile - path of ssl keystore filesslKeystorePassword - password of ssl keystorepublic <T extends BaseCouchbaseTableFunction<V>> T withSslTruststoreFileAndPassword(java.lang.String sslTruststoreFile, java.lang.String sslTruststorePassword)
withSslKeystoreFileAndPassword(java.lang.String, java.lang.String) this keystore will be used to initialize
both the key factory as well as the trust factory with java SSL. Prefer
this method over the withSslKeystoreFileAndPassword(java.lang.String, java.lang.String) if you do not need
X.509 client auth and just need server side certificate checking.T - type of this instancesslTruststoreFile - path of truststore filesslTruststorePassword - password of truststorepublic <T extends BaseCouchbaseTableFunction<V>> T withBootstrapCarrierDirectPort(int bootstrapCarrierDirectPort)
T - type of this instancebootstrapCarrierDirectPort - bootstrap carrier direct portpublic <T extends BaseCouchbaseTableFunction<V>> T withBootstrapCarrierSslPort(int bootstrapCarrierSslPort)
T - type of this instancebootstrapCarrierSslPort - bootstrap carrier ssl portpublic <T extends BaseCouchbaseTableFunction<V>> T withBootstrapHttpDirectPort(int bootstrapHttpDirectPort)
T - type of this instancebootstrapHttpDirectPort - bootstrap http direct portpublic <T extends BaseCouchbaseTableFunction<V>> T withBootstrapHttpSslPort(int bootstrapHttpSslPort)
T - type of this instancebootstrapHttpSslPort - bootstrap http ssl port