Correlation Manager

In this section:

Correlation Manager maintains records of anticipated activities occurring in the system. Correlation actions take the correlation from OPEN to CLOSED state, and allow history to be recorded. Agents are provided to implement Correlation Manager interactions within process flows, however, it is possible to use this API to accomplish this same purpose within your own exits.


Top of page

x
Correlation Manager in Programs

A static controller, XDCorrelExitControl, offers an API for adding, updating, and inquiring on records. It passes method calls to the stateful services handler which executes the requests. The handler executes the requests by calling each correlation driver to offer it the opportunity to deal with the specific request. Drivers manage one or more namespaces (qualifiers), which can offer each driver the opportunity to provide specialized services for specific message types. Drivers cannot overlap namespaces; the first driver to report that it handles the namespace qualifier will receive all messages for that qualifier.

Static methods provide access to the stateful services.

Although your application can issue any of the calls documented in the interface, usually you will be opening and closing correlations. The provided methods for this capability are:

public static int addCorrelationEntry(
    String correlID,
    String namespace,
    String tid,
    String msg,
    String exp,
    int dupeStrategy,
    String correlSetID,
    String userDef,
    String comment,
    boolean isSet);

The following table lists and describes the related parameters.

Parameter

Description

correlID

Correlation identifier. Should be unique within namespace.

namespace

Namespace qualifier.

tid

Transaction ID. Can be retrieved from sreg(tid) through a special register lookup.

msg

Reserved for future use. Pass null for now.

exp

Expiration string as a duration. For example, one hour can be 1h.

dupeStrategy

How to handle duplicates. Choices are to ignore a duplicate or to return an error.

correlSetID

Identifier of this correlation set. It is the responsibility of the application to ensure that the child correlations are in the same namespace as the correlation set.

userDef

User field for any purpose.

comment

Comment for use in displays.

isSet

Indicates a correlation set record or a correlation interaction. Correlation set records are used for long running transactions, and need not be created for a simple correlation interaction.

The XDBaseCorrelDriver will automatically change this parameter to true when a child interaction is added to this information.

The return code depends upon the dupeStrategy selected.

public static int updateCorrelationEntry(
     int msgType,
     String correlID,
     String namespace,
     String tid,
     String msg,   // Reserved for future use
     boolean satisfy,
     String comment);

The update function adds a history entry to the correlation and, optionally, closes it. If you are working with a correlation set entry for a long running transaction, refer to the correlation entry by its correlation ID within its namespace. Closing such a master correlation set record (which was created by setting the isSet parameter of the add function to true) closes all interactions under the set.

The noteworthy parameters are described in the following table.

Parameter

Description

correlID

Correlation identifier. Should be unique within namespace.

namespace

Namespace qualifier.

tid

Transaction ID of the event that causes the history/change. It is not that of the original transaction that caused the add to be performed.

msg

Reserved for future use. Pass null for now.

satisfy

True if the correlation is to be closed. This closes all interactions in the set for correlation set entries.



x
Inquiring About Correlation

Correlation Manager offers the ability to inquire on the state of correlations. By using these inquiries, your program can obtain lists of correlations in given states and can drill down to details about the correlations.

As with the open and update calls, you make the inquiry calls through the XDCorrelExitControl static object.

Each of the calls returns a status code and an XDNode tree of information. The tree is rooted by the correl_mgr element that describes the query arguments. The query result set appears as children of the correl_mgr element. The schema for the tree is shown in the iWay Trading Manager User's Guide.

The getCorrelStatus method returns a single correlation record.

public static int getCorrelStatus(List result, String correlid,
   String namespace, boolean history);

Parameter

Description

result

XDNode tree will be returned as the first element in this List.

correlid

Correlation identifier. Should be unique within namespace.

namespace

Namespace qualifier.

history

If true, all history records are included as child nodes. If false, only the status record is provided.

The status of a correlation set can be returned directly from the correlation set identifier. To obtain all information pertaining to the correlation set, you can follow the chain of returned information available through this call.

public static int getCorrelSetStatus(List result,
   String correlSetID, String namespace, boolean detail);

Parameter

Description

result

XDNode tree will be returned as the first element in this List.

correlSetID

Identifier of this correlation set.

namespace

Namespace qualifier.

detail

Whether to include the status of child correlations in the report.

You can obtain information on any interaction within a date range or in a given state.

public int getCorrelActivity(
     List result,
     String namespace,
     boolean history,
     int timetype,
     int state,
     String sdate,
     String edate,
     int maxrows)

Parameter

Description

result

XDNode tree will be returned as the first element in this List.

namespace

Namespace of interest. Use * or null for all namespaces.

history

Whether the history events are included in the report.

timetype

Meanings of the dates given in the sdate and edate parameters.

state

OPEN, CLOSED, ALL, or PROBLEM. Only interactions in the given state are returned.

sdate

Low date of the range in compressed RFC 1138 form.

edate

High date of the range in compressed RFC 1138 form.

maxrows

Number of rows to return. Use 0 for all.



x
Developing Correlation Manager Drivers

Any drivers added to the stateful service bus must implement the complete API. The driver must extend com.ibi.edaqm.XDCorrelDriver and must implement com.ibi.common.IXDCorrelDriver.

The driver must implement all of the calls in the interface, as described in this manual and the User's Guide.


iWay Software