sillysky software labs

CRecordRemoveAppFactory

The message CRecordRemoveAppFactory is used to deregister an application factory.

This message belongs to the application factory collector API.
The Application Collector Service is located in the plugin NY_ApplicationFactoryCollectorPlugIn.

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

Arguments

  • APPLICATION_ID: The ID of the application.
  • FACTORY_ADDRESS: The target address of the factory.

Usage

Sending the message

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

private void removeApplicationFactory() throws CException
{
    // The message is sent to the AppCollector microservice.
    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);
}

Dealing with the response

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;
    }
}

See also: