lib/services.js
function Message(name, reqType, errType, resType, oneWay, doc) {
  this.name = name;
  if (!Type.isType(reqType, 'record')) {
    throw new Error('invalid request type');
  }
  this.requestType = reqType;
  if (
    !Type.isType(errType, 'union') ||
    !Type.isType(errType.getTypes()[0], 'string')
  ) {
    throw new Error('invalid error type');
  }
  this.errorType = errType;
  if (oneWay) {
    if (!Type.isType(resType, 'null') || errType.getTypes().length > 1) {
      throw new Error('inapplicable one-way parameter');
    }
  }
  this.responseType = resType;
  this.oneWay = !!oneWay;
  this.doc = doc !== undefined ? '' + doc : undefined;
  Object.freeze(this);
}
function Message(name, reqType, errType, resType, oneWay, doc) {
  this.name = name;
  if (!Type.isType(reqType, 'record')) {
    throw new Error('invalid request type');
  }
  this.requestType = reqType;
  if (
    !Type.isType(errType, 'union') ||
    !Type.isType(errType.getTypes()[0], 'string')
  ) {
    throw new Error('invalid error type');
  }
  this.errorType = errType;
  if (oneWay) {
    if (!Type.isType(resType, 'null') || errType.getTypes().length > 1) {
      throw new Error('inapplicable one-way parameter');
    }
  }
  this.responseType = resType;
  this.oneWay = !!oneWay;
  this.doc = doc !== undefined ? '' + doc : undefined;
  Object.freeze(this);
}
function Message ( name , reqType , errType , resType , oneWay , doc ) { this . name = name ; if ( ! Type . isType ( reqType , 'record' ) ) { throw new Error ( 'invalid request type' ) ; } this . requestType = reqType ; if ( ! Type . isType ( errType , 'union' ) || ! Type . isType ( errType . getTypes ( ) [ 0 ] , 'string' ) ) { throw new Error ( 'invalid error type' ) ; } this . errorType = errType ; if ( oneWay ) { if ( ! Type . isType ( resType , 'null' ) || errType . getTypes ( ) . length > 1 ) { throw new Error ( 'inapplicable one-way parameter' ) ; } } this . responseType = resType ; this . oneWay = ! ! oneWay ; this . doc = doc !== undefined ? '' + doc : undefined ; Object . freeze ( this ) ; }
An Avro message, containing its request, response, etc.
An Avro message containing its request response etc .