I'm working on a bug fix for HandleHttpRequest and need to check if a processor
is configured to run only on primary node (and not if a processor has the
attribute that ONLY allows it to run on primary node).
Here is the scenario for background:
* NiFi cluster, but all nodes are on the same physical machine; we do this
to let developers develop/test in a cluster without needing a lot of
infrastructure before deploying to the real prod cluster.
* To avoid Port conflicts, HandleHttpRequest is setup to run only on
master. But, if there is a master node change then the Http server is not
properly shutdown and we get a port conflict when the new master node starts up
the new instance of the processor.
The problem is I don't think the Primary Only scheduling configuration is
exposed to the processor. I'd like to do something like the code below:
@OnPrimaryNodeStateChange
public void onPrimaryNodeChange(final PrimaryNodeState newState) {
// If this processor is running in Primary Only
// and this is processor is not master, shutdown the http server.
If(this.isMasterOnlyScheduled) shutdown();
}
I can do some work to expose this, but I thought I'd ask in case I'm missing it.
Thanks,
Peter