backend/user-management/bin/services/emi-gateway/GraphQlService.js
/**
   * build a Broker listener to handle GraphQL requests procesor
   * @param {*} descriptor
   */
build a Broker listener to handle GraphQL requests procesor
@param {*} descriptor
build a Broker listener to handle GraphQL requests procesor @param { * } descriptor
subscribeEventHandler({
    aggregateType,
    messageType,
    onErrorHandler,
    onCompleteHandler
  }) {
    const handler = this.functionMap[messageType];
    const subscription = broker
      .getMessageListener$([aggregateType], [messageType])
      .mergeMap(message => this.verifyRequest$(message))
      .mergeMap(request => (request.failedValidations.length > 0)
        ? Rx.Observable.of(request.errorResponse)
        : Rx.Observable.of(request)
          .mergeMap(({ authToken, message }) =>
            handler.fn
              .call(handler.obj, message.data, authToken)
              .map(response => ({ response, correlationId: message.id, replyTo: message.attributes.replyTo }))
          )
      )
      .mergeMap(msg => this.sendResponseBack$(msg))
      .subscribe(
        msg => {
        },
        onErrorHandler,
        onCompleteHandler
      );
    this.subscriptions.push({
      aggregateType,
      messageType,
      handlerName: handler.fn.name,
      subscription
    });
    return {
      aggregateType,
      messageType,
      handlerName: `${handler.obj.name}.${handler.fn.name}`
    };
  }
subscribeEventHandler ( { aggregateType , messageType , onErrorHandler , onCompleteHandler } ) { const handler = this . functionMap [ messageType ] ; const subscription = broker . getMessageListener$ ( [ aggregateType ] , [ messageType ] ) . mergeMap ( message => this . verifyRequest$ ( message ) ) . mergeMap ( request => ( request . failedValidations . length > 0 ) ? Rx . Observable . of ( request . errorResponse ) : Rx . Observable . of ( request ) . mergeMap ( ( { authToken , message } ) => handler . fn . call ( handler . obj , message . data , authToken ) . map ( response => ( { response , correlationId : message . id , replyTo : message . attributes . replyTo } ) ) ) ) . mergeMap ( msg => this . sendResponseBack$ ( msg ) ) . subscribe ( msg => { } , onErrorHandler , onCompleteHandler ) ; this . subscriptions . push ( { aggregateType , messageType , handlerName : handler . fn . name , subscription } ) ; return { aggregateType , messageType , handlerName : ` ${ handler . obj . name } ${ handler . fn . name } ` } ; }
build a Broker listener to handle GraphQL requests procesor
 @param {*} descriptor
build a Broker listener to handle GraphQL requests procesor @param { * } descriptor
//ROUTE MESSAGE TO RESOLVER // console.log(`GraphQlService: ${messageType} process: ${msg}`);