CRecordForwardToMicroServiceInstance
Send a message to the microservice registry, which forwards it to a desired microservice.
This message belongs to the microservice registry API.
{ "id": "4dad52bd-3071-46d9-a79b-c5188e311131", "name": "FORWARD_TO_MICRO_SERVICE_INSTANCE", "isService": "false", "description": "Forward a message to an instance of a given microservice ID.\nIf more than one instance is registered, forward the message to a random instance.", "slots": [ { "key": "1", "name": "MESSAGE", "direction": "REQUEST", "mandatory": "true", "type": "MESSAGE", "description": "The message to forward." }, { "key": "2", "name": "MICRO_SERVICE_ID", "direction": "REQUEST", "mandatory": "true", "type": "ID", "description": "The microservice to search for." } ] }
Example of use (after generating of the class CRecordForwardToMicroServiceInstance):
private void sendViaMicroserviceRegistry(@NotNull final CTargetAddress aAddressOfMicroserviceRegistry, @NotNull final IId aMicroserviceId, @NotNull final CMessage aMessage) throws CException { final CEnvelope env = CEnvelope.forSingleTarget(aAddressOfMicroserviceRegistry); final CRecord rec = CRecordForwardToMicroServiceInstance.create(); CRecordForwardToMicroServiceInstance.setMicroServiceId(rec, aMicroserviceId); CRecordForwardToMicroServiceInstance.setMessage(rec, aMessage); sendRequest(env, rec); }