Invoking Asynchronous Oracle Mediator/ESB-Based Services

This section discusses how to:

  • Create acknowledgements for invoking asynchronous Oracle Mediator/ESB-based services.

  • Manage routing definitions for invoking asynchronous Oracle Mediator/ESB-based services.

  • Set message and error logging for invoking asynchronous Oracle Mediator/ESB-based services.

  • Invoke an asynchronous Oracle Mediator/ESB-based service.

Understanding Invoking Asynchronous Oracle Mediator/ESB-Based Services

An asynchronous service is also referred to as a fire-and-forget service.

Prerequisites for Invoking Asynchronous Oracle Mediator/ESB-Based Services

Before you can invoke an asynchronous Oracle Mediator/ESB-based service, you must first consume it. Consuming Oracle Mediator/ESB-based services is described elsewhere in this section.

See Consuming Oracle Mediator/ESB-Based Services.

Creating Acknowledgments for Invoking Asynchronous Oracle Mediator/ESB-Based Services

To handle acknowledgement data for an asynchronous service operation, create an OnReceive handler that uses the OnAckReceive method that is implemented as an application class. After doing so, you must register the application class with the PeopleSoft service operation.

The following code example shows sample code to create the handler:

import PS_PT:Integration:IReceiver;

class AsynchFF_AckReceive implements PS_PT:Integration:IReceiver
   method AsynchFF_AckReceive();
   method OnAckReceive(&MSG As Message) Returns integer;
end-class;

/* constructor */
method AsynchFF_AckReceive
end-method;

method OnAckReceive
   /+ &MSG as Message +/
   /+ Returns Integer +/
   /+ Extends/implements PS_PT:Integration:IReceiver.OnAckReceive +/
   /* Variable Declaration */

If &MSG.IsStructure Then

   /* if message is rowset-based */
   Local string &str = &MSG.GenXMLString();

Else
   /* if message is nonrowset-based */
   Local XmlDoc &xmldoc = &MSG.GetXmlDoc();
   Local string &str1 = &xmldoc.GenXmlString();
   Local File &MYFILE;

   &MYFILE = GetFile("C:\Temp\ESB\PS_Consume\ESBasynchffack.txt", "W",
"UTF8", %FilePath_Absolute);
   If &MYFILE.IsOpen Then
      &MYFILE.WriteString(&str1);
      &MYFILE.WriteLine("");
      &MYFILE.WriteString(String(%Operation_Done));
      &MYFILE.Close();
     End-If;
   End-If;

   Return (%Operation__Done);
end-method;

To create an acknowledgement for consumed asynchronous Oracle Mediator/ESB-based services:

  1. Create an OnReceive handler that uses the OnAckReceive method that is implemented as an application class.

    See Implementing Handlers Using Application Classes.

  2. Open the service operation definitions for the consumed service operation.

  3. Click the Handlers tab.

    The Service Operations-Handlers page appears.

  4. Add a handler with the following characteristics:

    Field or Control Description

    Name

    Enter any name. For example: AckReceive.

    Type

    From the drop-down list select OnReceive.

    Implementation

    From the drop-down list select Application Class.

    Status

    From the status drop-down list select Active.

  5. Click the Details link.

    The Handler Details page appears.

  6. At a minimum enter the following details about the application class:

    Field or Control Description

    Package Name

    Enter the package name that contains the class that you want to specify.

    Path

    Enter a colon ( : ).

    Class ID

    Enter the name of the application class that contains the method that you want to specify.

    Method

    From the drop-down list select OnAckReceive.

Managing Routing Definitions for Invoking Asynchronous Oracle Mediator/ESB-Based Services

The PeopleSoft Integration Broker Consume Services Wizard creates an outbound routing definition for the consumed service.

Before proceeding to invoke the service, ensure the following on the routing definition:

  • On the Routings-Routing Definitions page (PeopleTools, and then Integration Broker, and then Integration Setup, and then Routing Definitions.) in the OnReceive Handler field, enter or select OnAckReceive.

    This is the acknowledgement.

  • On the Routings-Connector Properties page (PeopleTools, and then Integration Broker, and then Integration Setup, and then Routing Definitions. Click the Connector Properties tab):

    • Ensure that the Connector ID field is set to HTTPTARGET.

    • Ensure that the value in the Primary URL field is set to the endpoint URL.

    • Set any other HTTP target connector properties as desired.

Setting Message and Error Logging for Invoking Asynchronous Oracle Mediator/ESB-Based Services

To capture the maximum amount of message and error logging and information when you invoke the service, in the integrationGateway.properties file, set the ig.log.level property equal to 5.

A setting of 5 is the default value.

Invoking an Asynchronous Oracle Mediator/ESB-Based Service

The following sample PeopleCode demonstrates one way to invoke the asynchronous Oracle Mediator/ESB-based service:

Local string &payload, &responseStr;
Local Message &msg, &reply;
Local XmlDoc &xml;

/* --- setting the input request message --- */

&payload = "<?xml version='1.0' encoding='UTF-8'?><SynchAdd_ESBProcessRequest
xmlns='http://xmlns.oracle.com/SynchAdd_ESB'><input1>6789</input1><input2>6789
</input2></SynchAdd_ESBProcessRequest>";
MessageBox(0, "Request Message", 0, 0, &payload);

&xml = CreateXmlDoc(&payload);

&msg = CreateMessage(Operation.ESBASYNCFFADD, %IntBroker_Request);

&msg.SetXmlDoc(&xml);

%IntBroker.Publish(&msg);
&responseStr = &msg.TransactionId;

MessageBox(0, "Message Transaction ID-Response from LaunchAsyncESBProcess", 0, 0,
  &responseStr);

MessageBox(0, "Acknowledgement from ESB", 0, 0, "For Ack Msg from ESB , 
  go look at the file C:\temp\ESB\PS_Consume\ESBasynchffack.txt");

When you execute the PeopleCode the PeopleSoft system the following information in consecutive message boxes:

  1. The request message that it sends to Oracle Mediator/ESB.

  2. The transaction ID for the asynchronous request.

  3. The file location of the acknowledgement it received from Oracle Mediator/ESB

You can use the PeopleSoft Integration Broker message logs to view the flow of the messages. You can also use the Integration Broker Service Operations Monitor to view information about the outbound transaction.

You can also use the Oracle Mediator/ESB Console to check for the message instance and for the successful invocation of the Mediator/ESB service.

See Managing Integration Gateway Message and Error LoggingIntegration Broker Service Operations Monitor: Monitoring Asynchronous Service Operation Transactions.