Skip to main content

PEX Business Services

Business services connect with external systems and receive messages from them through an inbound adapter. For general information related to all production components written in an external language, see About Business Hosts and Adapters.

Developing a Business Service

To write a business service in an external language, extend one of the following classes:

Language Class
Java com.intersystems.enslib.pex.BusinessService
.NET InterSystems.EnsLib.PEX.BusinessService
Python iris.pex.BusinessService

There are three ways of implementing a business service:

  1. Polling business service with an adapter — The production framework at regular intervals calls the adapter’s OnTask() method, which sends the incoming data to the ProcessInput() method of the business service, which, in turn calls the OnProcessInput method with your business service code. Your custom code must implement the OnProcessInput method to handle data from the adapter, not ProcessInput.

  2. Polling business service that uses the default adapter — In this case, the framework calls the default adapter's OnTask method with no data. The OnProcessInput() method then performs the role of the adapter and is responsible for accessing the external system and receiving the data.

  3. Nonpolling business service — The production framework does not initiate the business service. Instead custom code in either a long-running process or one that is started at regular intervals initiates the business service by calling the Director.CreateBusinessService() method. For more details, see Director.

Implementing Abstract Methods

After extending the PEX class, you need to implement abstract methods for the business service.

When developing a polling business service with an adapter, the OnProcessInput() takes an arbitrary object from the adapter, and returns an arbitrary object. These arbitrary objects do not need to be persistent.

For more details about the abstract methods that need to be implemented, see PEX API Reference.

Using an Inbound Adapter

Within a production, a business service uses an inbound adapter to communicate with systems outside the production. When developing a PEX business service, you can include a special method in the remote class to define which inbound adapter the business service uses. This inbound adapter can be a PEX adapter or a native ObjectScript adapter.

The method used to specify the inbound adapter for the PEX business service is getAdapterType(). For example, if the PEX business service uses a custom PEX inbound adapter, your remote class might include:

public String getAdapterType() {
  return "com.demo.pex.MyInboundAdapter";
}
public override string getAdapterType() {
  return "Demo.PEX.MyInboundAdapter";
}
def getAdapterType():
  return "demo.PEX.MyInboundAdapter"

When using a PEX adapter, the getAdapterType method should return the name of the ObjectScript proxy class that was specified when the adapter was registered. By default, this proxy name is the same as the remote class, but a custom name might have been defined.

If you do not include getAdapterType in the remote class, the business service uses the standard Ens.InboundAdapter adapter. If your business service does not use an adapter, return an empty string.

Using the Business Service

Once you have finished developing the remote class of the PEX business service, you can complete the following steps to integrate the business service into an interoperability production:

  1. Register the PEX business service by navigating to Interoperability > Configure > Production EXtensions Components. For details, see Registering a PEX Component.

  2. Open the production and use the standard wizard to add a business service. In the Service Class field, select the ObjectScript proxy class of the PEX component. By default, the name of this proxy class matches the remote class, but a custom name might have been defined when the component was registered.

FeedbackOpens in a new tab