Skip to main content

Outbound Adapters

Business operations use outbound adapters to send out specific types of data from the production. You can write a custom outbound adapter that is used by an ObjectScript business operation, or it can be used by a business operation that is also written in a PEX-supported language. For general information related to all production components written in an external language, see About Business Hosts and Adapters.

Developing a Custom Adapter

To write an outbound adapter in an external language, extend one of the following classes:

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

Within the outbound adapter, you can create all the methods you need to successfully send out data from the production. Each of these methods can be called from the business operation associated with the adapter.

Adding Your Adapter to a Business Operation

Once you have written your custom outbound adapter in a PEX-supported language, you are ready to define a business operation to use the adapter. The ObjectScript class for your business operation must include:

Parameter ADAPTER = "EnsLib.PEX.OutboundAdapter"

If your production is using a custom PEX business operation, subclass EnsLib.PEX.BusinessOperation and define the ADAPTER parameter. If you are using a native ObjectScript business operation, subclass Ens.BusinessOperation and add the parameter.

Once you have your business operation subclass, add it to your production using the Management Portal. The Remote OutboundAdapter settings of this business operation, which are available in the Management Portal, define the details of the adapter.

Remote OutboundAdapter Setting Description
Remote Classname Specifies the name of the outbound adapter class that you wrote in the external language.
Remote Settings Allows you to specify values of runtime variables. For more details, see Setting Runtime Variables.
External Server Name Specifies the name of the external server for your language. For more details, see Running the External Server. If you use this setting, you do not need to define the Gateway Host and Gateway Port settings.
Gateway Extra Classpath Specifies paths to packages, files, libraries or binaries, files, and directories needed by your application. If you already defined these paths when setting up a custom external server for your language, you do not need to repeat them here. Using the pipe character (|) to separate paths is accepted on all operating systems.

Using the Outbound Adapter

A business operation uses its outbound adapter by invoking methods defined in the adapter’s code. The syntax for invoking these methods varies depending on whether the business operation is a PEX component or a subclass of Ens.BusinessOperation.

If your business operation is a PEX component, use Adapter.invoke to call the method. For example, to invoke the adapter’s printString method, you might add the following code to your business operation:

public Object OnMessage(Object request) throws Exception {
  MyRequest myReq = (MyRequest)request;
  Adapter.invoke("printString", myReq.requestString);
public object OnMessage(object request) 
  MyRequest myReq = (MyRequest)request;
  Adapter.invoke("printString", myReq.RequestString);
def OnMessage(self, messageInput):
  self.Adapter.invoke("printString", messageInput.requestString)