CRecordRemoveAppFactory

Removes the registration of an application factory.

This message belongs to the application factory collector API.

{
  "id": "1246722a-b61c-46e4-a42e-08563bb30006",
  "name": "REMOVE_APP_FACTORY",
  "isService": "false",
  "namespaces": "",
  "description": "Remove an application factory.",
  "slots": [
    {
      "key": "appId",
      "name": "APPLICATION_ID",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "UUID",
      "description": "The ID of the application."
    },
    {
      "key": "factoryAddress",
      "name": "FACTORY_ADDRESS",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "TARGET_ADDRESS",
      "description": "The address of the application factory."
    }
  ]
}

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

private void removeApplicationFactory() throws CException
{
    final IId microserviceId = CIdFactory.fromObject("NY_ApplicationFactoryCollector");
    final CEnvelope env = CEnvelope.forMicroService(microserviceId);

    final CRecord record = CRecordRemoveAppFactory.create();
    CRecordRemoveAppFactory.setApplicationId(record,
                                             UUID.fromString("186687b0-e99b-4479-be94-d69051c9542f"));
    CRecordRemoveAppFactory.setFactoryAddress(record,
                                              getAddress());

    sendRequest(env,
                record);
}

The response can - as always - be caught in a separate message handler.

// in the constructor of your target:
addMessageHandler(CRecordRemoveAppFactory.ID,
                  this::asyncRemoveAppFactory);
// handle the answer
private boolean asyncRemoveAppFactory(@NotNull final CEnvelope aEnvelope,
                                      @NotNull final CRecord aRecord)
{
    if (aEnvelope.isAnswer())
    {
        if (aEnvelope.getResultCode() != CResultCode.SUCCESS)
        {
            // ...
        }
        return true;
    }
    else
    {
        return false;
    }
}

nyssr.net - Innovative Distributed System