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",
"isNanoService": "false",
"description": "Get the IDs of the registered microservices.",
"slots": [
{
"key": "90005",
"name": "MICRO_SERVICE_IDS",
"direction": "REQUEST",
"presenceConstraint": "OPTIONAL",
"type": "ID_ARRAY",
"description": "The IDs of the registered microservices."
}
]
}
Slot Description
| Key | Name | Direction | Presence Constraint | Type | Description |
|---|---|---|---|---|---|
| 90005 | MICRO_SERVICE_IDS | REQUEST | false | ID_ARRAY | The IDs of the registered microservices. |
Usage
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;
}
Record Usage
In nyssr.net, we typically don't exchange interfaces between projects. Instead, we use platform-independent Records to describe message formats.
One or more descriptions of these Records are stored in the JSON or XML format
as record.json or record.xml within a directory.
The Record Generator, an included Swing tool, generates helper classes from these files.
These classes can then be used to type-safely write or read messages.