ServiceExecutor implementation in plugin

Which IIQ version are you inquiring about?

8.4

Hi all,
I’m developing an IIQ plugin for my organization to use. Besides of REST endpoints it exposes, I also need some code to “run always” in the background (it checks some server for updates every few seconds). I do prefer if it will always run and not get triggered every period of time.
As far as I understood from the docs, the most appropriate way of doing so is by implementing a ServiceExecutor. I tried to do exactly that - based on the SIEM community plugin - I implement a class that extends BasePluginService, and it’s configure() and execute() methods. I then register the class as serviceExecutors entry in the manifest.xml file, but when I install the plugin the service doesn’t seem to run.
Few questions I have:

  1. Is there any step I’m missing in order for the service to actually register to IIQ? I couldn’t find a full documentation of the process
  2. Is the ServiceExecutor the right solution for my needs?
  3. When does the execute() method runs exactly? And, does it happen by default when I install the plugin or do I need to enable it in some way?

Thanks a lot in advance!

1 Like

Would really appreciate any help, I can’t find anything in the docs.
Thanks!

I’ve never implemented a service, but I am assuming you need to define a ServiceDefinition object which references your executor class. There are a bunch of out of the box ones you can reference in debug.

The Service class is a totally valid approach. Here is a sample of a JavaCode

public class SampleService extends BasePluginService {

    private static final Log log = LogFactory.getLog(SampleService.class);
    private long maxAge = 1440;
    private int cacheMaxAge = 0;

    @Override
    public String getPluginName() {
        return "MyPluginName";
    }

    @Override
    public void execute(SailPointContext context) throws GeneralException {
        log.trace("Started:SampleService:execute IN: ");
	// business Logic	
    }

    @Override
    public void configure(SailPointContext context) throws GeneralException {
    	log.trace("Started:SampleService:configure IN: ");
        int cfgMaxAge = getSettingInt("cfgMaxAge");
    	maxAge = cfgMaxAge != 0 ? cfgMaxAge : 1440;
    	cacheMaxAge = getSettingInt("cacheMaxAge");
        log.trace("Finished:SampleService:configure OUT: ");
    }

}

Please remember to add the ServiceDefinition.xml like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sailpoint PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<sailpoint>
  <ServiceDefinition executor="net.wedacon.sampleplugin.SampleService" hosts="global" interval="3600" name="SampleService">
    <Attributes>
      <Map>
        <entry key="pluginName" value="pluginName"/>
      </Map>
    </Attributes>
  </ServiceDefinition>
</sailpoint>

Also important: Add the executor to the plugin manifest

      <entry key="serviceExecutors">
        <value>
          <List>
            <String>net.wedacon.sampleplugin.SampleService</String>
          </List>
        </value>
      </entry>
1 Like