CRecordGetMicroServiceIds

Retrieve all IDs of the registered microservices.

This message belongs to the microservice registry API.

{
  "id": "8035c42e-2996-4b43-8b90-136298ede09d",
  "name": "GET_MICRO_SERVICE_IDS",
  "isService": "false",
  "description": "Get the IDs of the registered microservices.",
  "slots": [
    {
      "key": "90005",
      "name": "MICRO_SERVICE_IDS",
      "direction": "REQUEST",
      "mandatory": "false",
      "type": "ID_ARRAY",
      "description": "The IDs of the registered microservices."
    }
  ]
}

Example of use (after generating of the class CRecordGetMicroServiceIds):

// request
private void sendGetMicroServiceIds(@NotNull final CTargetAddress aAddressOfMicroserviceRegistry) throws CException
{
    final CEnvelope env = CEnvelope.forSingleTarget(aAddressOfMicroserviceRegistry);
    final CRecord rec = CRecordGetMicroServiceIds.create();
    sendRequest(env,
                rec);
}

// constructor:
addMessageHandler(CRecordGetMicroServiceIds.ID,
                  this::asyncGetMicroServiceIds);

// reply
private boolean asyncGetMicroServiceIds(@NotNull final CEnvelope aEnvelope,
                                        @NotNull final CRecord aRecord)
{
    if (aEnvelope.isAnswer())
    {
        if (aEnvelope.getResultCode() == CResultCode.SUCCESS)
        {
            final IId[] microServiceIds = CRecordGetMicroServiceIds.getMicroServiceIds(aRecord,
                                                                                       null);
            //...
        }
        return true;
    }
    return false;
}

nyssr.net - Innovative Distributed System