April 18, 2012

How to schedule a CSV/XML file export through MIF

This entry is part of the Maximo Integration Framework series.

In standard Maximo/TPAE there is no way to schedule the invocation of an outbound interface in order to periodically export a CSV or XML file at a specific interval. This can be accomplished with a little custom Java class. I have used the Java code described in this post as a starting point to develop my own generic procedure. In this example I will show how periodically export in a CSV file all the assets that contains the word 'pump' in the description. The procedure can be adapted to periodically invoke any Publish Channel you like.

Java CronTask setup
First of all you need to compile the Java class that implements the custom crontask. If you are not a Java guru, don't worry. Here is the class file already compiled for you. To deploy it on your Maximo server you must copy the RunPublishChannelCrontask.class to SMP\maximo\applications\maximo\businessobjects\classes\custom\integration\cron directory, rebuild and redeploy the Maximo EAR file. Restart the application server and login as maxadmin on Maximo UI.

MIF Configuration
Create an Integration Object Structure MYASSET and add the ASSET object as source.

Remember to select 'Support Flat Structure' if you need CSV export.

Now create the Publish Channel MYASSETS.

Create an External System (or reuse your own) and add the MYASSETS Publish Channel to it.

Enable publish channel and test that everything is ok using the 'Data Export' button. A CSV file should appear in few minutes in your MIF output folder (see mxe.int.globaldir system property). If you have problems check the JMS queues, JMSQSEQCONSUMER crontask and anything that may block the publish channel functionality.

Cron Task Configuration
If everything is ok it's now time to schedule the invocation of the Publish Channel. Go to System Configuration - Platform Configuration - Cron Task Setup and create the crontask instance setting custom.integration.cron.RunPublishChannelCrontask in the Class field.


Activate and reload the crontask instance with the Action - Reload Request command.
You should now see a new CSV file published every 2 minutes in the MIF output folder.

8 comments:

  1. Nice and needed process. I successfully tested it in a development instance. However when attempted to use it in a production system with LDAP user authentication it will not run successfully. The definition user is maxadmin just like all the other chron tasks. Thoughts? Will gladly pay for resolution.
    Greg (gregor@gregtech.com)

    ReplyDelete
    Replies
    1. Unfortunately I don't have a Maximo server with LDAP to test the procedure and reproduce the problem.
      Can you send me the error you get in the log files?

      Delete
  2. Hello Bruno,

    Thanks for your explanation. Unfortunately, I cannot get my cron task working.

    I tested my object structure, external system and publish channel using the export data button. A export file is created with the correct data. However, after creating my cron task I do not get a data export.
    - I have copied the java class in the right location (SMP\maximo\applications\maximo\businessobjects\classes\custom\integration\cron);
    - I also rebuild and deployed my earfile and maximo recognizes the java class in my cron;
    - I setup my cron just like yours (refering to the correct external system and publish channel);
    - I also reloaded the request command.

    Since I have the feeling that I have done everything correctly, I have no idea why it does not function. The admin mode is also turned off, so that cannot be the problem.

    ReplyDelete
  3. I don't know how to help you.
    I would personally try to put some logging (or System.out calls) and look in the logs if those log rows appears or not.

    you may also try to debug the Java code as described here: http://maximodev.blogspot.com/2012/09/how-to-debug-java-mbo-maximo-tpae.html

    ReplyDelete
  4. Hi Bruno,

    Excellent tutorial.

    Quick question is there is a way to do a reverse i.e. Scheduling the import of the data to Maximo?
    Cheers,
    Vitalius

    ReplyDelete
    Replies
    1. I would think you may have to refer below class to archive your requirement (Scheduling the import of the data to Maximo).

      http://api.gjcq176.com/Javadocs75/Javadocs7500/psdi/iface/load/LoadXMLFileCronTask.html

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Just wanted share my experience in this example.
    I have got following error (BMXAA1360E - Error processing outbound transaction. Cannot write transaction to queue) then I realized some configuration is missing at queue so I went and added queue points(outbound, inbound) in external system then the error disappeared and I can see the files in MIF directory. I would like to high lite that we should make sure to configure queue points(outbound, inbound) in external system, since queue points are optional.

    ReplyDelete