Options
All
  • Public
  • Public/Protected
  • All
Menu

RedisPRCNode 是一个节点,通过一个共享的 Redis,节点之间可以远程调用

Type parameters

  • T

  • U

Hierarchy

  • RedisPRCNode

Index

Constructors

constructor

  • new RedisPRCNode(id: string, handler: function, redisUrl?: undefined | string, __namedParameters?: object): RedisPRCNode
  • Parameters

    • id: string

      节点的唯一标识

    • handler: function

      处理远程调用的方法

        • (params: T): Promise<U>
        • Parameters

          • params: T

          Returns Promise<U>

    • Optional redisUrl: undefined | string

      redis URL

    • Default value __namedParameters: object = {}
      • poolId: string
      • pubClient: Redis

        用于发布消息的 redis client,这里提供参数运行复用现在的 redis 客户端来发布消息

    Returns RedisPRCNode

Properties

Private channelPrefix

channelPrefix: string

Private handler

handler: function

处理远程调用的方法

Type declaration

    • (params: T): Promise<U>
    • Parameters

      • params: T

      Returns Promise<U>

id

id: string

节点的唯一标识

Private pubClient

pubClient: Redis.Redis

Private subChannel

subChannel: string

Private subClient

subClient: Redis.Redis

Private subClientMessage$

subClientMessage$: Observable<[string, IPubSubMessage<T | U>]>

Methods

call

  • call(nodeId: string, params: T, timeout?: number): Promise<U>
  • Parameters

    • nodeId: string

      目标节点 id

    • params: T

      调用参数

    • Default value timeout: number = 15000

      超时毫秒数

    Returns Promise<U>

diconnect

  • diconnect(): void

Private handleRPCCall

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc