/**
 * 通用的指标抽象
 *
 */ import { IIndicator , IBuilder , IndicatorType } from '../domain' ; import { MetricsConstants } from '../MetricsConstants' ; export abstract class AbstractIndicator implements IIndicator { appName : string ; group : string ; clientId : string ; type { string } type : IndicatorType = 'singleton' ; transferType = 'normal' ; abstract async invoke ( data ? , builder ? ) ; returns { string } protected getClientDownlinkKey ( appName ? , clientId ? ) { return [ MetricsConstants . MESSENGER_DOWNLINK_KEY , appName || this . appName , this . group , clientId || this . clientId ] . join ( MetricsConstants . MESSENGER_SPLIT ) ; } returns { string } protected getClientUplinkKey ( appName ? , clientId ? ) { return [ MetricsConstants . MESSENGER_UPLINK_KEY , appName || this . appName , this . group , clientId || this . clientId ] . join ( MetricsConstants . MESSENGER_SPLIT ) ; } returns { boolean } protected isSingleton ( ) { return this . type === 'singleton' ; } destory ( ) { } }