Invoking an OutBound interface at a specific interval

Hi,

Sometimes there is a situation when we want to trigger an outbound interface at certain specific time. Like based on a cron task in Maximo.

There is a very useful in MicService for this.

MicService is the service class for Outbound Integration services.

exportData

public void exportData(java.lang.String ifaceName,
                       java.lang.String sender,
                       java.lang.String where,
                       UserInfo userInfo,
                       int maxcount)
                throws MXException,
                       java.rmi.RemoteException
This method will be called from GUI for bulk data loading from MAXIMO to external system 

Specified by:
exportData in interface MicServiceRemote
Parameters:
ifaceName – Give name of channel.
sender – Give external system name.
where – Give where clause.
userInfo – Give reference to UserInfo object.
Throws:
MXException – MAXIMO exception
java.rmi.RemoteException – Remote exception

This method you can invoke in a Cron Task Class so when the cron is executed the outbound interface is triggered. The outbound interface will process records it finds in the where clause.

I hope this helps.

Enjoy!!

Admin

Advertisements

One thought on “Invoking an OutBound interface at a specific interval

  1. Rohan

    below is the java code for the crontask to achieve this process.

    package custom.integration.cron;

    import java.rmi.RemoteException;
    import psdi.app.system.CrontaskInstanceRemote;
    import psdi.app.system.CrontaskParamInfo;
    import psdi.iface.mic.MicService;
    import psdi.security.UserInfo;
    import psdi.server.MXServer;
    import psdi.server.SimpleCronTask;
    import psdi.util.MXException;
    import psdi.util.logging.MXLogger;
    import psdi.util.logging.MXLoggerFactory;

    public class MIFExportCronTask extends SimpleCronTask
    {
    protected static final MXLogger log = MXLoggerFactory.getLogger(“maximo.custom.cronlogger”);

    MicService micSrv = null;
    private String publishChannel;
    private UserInfo userInfo;
    private String where;
    private String externalSys;
    private int maxcount;
    private String qualifiedInstanceName = null;

    public void setCrontaskInstance(CrontaskInstanceRemote inst)
    {
    try
    {
    super.setCrontaskInstance(inst);
    this.qualifiedInstanceName = (inst.getString(“crontaskname”) + “.” + inst.getString(“instancename”));
    }
    catch (Exception e)
    {
    log.error(e.getMessage(), e);
    }
    }

    public CrontaskParamInfo[] getParameters()
    throws MXException, RemoteException
    {
    CrontaskParamInfo[] params = new CrontaskParamInfo[4];
    params[0] = new CrontaskParamInfo();
    params[0].setName(“PUBLISHCHANNEL”);
    params[1] = new CrontaskParamInfo();
    params[1].setName(“EXTERNALSYSTEM”);
    params[2] = new CrontaskParamInfo();
    params[2].setName(“WHERECLAUSE”);
    params[3] = new CrontaskParamInfo();
    params[3].setName(“MAXCOUNT”);

    return params;
    }

    public void init()
    throws MXException
    {
    super.init();
    try
    {
    this.micSrv = ((MicService)MXServer.getMXServer().lookup(“MIC”));
    this.userInfo = this.micSrv.getNewUserInfo();
    log.info(“Initializing crontask:” + getName());
    }
    catch (Exception e)
    {
    log.error(“Error initializing crontask:” + getName(), e);
    }
    }

    public void cronAction()
    {
    try
    {
    this.publishChannel = getParamAsString(“PUBLISHCHANNEL”);
    this.externalSys = getParamAsString(“EXTERNALSYSTEM”);
    this.where = getParamAsString(“WHERECLAUSE”);
    this.maxcount = getParamAsInt(“MAXCOUNT”);

    log.debug(“Exporting publishChannel:” + this.publishChannel);
    log.debug(“External System:” + this.externalSys);
    log.debug(“twhere:” + this.where);
    log.debug(“tmaxcount:” + this.maxcount);

    this.micSrv.exportData(this.publishChannel, this.externalSys, this.where, this.userInfo, this.maxcount);
    }
    catch (Exception e)
    {
    log.error(“Error in crontask:” + getName(), e);
    }
    }
    }

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s