public static interface Gateway.Builder
Gateway.createBuilder()
. 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.限定符和类型 | 方法和说明 |
---|---|
Gateway.Builder |
commitHandler(CommitHandlerFactory commitHandler)
Optional - Allows an alternative commit handler to be specified.
|
Gateway.Builder |
commitTimeout(long timeout,
TimeUnit timeUnit)
Optional - Set the default maximum time to wait for commit events to be received from peers after
submitting a transaction to the orderer.
|
Gateway |
connect()
Connects to the gateway using the specified options.
|
Gateway.Builder |
discovery(boolean enabled)
Optional - Enable or disable service discovery for all transaction submissions for this gateway.
|
Gateway.Builder |
identity(Identity identity)
Specifies the identity that is to be used to connect to the network.
|
Gateway.Builder |
identity(Wallet wallet,
String id)
Specifies the identity that is to be used to connect to the network.
|
Gateway.Builder |
networkConfig(InputStream config)
Specifies the common connection profile.
|
Gateway.Builder |
networkConfig(Path config)
Specifies the path to the common connection profile.
|
Gateway.Builder |
queryHandler(QueryHandlerFactory queryHandler)
Optional - Allows an alternative query handler to be specified.
|
Gateway.Builder networkConfig(Path config) throws IOException
config
- The path to the common connection profile.IOException
- if the config file does not exist, or is not JSON or YAML format,
or contains invalid information.Gateway.Builder networkConfig(InputStream config) throws IOException
config
- The common connection profile YAML or JSON content.IOException
- if the common connection profile is not JSON or YAML format,
or contains invalid information.Gateway.Builder identity(Wallet wallet, String id) throws IOException
wallet
- The wallet object containing the identity.id
- The name of the identity stored in the wallet.IOException
- if the specified identity can not be loaded from the wallet.Gateway.Builder identity(Identity identity)
identity
- An identityGateway.Builder commitHandler(CommitHandlerFactory commitHandler)
Default commit handler implementations are defined in DefaultCommitHandlers
.
commitHandler
- A commit handler implementation.Gateway.Builder queryHandler(QueryHandlerFactory queryHandler)
Default query handler implementations are defined in DefaultQueryHandlers
.
queryHandler
- A query handler implementation.Gateway.Builder commitTimeout(long timeout, TimeUnit timeUnit)
timeout
- the maximum time to wait.timeUnit
- the time unit of the timeout argument.Gateway.Builder discovery(boolean enabled)
enabled
- - true to enable service discoveryCopyright © 2023. All rights reserved.