当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Client.connect方法代码示例

本文整理汇总了TypeScript中@restorecommerce/grpc-client.Client.connect方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Client.connect方法的具体用法?TypeScript Client.connect怎么用?TypeScript Client.connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@restorecommerce/grpc-client.Client的用法示例。


在下文中一共展示了Client.connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: beforeEach

 beforeEach(async function connect() {
   const cfg = await chassis.config.get();
   const logger = new Logger(cfg.get('logger'));
   client = new Client(cfg.get('client:reflection'), logger);
   const reflection: chassis.ServerReflection = await client.connect();
   serverReflectionInfo = await reflection.serverReflectionInfo();
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:7,代码来源:reflection_test.ts

示例2: before

  before(async function setup() {
    cfg = sconfig(process.cwd() + '/test');
    const logger = new chassis.Logger(cfg.get('logger'));

    events = new Events(cfg.get('events:kafka'), logger);
    await events.start();

    const topics = cfg.get('events:kafka:topics');
    testTopic = events.topic(cfg.get('events:kafka:topics:test.resource:topic'));
    commandTopic = events.topic(cfg.get('events:kafka:topics:command:topic'));
    // subscribe all response events
    for (let eventName of cfg.get('events:kafka:topics:command:events')) {
      await commandTopic.on(eventName, eventListener);
    }

    server = new Server(cfg.get('server'), logger);
    db = await database.get(cfg.get('database:arango'), logger);
    await db.truncate();

    const config = cfg.get();
    delete config.database.nedb;  // not supported in default implementation

    const cis = new CommandInterface(server, config, logger, events);
    await server.bind('commandinterface', cis);
    await server.start();

    const client = new Client(cfg.get('client:commandinterface'), logger);
    service = await client.connect();
  });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:29,代码来源:command_test.ts

示例3: checkEndpoint

 async function checkEndpoint() {
   const cfg = await chassis.config.get();
   const logger = new Logger(cfg.get('logger'));
   const client: Client = new Client(cfg.get('client:reflection'), logger);
   const reflectionClient: chassis.ServerReflection = await client.connect();
   const reflection = await reflectionClient.serverReflectionInfo();
   await reflection.end();
   await client.end();
 });
开发者ID:restorecommerce,项目名称:chassis-srv,代码行数:9,代码来源:reflection_test.ts


注:本文中的@restorecommerce/grpc-client.Client.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。