src/main/java/org/hyperledger/fabric/sdk/Channel.java
/**
     * Initialize the Channel.  Starts the channel. event hubs will connect.
     *
     * @return this channel.
     * @throws InvalidArgumentException
     * @throws TransactionException
     */
Initialize the Channel.  Starts the channel. event hubs will connect.
@return this channel.
Initialize the Channel . Starts the channel . event hubs will connect . @return this channel .
public Channel initialize() throws InvalidArgumentException, TransactionException {
        logger.debug(format("Channel %s initialize shutdown %b", name, shutdown));
        if (shutdown) {
            throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
        }
        if (isNullOrEmpty(name)) {
            throw new InvalidArgumentException("Can not initialize channel without a valid name.");
        }
        if (client == null) {
            throw new InvalidArgumentException("Can not initialize channel without a client object.");
        }
        userContextCheck(client.getUserContext());
        try {
            parseConfigBlock(); 
            loadCACertificates();  
            logger.debug(format("Eventque started %s", "" + eventQueueThread));
            for (EventHub eh : eventHubs) { 
                eh.connect(getTransactionContext());
            }
            for (Peer peer : getEventingPeers()) {
                peer.initiateEventing(getTransactionContext(), getPeersOptions(peer));
            }
            logger.debug(format("%d eventhubs initialized", getEventHubs().size()));
            registerTransactionListenerProcessor(); 
            logger.debug(format("Channel %s registerTransactionListenerProcessor completed", name));
            startEventQue(); 
            this.initialized = true;
            logger.debug(format("Channel %s initialized", name));
            return this;
        } catch (TransactionException e) {
            logger.error(e.getMessage(), e);
            throw e;
        } catch (Exception e) {
            TransactionException exp = new TransactionException(e);
            logger.error(exp.getMessage(), exp);
            throw exp;
        }
    }
public Channel initialize ( ) throws InvalidArgumentException , TransactionException { logger . debug ( format ( "Channel %s initialize shutdown %b" , name , shutdown ) ) ; if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } if ( isNullOrEmpty ( name ) ) { throw new InvalidArgumentException ( "Can not initialize channel without a valid name." ) ; } if ( client == null ) { throw new InvalidArgumentException ( "Can not initialize channel without a client object." ) ; } userContextCheck ( client . getUserContext ( ) ) ; try { parseConfigBlock ( ) ; loadCACertificates ( ) ; logger . debug ( format ( "Eventque started %s" , "" + eventQueueThread ) ) ; for ( EventHub eh : eventHubs ) { eh . connect ( getTransactionContext ( ) ) ; } for ( Peer peer : getEventingPeers ( ) ) { peer . initiateEventing ( getTransactionContext ( ) , getPeersOptions ( peer ) ) ; } logger . debug ( format ( "%d eventhubs initialized" , getEventHubs ( ) . size ( ) ) ) ; registerTransactionListenerProcessor ( ) ; logger . debug ( format ( "Channel %s registerTransactionListenerProcessor completed" , name ) ) ; startEventQue ( ) ; this . initialized = true ; logger . debug ( format ( "Channel %s initialized" , name ) ) ; return this ; } catch ( TransactionException e ) { logger . error ( e . getMessage ( ) , e ) ; throw e ; } catch ( Exception e ) { TransactionException exp = new TransactionException ( e ) ; logger . error ( exp . getMessage ( ) , exp ) ; throw exp ; } }
Initialize the Channel.
Initialize the Channel .
// Parse config block for this channel to get it's information. // put all MSP certs into cryptoSuite //Connect all event hubs //Manage transactions. //Run the event for event messages from event hubs.