Skip to main content

Defining a Business Operation Class

Defining a Business Operation Class

To create a business operation class, define a class as follows:

  • Your business operation class must extend Ens.BusinessOperationOpens in a new tab (or a subclass).

  • In your class, the ADAPTER parameter should usually equal the name of the adapter class for this business service to use.

    Or you can define a business operation with no associated outbound adapter class. In this case, the business operation itself must contain the logic needed to communicate with an external application.

  • In your class, the INVOCATION parameter must specify the invocation style you want to use, which must be one of the following.

    • Queue means the message is created by the sending component’s job and placed on a queue. The receiving component’s job takes the message from the queue and processes it. This is the most common setting.

    • InProc means the message is created and processed by the sending component’s job. (InProc stands for “in the same process.”) Although the message trace display suggests that the message is sent to another job, the sending component’s job just executes code in the receiving component’s class. There is no message queue.

  • Your class should define a message map that includes at least one entry. A message map is an XData block entry that has the following structure:

    XData MessageMap
    {
    <MapItems>
      <MapItem MessageType="messageclass">
        <Method>methodname</Method>
      </MapItem>
      ...
    </MapItems>
    }
    

    See Defining a Message Map.

  • Your class must define all the methods named in the message map. These methods are known as message handlers. Each message handler should have the following signature:

    Method Sample(pReq As RequestClass, Output pResp As ResponseClass) As %Status {}

    Here Sample is the name of the method, RequestClass is the name of a request message class, and ResponseClass is the name of a response message class. In general, these methods will refer to properties and methods of the Adapter property of your business operation. For details, see Defining Message Handler Methods.

  • Your class can add or remove settings. See Adding and Removing Settings.

  • Your class can implement any or all of the startup and teardown methods. See Overriding Start and Stop Behavior.

    InterSystems IRIS is an integration platform potentially communicating with many other heterogeneous devices; therefore, it does not make property values dependent on server platform, time zone, time formatting, or other localization issues that may apply. Rather, InterSystems recommends you handle such cases in your production implementation. If your production requires different initial settings for property values, set the value in the OnInit() method of the business operation. See Overriding Start and Stop Behavior.

  • Your class can contain methods to accomplish work internal to itself.

The following example shows the general structure that you need:

Class MyProduction.NewOperation Extends Ens.BusinessOperation
{
Parameter ADAPTER = "MyProduction.MyOutboundAdapter";

Parameter INVOCATION = "Queue";

Method SampleCall(pRequest As Ens.Request, Output pResponse As Ens.Response) As %Status
{
  Quit $$$ERROR($$$NotImplemented)
}

XData MessageMap
{
<MapItems>
  <MapItem MessageType="Ens.Request">
    <Method>SampleCall</Method>
  </MapItem>
</MapItems>
}
}

For examples of business operation classes, see the adapter guides.

FeedbackOpens in a new tab