lib/service-manager.js
function registerService (client, service) {
  clearTtlTimeout(service)

  if (client.connected) {
    var request = new Request(DXL_SERVICE_REGISTER_REQUEST_TOPIC)
    request.payload = JSON.stringify({
      serviceType: service.info.serviceType,
      metaData: service.info.metadata,
      requestChannels: service.info.topics,
      ttlMins: service.info.ttl,
      serviceGuid: service.info.serviceId
    })
    request.destinationTenantGuids = service.info.destinationTenantGuids

    client.asyncRequest(request,
      function (error) {
        if (service.onFirstRegistrationCallback) {
          service.onFirstRegistrationCallback(error)
          service.onFirstRegistrationCallback = null
        }
      })

    service.ttlTimeout = setTimeout(registerService,
      service.info.ttl * 60 * 1000, client, service)
  }
}
function registerService (client, service) {
  clearTtlTimeout(service)

  if (client.connected) {
    var request = new Request(DXL_SERVICE_REGISTER_REQUEST_TOPIC)
    request.payload = JSON.stringify({
      serviceType: service.info.serviceType,
      metaData: service.info.metadata,
      requestChannels: service.info.topics,
      ttlMins: service.info.ttl,
      serviceGuid: service.info.serviceId
    })
    request.destinationTenantGuids = service.info.destinationTenantGuids

    client.asyncRequest(request,
      function (error) {
        if (service.onFirstRegistrationCallback) {
          service.onFirstRegistrationCallback(error)
          service.onFirstRegistrationCallback = null
        }
      })

    service.ttlTimeout = setTimeout(registerService,
      service.info.ttl * 60 * 1000, client, service)
  }
}
function registerService ( client , service ) { clearTtlTimeout ( service ) if ( client . connected ) { var request = new Request ( DXL_SERVICE_REGISTER_REQUEST_TOPIC ) request . payload = JSON . stringify ( { serviceType : service . info . serviceType , metaData : service . info . metadata , requestChannels : service . info . topics , ttlMins : service . info . ttl , serviceGuid : service . info . serviceId } ) request . destinationTenantGuids = service . info . destinationTenantGuids client . asyncRequest ( request , function ( error ) { if ( service . onFirstRegistrationCallback ) { service . onFirstRegistrationCallback ( error ) service . onFirstRegistrationCallback = null } } ) service . ttlTimeout = setTimeout ( registerService , service . info . ttl * 60 * 1000 , client , service ) } }
Registers the service with the DXL fabric.
@private
@param {Client} client - Client to be used for registering the service.
@param {Object} service - Metadata for the service.
@param {ServiceRegistrationInfo} service.info - Info supplied for the
service registration via a call to the
{@link ServiceManager#registerServiceAsync} function.
@param {Function} [service.onFirstRegistrationCallback=null] - An optional
callback that will be invoked when the initial registration attempt is
complete. If an error occurs during the registration attempt, the first
parameter supplied to the callback contains an {@link Error} with failure
details.
@param {Object} service.ttlTimeout - Id for a callback to be invoked to
re-register the service when its {@link ServiceRegistrationInfo#ttl}
expires.
Registers the service with the DXL fabric .