Package org.hyperledger.fabric.client
Interface Gateway.Builder
- Enclosing interface:
Gateway
public static interface Gateway.Builder
The builder is used to specify the options used when connecting a Gateway. An instance of builder is created
using the static method
Gateway.newInstance()
. Every method on the builder object will return
a reference to the same builder object allowing them to be chained together in a single line, terminating with
a call to connect()
to complete connection of the Gateway.-
Method Summary
Modifier and TypeMethodDescriptionSpecify the default call options for block and private data events.blockEventsOptions
(UnaryOperator<CallOptions> options) Specify the default call options for block events.chaincodeEventsOptions
(UnaryOperator<CallOptions> options) Specify the default call options for chaincode events.default Gateway.Builder
chaincodeEventsOptions
(CallOption... options) Deprecated.commitStatusOptions
(UnaryOperator<CallOptions> options) Specify the default call options for retrieving transaction commit status.default Gateway.Builder
commitStatusOptions
(CallOption... options) Deprecated.Replaced bycommitStatusOptions(UnaryOperator)
.connect()
Connects to the gateway using the specified options.connection
(Channel grpcChannel) Specifies an existing gRPC connection to be used by the Gateway.endorseOptions
(UnaryOperator<CallOptions> options) Specify the default call options for endorsements.default Gateway.Builder
endorseOptions
(CallOption... options) Deprecated.Replaced byendorseOptions(UnaryOperator)
.evaluateOptions
(UnaryOperator<CallOptions> options) Specify the default call options for evaluating transactions.default Gateway.Builder
evaluateOptions
(CallOption... options) Deprecated.Replaced byevaluateOptions(UnaryOperator)
.Specify the default call options for filtered block events.Specify the hashing implementation used to generate digests of messages sent to the Fabric network.Specifies the client identity used to connect to the network.Specify the signing implementation used to sign messages sent to the Fabric network.submitOptions
(UnaryOperator<CallOptions> options) Specify the default call options for submit of transactions to the orderer.default Gateway.Builder
submitOptions
(CallOption... options) Deprecated.Replaced bysubmitOptions(UnaryOperator)
.tlsClientCertificateHash
(byte[] certificateHash) Specify the SHA-256 hash of the TLS client certificate.
-
Method Details
-
connection
Specifies an existing gRPC connection to be used by the Gateway. The connection will not be closed when the Gateway instance is closed. This allows multiple Gateway instances to share a gRPC connection.- Parameters:
grpcChannel
- A gRPC connection.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
identity
Specifies the client identity used to connect to the network. All interactions will the Fabric network using this Gateway will be performed by this identity.- Parameters:
identity
- An identity.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
signer
Specify the signing implementation used to sign messages sent to the Fabric network.- Parameters:
signer
- A signing implementation.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
hash
Specify the hashing implementation used to generate digests of messages sent to the Fabric network. If this option is not specified, SHA-256 is used by default.Standard hash implementations are provided in
Hash
.- Parameters:
hash
- A hashing function.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
tlsClientCertificateHash
Specify the SHA-256 hash of the TLS client certificate. This option is required only if mutual TLS authentication is used for the gRPC connection to the Gateway peer.- Parameters:
certificateHash
- A SHA-256 hash.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
evaluateOptions
Deprecated.Replaced byevaluateOptions(UnaryOperator)
.Specify the default call options for evaluating transactions.A call of:
evaluateOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
is equivalent to:
evaluateOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
- Parameters:
options
- Call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
evaluateOptions
Specify the default call options for evaluating transactions.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
endorseOptions
Deprecated.Replaced byendorseOptions(UnaryOperator)
.Specify the default call options for endorsements.A call of:
endorseOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
is equivalent to:
endorseOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
- Parameters:
options
- Call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
endorseOptions
Specify the default call options for endorsements.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
submitOptions
Deprecated.Replaced bysubmitOptions(UnaryOperator)
.Specify the default call options for submit of transactions to the orderer.A call of:
submitOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
is equivalent to:
submitOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
- Parameters:
options
- Call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
submitOptions
Specify the default call options for submit of transactions to the orderer.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
commitStatusOptions
Deprecated.Replaced bycommitStatusOptions(UnaryOperator)
.Specify the default call options for retrieving transaction commit status.A call of:
commitStatusOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
is equivalent to:
commitStatusOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
- Parameters:
options
- Call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
commitStatusOptions
Specify the default call options for retrieving transaction commit status.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
chaincodeEventsOptions
Deprecated.Replaced bychaincodeEventsOptions(UnaryOperator)
.Specify the default call options for chaincode events.A call of:
chaincodeEventsOptions(CallOption.deadlineAfter(5, TimeUnit.SECONDS))
is equivalent to:
chaincodeEventsOptions(options -> options.withDeadlineAfter(5, TimeUnit.SECONDS))
- Parameters:
options
- Call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
chaincodeEventsOptions
Specify the default call options for chaincode events.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
blockEventsOptions
Specify the default call options for block events.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
filteredBlockEventsOptions
Specify the default call options for filtered block events.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
blockAndPrivateDataEventsOptions
Specify the default call options for block and private data events.- Parameters:
options
- Function that transforms call options.- Returns:
- The builder instance, allowing multiple configuration options to be chained.
-
connect
Gateway connect()Connects to the gateway using the specified options.- Returns:
- The connected
Gateway
object.
-
chaincodeEventsOptions(UnaryOperator)
.