IBM TechXchange Benelux Integration User Group

 View Only

Technical: Create a resource monitor user exit for MQ FTE agent.

By kim meynendonckx posted 13 days ago

  

I encountered a use case where I needed to configure a resource monitor to monitor a certain directory for files to be moved. The file could only be moved when the size of the file is greater than 0 and that the file size hasn’t changed for x polls of the resource monitor.

I tried to set the trigger conditions like this in the resource monitor definition.

<triggerMatch>

                <conditions>

                                <allOf>

                                                <condition>

                                                                <fileSizeSame polls="5">

                                                                                <pattern>*.xml</pattern>

                                                                </fileSizeSame>

                                                </condition>

                                                <condition>

                                                                <fileSize>

                                                                                <compare operator=">=" units="B">0</compare>

                                                                                <pattern>*.xml</pattern>

                                                                </fileSize>

                                                </condition>

                                </allOf>

                </conditions>

</triggerMatch>

This didn’t worked. After receiving feedback from IBM support that only one condition was allowed they advised to create a resource monitor exit. I found this webpage(https://www.ibm.com/docs/en/ibm-mq/9.3?topic=reference-mft-resource-monitor-user-exits)

Explanation summarized: when the resource monitor is triggered, you can write a custom exit that verifies transfer metadata and you can decide if you want to cancel/proceed and/or change some transfer metadata for the resource trigger condition.

In my use case the user exit should just cancel the resource monitor trigger when the filesize=0.

Next I created a Java-class were I check the filesize and return a PROCEED_RESULT or CANCEL_TASK as MonitorExitResult.

A screenshot of a computer programDescription automatically generated

 

I compiled the java class into a jar file and put the jar file into the agents “exits” folder. This is the default location where the agent looks for custom exits.

Last I updated the agent.properties file to set the exit for the monitor.

monitorExitClasses=com.ibm.wmqfte.monitor.TestMonitorExit

After the restart the exit should be used. The println statements in the java code should be visible into agents output.log.

 

0 comments
2 views

Permalink