Skip to main content

Engine Self Registration

Overview

The Engine Service sends messages to the Cx.Engine.EngineServiceStatus queue when it starts up and shuts down. These messages contain details about the scan service, such as its IP address, host name, and other relevant data. The System Manager on the manager side will automatically handle the registration and deregistration of the scans. This automation eliminates the need for manual registration, which was previously done through the portal or REST calls, easing the burden on system administrators.

Furthermore, this feature is used in conjunction with the Dynamic Engines functionality. It allows for the automatic registration of an engine docker, which runs exclusively for a specific scan and ceases to exist once the scan completes, cancels, or fails.

The System Manager will be listening to the Cx.Engine.EngineServiceStatus queue. Upon receiving a message Status : up, the engine will be registered. If an engine with the same name is already registered, the new data will replace the existing information while retaining the server ID.

Otherwise, when a message with Status : down is received (only for stage 2), the engine will be unregistered. To ensure efficiency, there are up to 10 retries in case of failure, with each retry waiting twice as long as the previous one. The first retry will occur after a 1-second delay. The message will only be acknowledged after the operation successfully completes.

Note

Every instance of System Manager has a listener in the queue, each message will be handled by one of the instances - the order is not important.

Queue Message Format

Queue Name: Cx.Engine.EngineServiceStatus

Service up content example:

Type: up (message property)

{
  "Name": "MyEngine1", // from CX_ENGINE_NAME
  "ServiceEndpointAddress": "10.32.1.17",
  "Config": {  // The content of CX_ENGINE_REGISTRATION_CONFIG. This is just an example
    "Dedications": [
      {"itemType": "scan", itemId: "9bdeba2d-9dea-4931-8074-f271e1595ae3"}
    ]
  }
}

Service down content example:

Type: down (message property) - (for stage 2 only)

{
  "Name": "MyEngine1"
}

Application REST API Changes (for stage 2 only)

When updating an engine using

[PUT] /cxrestapi/sast/engineServers/1

or

[POST] /cxrestapi/sast/engineServers

The application will send an update command to the engine itself to update the name.

The name in the database will be updated only after the update command on the server itself succeeds.