CRecordRegisterMicroService
This message is used to register microservices.
This message belongs to the microservice registry API.
{
"id": "be46c53e-e544-4e76-8c44-01f8c144254c",
"name": "REGISTER_MICRO_SERVICE",
"isService": "false",
"description": "Register a microservice.",
"slots": [
{
"key": "1",
"name": "MICRO_SERVICE",
"direction": "REQUEST",
"mandatory": "false",
"type": "RECORD",
"description": "The record of a single microservice to register."
},
{
"key": "2",
"name": "INSTANCE_ID",
"direction": "REQUEST",
"mandatory": "false",
"type": "ID",
"description": "Optional: The instance ID."
},
{
"key": "3",
"name": "ADDRESS",
"direction": "REQUEST",
"mandatory": "false",
"type": "TARGET_ADDRESS",
"description": "Optional: The address of the microservice instance."
}
]
}
Example of use (after generating of the class CRecordRegisterMicroService):
private void registerMicroservice(@NotNull final CTargetAddress aAddressOfMicroserviceRegistry, @NotNull final IId aMicroserviceId, @NotNull final String aDescription, @NotNull final CRecord[] aAPI) throws CException { // aAPI is an array of records of type CRecordDescriptionOfRecord. // This record type contains record IDs belonging to the API and a short description. final CEnvelope env = CEnvelope.forSingleTarget(aAddressOfMicroserviceRegistry); // data final CRecord recDescription = CRecordMicroService.create(); CRecordMicroService.setId(recDescription, aMicroserviceId); CRecordMicroService.setDescription(recDescription, aDescription); CRecordMicroService.setApi(recDescription, aAPI); // create random instance ID final IId instanceId = CIdFactory.randomOfType(EIdType.UUID); // register data final CRecord recRequest = CRecordRegisterMicroService.create(); CRecordRegisterMicroService.setAddress(recRequest, getAddress()); CRecordRegisterMicroService.setInstanceId(recRequest, instanceId); CRecordRegisterMicroService.setMicroService(recRequest, recDescription); sendRequest(env, recRequest); }