public interface Network
Gateway.getNetwork(String)
method.
The Network object provides the ability for applications to:
getContract(String)
, in order to
submit and evaluate transactions for that smart contract.addBlockListener(Consumer)
.addBlockListener(long, Consumer)
.限定符和类型 | 方法和说明 |
---|---|
Consumer<org.hyperledger.fabric.sdk.BlockEvent> |
addBlockListener(Checkpointer checkpointer,
Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
Add a listener to receive block events from the network with checkpointing.
|
Consumer<org.hyperledger.fabric.sdk.BlockEvent> |
addBlockListener(Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
Add a listener to receive block events from the network.
|
Consumer<org.hyperledger.fabric.sdk.BlockEvent> |
addBlockListener(long startBlock,
Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
Add a listener to replay block events from the network.
|
CommitListener |
addCommitListener(CommitListener listener,
Collection<org.hyperledger.fabric.sdk.Peer> peers,
String transactionId)
Add a listener to receive transaction commit and peer disconnect events for a set of peers.
|
org.hyperledger.fabric.sdk.Channel |
getChannel()
Get the low-level chanel object associated with this network.
|
Contract |
getContract(String chaincodeId)
Get an instance of a contract on the current network.
|
Contract |
getContract(String chaincodeId,
String name)
Get an instance of a contract on the current network.
|
Gateway |
getGateway()
Get a reference to the owning Gateway connection.
|
void |
removeBlockListener(Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
Removes a previously added block listener.
|
void |
removeCommitListener(CommitListener listener)
Removes a previously added transaction commit listener.
|
Contract getContract(String chaincodeId)
chaincodeId
- The name of the chaincode that implements the smart contract.Contract getContract(String chaincodeId, String name)
chaincodeId
- The name of the chaincode that implements the smart contract.name
- The class name of the smart contract within the chaincode.Gateway getGateway()
org.hyperledger.fabric.sdk.Channel getChannel()
Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener(Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
listener
- A block listener.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener(Checkpointer checkpointer, Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener) throws IOException
checkpointer
- Checkpointer to persist block position.listener
- A block listener.IOException
- if an error occurs establishing checkpointing.GatewayRuntimeException
- if an underlying infrastructure failure occurs.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener(long startBlock, Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
startBlock
- The number of the block from which events should be replayed.listener
- A block listener.GatewayRuntimeException
- if an underlying infrastructure failure occurs.void removeBlockListener(Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
listener
- A block listener.CommitListener addCommitListener(CommitListener listener, Collection<org.hyperledger.fabric.sdk.Peer> peers, String transactionId)
listener
- A transaction commit listener.peers
- The peers from which to receive events.transactionId
- A transaction ID.void removeCommitListener(CommitListener listener)
listener
- A block listener.Copyright © 2023. All rights reserved.