OnRouteReceive

The optional OnRouteReceive handler allows you to run some pre-processing filtering code before the actual “real” handler code triggers to prevent the data from getting to the handlers that would process the message. This type of handler is not often implemented. This can be thought of as a “filter” event that allows you to have seperate logic for filtering the message. You could place this same logic in your normal OnRequest handler as well. This just allows you to seperate out the logic in different layers. A good use of this handler could be some sort of custom authentication.

The OnRouteReceive method returns a boolean value to determine if this node could accept this message. The OnRouteReceive can inspect the message object passed as it’s only paramter to look at the data.

  • If the method returns true then the message is passed to the OnRequest handler for a Synchronous SO.
  • If the method return false then the Integration Gateway will return a message that resembles this:
HTTP/1.1 200
status: 200
date: Sun, 29 Oct 2017 16:34:49 GMT
content-length: 413
content-type: text/xml; charset=UTF-8
transactionid: 1506b539-bcc7-11e7-8c89-f1fdee7c0e02
<?xml version="1.0"?>
<IBResponse type="error">
  <DefaultTitle>Integration Broker Response</DefaultTitle>
  <StatusCode>20</StatusCode>
  <MessageSet>158</MessageSet>
  <MessageID>957</MessageID>
  <DefaultMessage>OnRouteReceive for message &#037;1 did not accept the request on node &#037;2.</DefaultMessage>
  <MessageParameters>
    <Parameter>CHG_SYNC_UTEST</Parameter>
    <Parameter>PSFT_HR</Parameter>
  </MessageParameters>
</IBResponse>

The basic implementation of the OnRouteReceive handler looks like this.

import PS_PT:Integration:IRouter;

class syncUTestRouter implements PS_PT:Integration:IRouter
   method OnRouteReceive(&message As Message) Returns boolean;
end-class;

method OnRouteReceive
   /+ &message as Message +/
   /+ Returns Boolean +/
   /+ Extends/implements PS_PT:Integration:IRouter.OnRouteReceive +/
   
   Return true;
end-method;

You would never actually implement a handler in production that look like that. You would actually have some code that is parsing the inbound &message parameters and performing some logic to determine if the local processing database should accept this message.

OnRouteReceive

Important: This does NOT seem to fire on local operation instances. It only triggers from external nodes.

OnRouteReceive will pass in a message to your derived application class method. The return should be a Boolean. FALSE = The Operation will not run locally TRUE = The Operation will run locally.

OnRouteReceive will pass in a message to your derived application class method. The return should be a Boolean. FALSE = The Operation will not run locally TRUE = The Operation will run locally.

interface IRouter
   method OnRouteSend(&message As Message) Returns integer;
   method OnRouteReceive(&message As Message) Returns boolean;
   method OnError(&request As Message);
   property array of any destinationNodes;
end-interface;


Author Info
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with two decades of experience working on PeopleSoft enterprise software projects. He is available for consulting engagements.

About Chris Work with Chris