Interface Network

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener​(long startBlock, java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
      Add a listener to replay block events from the network.
      java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener​(java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
      Add a listener to receive block events from the network.
      java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener​(Checkpointer checkpointer, java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
      Add a listener to receive block events from the network with checkpointing.
      CommitListener addCommitListener​(CommitListener listener, java.util.Collection<org.hyperledger.fabric.sdk.Peer> peers, java.lang.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​(java.lang.String chaincodeId)
      Get an instance of a contract on the current network.
      Contract getContract​(java.lang.String chaincodeId, java.lang.String name)
      Get an instance of a contract on the current network.
      Gateway getGateway()
      Get a reference to the owning Gateway connection.
      void removeBlockListener​(java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
      Removes a previously added block listener.
      void removeCommitListener​(CommitListener listener)
      Removes a previously added transaction commit listener.
    • Method Detail

      • getContract

        Contract getContract​(java.lang.String chaincodeId)
        Get an instance of a contract on the current network.
        Parameters:
        chaincodeId - The name of the chaincode that implements the smart contract.
        Returns:
        The contract object.
      • getContract

        Contract getContract​(java.lang.String chaincodeId,
                             java.lang.String name)
        Get an instance of a contract on the current network. If the chaincode instance contains more than one smart contract class (available using the latest chaincode programming model), then an individual class can be selected.
        Parameters:
        chaincodeId - The name of the chaincode that implements the smart contract.
        name - The class name of the smart contract within the chaincode.
        Returns:
        The contract object.
      • getGateway

        Gateway getGateway()
        Get a reference to the owning Gateway connection.
        Returns:
        The owning gateway.
      • getChannel

        org.hyperledger.fabric.sdk.Channel getChannel()
        Get the low-level chanel object associated with this network.
        Returns:
        A channel.
      • addBlockListener

        java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener​(java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
        Add a listener to receive block events from the network. Events are received in order and without duplication.
        Parameters:
        listener - A block listener.
        Returns:
        The block listener argument.
      • addBlockListener

        java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener​(Checkpointer checkpointer,
                                                                                            java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
                                                                                     throws java.io.IOException
        Add a listener to receive block events from the network with checkpointing. Re-adding a listener with the same checkpointer on subsequent application invocations will resume listening from the previous block position. Events are received in order and without duplication.
        Parameters:
        checkpointer - Checkpointer to persist block position.
        listener - A block listener.
        Returns:
        The block listener argument.
        Throws:
        java.io.IOException - if an error occurs establishing checkpointing.
        GatewayRuntimeException - if an underlying infrastructure failure occurs.
      • addBlockListener

        java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> addBlockListener​(long startBlock,
                                                                                            java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
        Add a listener to replay block events from the network. Events are received in order and without duplication.
        Parameters:
        startBlock - The number of the block from which events should be replayed.
        listener - A block listener.
        Returns:
        The block listener argument.
        Throws:
        GatewayRuntimeException - if an underlying infrastructure failure occurs.
      • removeBlockListener

        void removeBlockListener​(java.util.function.Consumer<org.hyperledger.fabric.sdk.BlockEvent> listener)
        Removes a previously added block listener.
        Parameters:
        listener - A block listener.
      • addCommitListener

        CommitListener addCommitListener​(CommitListener listener,
                                         java.util.Collection<org.hyperledger.fabric.sdk.Peer> peers,
                                         java.lang.String transactionId)
        Add a listener to receive transaction commit and peer disconnect events for a set of peers.
        Parameters:
        listener - A transaction commit listener.
        peers - The peers from which to receive events.
        transactionId - A transaction ID.
        Returns:
        The transaction commit listener argument.
      • removeCommitListener

        void removeCommitListener​(CommitListener listener)
        Removes a previously added transaction commit listener.
        Parameters:
        listener - A block listener.