public class ChannelBuilder
extends java.lang.Object
ChannelBuilder implements a build pattern for Channel to ease constructing instances of it.
| Constructor and Description |
|---|
ChannelBuilder(java.lang.String base,
ChannelAuth auth,
java.lang.String consumerGroup)
Constructor for
ChannelBuilder |
| Modifier and Type | Method and Description |
|---|---|
Channel |
build()
Build a
Channel object using the previously set parameters. |
ChannelBuilder |
withCertificateBundle(java.lang.String verifyCertBundle)
|
ChannelBuilder |
withConsumerPathPrefix(java.lang.String consumerPathPrefix)
|
ChannelBuilder |
withExtraConfigs(java.util.Properties extraConfigs)
|
ChannelBuilder |
withHttpProxy(HttpProxySettings httpProxySettings)
|
ChannelBuilder |
withPathPrefix(java.lang.String pathPrefix)
|
ChannelBuilder |
withProducerPathPrefix(java.lang.String producerPathPrefix)
|
ChannelBuilder |
withRetryOnFail(boolean retryOnFail)
|
public ChannelBuilder(java.lang.String base,
ChannelAuth auth,
java.lang.String consumerGroup)
Constructor for ChannelBuilder
Its parameters are mandatory parameters to create a Channel instance.
base - base URL at which the streaming service resides. This base URL applies to both, consume and produce
requests.auth - Authentication object to use for channel requests.consumerGroup - Consumer group to subscribe the channel consumer topublic ChannelBuilder withPathPrefix(java.lang.String pathPrefix)
pathPrefix - Path to append to streaming service requests. If pathPrefix is set, then it will take
precedence over consumerPathPrefix and producerPathPrefix. This means that it is this
pathPrefix the one to be appended to consume and produce requests while consumerPathPrefix and
producerPathPrefix will be ignored.ChannelBuilder instancepublic ChannelBuilder withConsumerPathPrefix(java.lang.String consumerPathPrefix)
consumerPathPrefix - Path to append to consumer-related requests made to the streaming service. Note that
if the pathPrefix parameter is set to a non-empty value, the pathPrefix value will be
appended to consumer-related requests instead of the consumerPathPrefix value.ChannelBuilder instancepublic ChannelBuilder withProducerPathPrefix(java.lang.String producerPathPrefix)
producerPathPrefix - Path to append to producer-related requests made to the streaming service. Note that
if the pathPrefix parameter is set to a non-empty value, the pathPrefix value will be
appended to producer-related requests instead of the producerPathPrefix value.ChannelBuilderpublic ChannelBuilder withRetryOnFail(boolean retryOnFail)
retryOnFail - Whether or not the channel will automatically retry a call which failed due to a temporary
error.ChannelBuilder instancepublic ChannelBuilder withCertificateBundle(java.lang.String verifyCertBundle)
verifyCertBundle - CA Bundle chain certificates. This string shall be either the certificates themselves or
a path to a CA bundle file containing those certificates. The CA bundle is used to
validate that the certificate of the authentication server being connected to was signed
by a valid authority. If set to an empty string, the server certificate will not be
validated.ChannelBuilder instancepublic ChannelBuilder withExtraConfigs(java.util.Properties extraConfigs)
extraConfigs - Dictionary of key/value pairs containing any custom configuration settings which should be
sent to the streaming service when a consumer is created. Examples of key/value pairs are:
("auto.offset.reset", "latest"); ("request.timeout.ms", 30000) and
("session.timeout.ms", 10000).ChannelBuilder instancepublic ChannelBuilder withHttpProxy(HttpProxySettings httpProxySettings)
httpProxySettings - contains http proxy hostname, port, username and password.ChannelBuilder instancepublic Channel build() throws TemporaryError
Build a Channel object using the previously set parameters.
Channel object which can consume records from subscribed topics and also produce records to
topics specified in the ProducerRecordsTemporaryError - if Channel http client request object failed to be created.