How to use the @hyperledger/caliper-core.MessageHandler function in @hyperledger/caliper-core

To help you get started, we’ve selected a few @hyperledger/caliper-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / caliper / packages / caliper-fabric / lib / fabricClientWorker.js View on Github external
* @param {object} message The message object.
 * @return {Promise} The initialized adapter instance.
 * @async
 */
async function initHandler(context, message) {
    const blockchain = new FabricClient(context.networkConfigPath, context.workspacePath);

    // reload the profiles silently
    await blockchain._initializeRegistrars(false);
    await blockchain._initializeAdmins(false);
    await blockchain._initializeUsers(false);

    return blockchain;
}

const handlerContext = new MessageHandler({
    init: initHandler
});

/**
 * Message handler
 */
process.on('message', async (message) => {
    await MessageHandler.handle(handlerContext, message);
});
github hyperledger / caliper / packages / caliper-burrow / lib / burrowClientWorker.js View on Github external
const { MessageHandler } = require('@hyperledger/caliper-core');
const BurrowClient = require('./burrow');

/**
 * Handles the init message. Constructs the Burrow adapter.
 * @param {object} context The context of the message handler object.
 * @param {object} message The message object.
 * @return {Promise} The initialized adapter instance.
 * @async
 */
async function initHandler(context, message) {
    return new BurrowClient(context.networkConfigPath, context.workspacePath);
}

const handlerContext = new MessageHandler({
    init: initHandler
});

/**
 * Message handler
 */
process.on('message', async (message) => {
    await MessageHandler.handle(handlerContext, message);
});
github hyperledger / caliper / packages / caliper-sawtooth / lib / sawtoothClientWorker.js View on Github external
const { MessageHandler } = require('@hyperledger/caliper-core');
const SawtoothClient = require('./sawtooth');

/**
 * Handles the init message. Constructs the Sawtooth adapter.
 * @param {object} context The context of the message handler object.
 * @param {object} message The message object.
 * @return {Promise} The initialized adapter instance.
 * @async
 */
async function initHandler(context, message) {
    return new SawtoothClient(context.networkConfigPath, context.workspacePath);
}

const handlerContext = new MessageHandler({
    init: initHandler
});

/**
 * Message handler
 */
process.on('message', async (message) => {
    await MessageHandler.handle(handlerContext, message);
});
github hyperledger / caliper / packages / caliper-iroha / lib / irohaClientWorker.js View on Github external
const { MessageHandler } = require('@hyperledger/caliper-core');
const IrohaClient = require('./iroha');

/**
 * Handles the init message. Constructs the Iroha adapter.
 * @param {object} context The context of the message handler object.
 * @param {object} message The message object.
 * @return {Promise} The initialized adapter instance.
 * @async
 */
async function initHandler(context, message) {
    return new IrohaClient(context.networkConfigPath, context.workspacePath);
}

const handlerContext = new MessageHandler({
    init: initHandler
});

/**
 * Message handler
 */
process.on('message', async (message) => {
    await MessageHandler.handle(handlerContext, message);
});
github hyperledger / caliper / packages / caliper-ethereum / lib / ethereumClientWorker.js View on Github external
const { MessageHandler } = require('@hyperledger/caliper-core');
const EthereumClient = require('./ethereum');

/**
 * Handles the init message. Constructs the Ethereum adapter.
 * @param {object} context The context of the message handler object.
 * @param {object} message The message object.
 * @return {Promise} The initialized adapter instance.
 * @async
 */
async function initHandler(context, message) {
    return new EthereumClient(context.networkConfigPath, context.workspacePath);
}

const handlerContext = new MessageHandler({
    init: initHandler
});

/**
 * Message handler
 */
process.on('message', async (message) => {
    await MessageHandler.handle(handlerContext, message);
});
github hyperledger / caliper / packages / caliper-composer / lib / composerClientWorker.js View on Github external
const { MessageHandler } = require('@hyperledger/caliper-core');
const ComposerClient = require('./composer');

/**
 * Handles the init message. Constructs the Composer adapter.
 * @param {object} context The context of the message handler object.
 * @param {object} message The message object.
 * @return {Promise} The initialized adapter instance.
 * @async
 */
async function initHandler(context, message) {
    return new ComposerClient(context.networkConfigPath, context.workspacePath);
}

const handlerContext = new MessageHandler({
    init: initHandler
});

/**
 * Message handler
 */
process.on('message', async (message) => {
    await MessageHandler.handle(handlerContext, message);
});
github hyperledger / caliper / packages / caliper-fisco-bcos / lib / fiscoBcosClientWorker.js View on Github external
const { MessageHandler } = require('@hyperledger/caliper-core');
const FiscoBcosClient = require('./fiscoBcos');

/**
 * Handles the init message. Constructs the FISCO-BCOS adapter.
 * @param {object} context The context of the message handler object.
 * @param {object} message The message object.
 * @return {Promise} The initialized adapter instance.
 * @async
 */
async function initHandler(context, message) {
    return new FiscoBcosClient(context.networkConfigPath, context.workspacePath);
}

const handlerContext = new MessageHandler({
    init: initHandler
});

/**
 * Message handler
 */
process.on('message', async (message) => {
    await MessageHandler.handle(handlerContext, message);
});