CRecordFileRegistryGetFilePaths
Retrieve all relative paths of files registered in the FileRegistry that correspond to the given subdirectory. The number of returned files is limited to 1000.
This message is part of the FileRegistry API.
{ "id": "fcbfda81-b40d-4bae-ad11-5a5d0a2da8f7", "name": "FILE_REGISTRY_GET_FILE_PATHS", "description": "Get information about all (max 1000) file paths registered in the registry for a given directory.", "slots": [ { "key": "dir", "name": "DIRECTORY", "direction": "REQUEST", "mandatory": "false", "type": "STRING", "description": "The relative directory to search for." } { "key": "rec", "name": "PATHS", "direction": "ANSWER", "mandatory": "false", "type": "STRING_ARRAY", "description": "All file paths registered in the file registry." } ] }
Usage
Request
final IId microServiceId = CIdFactory.fromObject("file.registry"); final CEnvelope env = CEnvelope.forMicroService(microServiceId); final CRecord record = CRecordFileRegistryGetFilePaths.create(); CRecordFileRegistryGetFilePaths.setDirectory(record, "lib/"); sendRequest(env, record);
Catch the response
// in Target constructor addMessageHandler(CRecordFileRegistryGetFilePaths.ID, this::asyncGetFilePaths); // message handler private boolean asyncGetFilePaths(@NotNull final CEnvelope aEnvelope, @NotNull final CRecord aRecord) { if (aEnvelope.isAnswer()) { if (aEnvelope.getResult() .hasSuccess()) { final String[] arr = CRecordFileRegistryGetFilePaths.getPaths(aRecord, null); ... } return true; } else { return false; } }