To enable all extensions for your platform, you may use -DENABLE_ALL=TRUE OR select the option to "Enable all Extensions" in the bootstrap script. ReadMe
Extensions are dynamic libraries loaded at runtime by the agent. An extension makes its capabilities (classes) available to the system through registrars. Registration must happen in source files, not headers.
// register user-facing classes as
REGISTER_RESOURCE(InvokeHTTP, Processor);
// or
REGISTER_RESOURCE(SSLContextService, ControllerService);
// register internal resources as
REGISTER_RESOURCE(HTTPClient, InternalResource);
// or
REGISTER_RESOURCE(RESTSender, DescriptionOnly);
Some extensions (e.g. OpenCVExtension
) require initialization before use.
You need to create init
and deinit
functions and register them using REGISTER_EXTENSION
.
static bool init(const std::shared_ptr<org::apache::nifi::minifi::Configure>& /*config*/) {
return org::apache::nifi::minifi::utils::Environment::setEnvironmentVariable("OPENCV_FFMPEG_CAPTURE_OPTIONS", "rtsp_transport;udp", false /*overwrite*/);
}
static void deinit() {}
REGISTER_EXTENSION("OpenCVExtension", init, deinit);
If you don't use REGISTER_EXTENSION
, the registered resources still become available, so make sure to register the extension if you need special initialization.
The agent will look for the nifi.extension.path
property in the minifi.properties
file to determine what extensions to load.
The property expects a comma separated list of paths.
The paths support wildcards, specifically, a standalone **
matches any number of nested directories, the *
matches any number of characters in a single segment and ?
matches one single character in a segment.
Relative paths are relative to the agent executable.
// This matches all files in the 'extensions' directory next to the directory the executable is in.
nifi.extension.path=../extensions/*
If you want to exclude some extensions from being loaded, without having to specify the rest, you can do so by prefixing the pattern with !
.
// This loads all extensions but the azure extension. (the exact name differs by platform: dylib, dll, so)
nifi.extension.path=../extensions/*,!../extensions/libminifi-azure.so
You could even exclude some subdirectory and then re-include specific extensions/subdirectories in that.
// The last pattern that matches an extension will determine if that extension is loaded or not.
nifi.extension.path=../extensions/**,!../extensions/private/*,../extension/private/my-cool-extension.dll