IntBroker Class Methods

In the following section, we discuss the IntBroker class methods. The methods are described in alphabetical order.

Syntax

Cancel(TransactionId, QueueName, DataType, SegmentIndex | TransactionIdArray, QueueNameArray, DataTypeArray, SegmentIndexArray)

Description

Use the Cancel method to programmatically cancel either a message, or a list of messages, from the message queue, much the same as you can do in the message monitor.

This method is only available when the message has one of the following statuses:

  • Edited

  • Error

  • New

  • Retry

  • Timeout

If you are specifying an array of messages to be canceled, and any message in the array fails for any reason (for example, you specify a message that doesn't have the correct status) no messages are canceled and the method return value is false.

Parameters

Field or Control

Definition

TransactionId | TransactionIdArray

Specify either a single transaction ID as a string, or specify an array of string containing the transaction Ids of the messages you want to cancel.

QueueName | QueueNameArray

Specify either a single queue name as a string, or specify an array of string containing the queue names that contain the messages you want to cancel.

DataType | DataTypeArray

Specify either a single data type, or an array of string containing the data types. See below for valid data types.

SegmentIndex | SegmentIndexArray

Specify either a specific segment, or an array of integer containing the segment numbers you want to cancel.

For the DataType or DataTypeArray parameters, the valid data types are:

Constant Value

Description

%IntBroker_BRK

Cancel the message for the web services gateway.

%IntBroker_PUB

Cancel the message for the publication contract.

%IntBroker_SUB

Cancel the message for the subscription contract.

Returns

A Boolean value: true if the message or messages are canceled successfully, false otherwise.

Syntax

ConnectorRequest(&Message[, process_exceptions])

Description

Use the ConnectorRequest method to return a response message from the connector based on the message passed in.

You would only use this method after you had set the connector information.

Parameters

Field or Control

Definition

&Message

Specify an already instantiated message object to return a response message from the connector.

process_exceptions

Specifies a Boolean value indicating whether the PeopleCode program will process exceptions.

Important! When this parameter is set to True, your program must read the response status property of the response message to determine if the call was successful. If there is an exception, then interrogate the IBException object within the Message object to get the details of the exception.

Returns

A Message object.

Example

   Local string &nonXmlData = "<?xml version=""1.0""?><data psnonxml=""yes""><![CDATA[" | &encoded | "]]></data>";
   &soapMsg = CreateXmlDoc(&nonXmlData);
   
   &reqMsg.SetXmlDoc(&soapMsg);
   
   Local Message &respMsg;
   
   %This.SetConnectorProperties(&reqMsg, &url);
   
   &respMsg = %IntBroker.ConnectorRequest(&reqMsg);
   
   If &respMsg = Null Then /* Throw exception */
   %This.HandleNullSoapResponse(&soapMsg, &url);
   End-If;

This second example demonstrates how to evaluate the response message status when process_exceptions is True:

Local Message &MSG, &resp_MSG;

&resp_MSG = %IntBroker.ConnectorRequest(&MSG, True);

If &resp_MSG.ResponseStatus = %IB_Status_Success Then
   /* Perform processing of a successful response message */
   
Else
   /* Read the IBException object for exception specifics */
   &error = &resp_MSG.IBException.ToString();
   
End-If;

Syntax

ConnectorRequestUrl(URL)

Description

Use the ConnectorRequestUrl method to return the URL for a connector.

You must have already set the connector parameters before executing this command.

Parameters

Field or Control

Definition

URL

Specify an absolute URL as a string.

Returns

A string.

Example

/**
 * Get XML Doc from URL
 *
 * @param String - Location
 * @return XmlDoc - retrieved XmlDoc
**/

method getXmlDocumentFromURL
   /+ &location as String +/
   /+ Returns XmlDoc +/
   Local XmlDoc &xmldoc;
   Local string &xmlstr;
   
   If Substring(LTrim(RTrim(Upper(&location))), 1, 4) = "HTTP" Then
   &xmlstr = %IntBroker.ConnectorRequestUrl(&location);
   Else
   &xmlstr = %This.getXmlContentFromFile(&location);
   End-If;
   
   &xmldoc = CreateXmlDoc("");
   
   If &xmldoc.ParseXmlString(&xmlstr) Then
   Return &xmldoc;
   End-If;
   
end-method;

Syntax

DefaultLocalNode()

Description

Use the DefaultLocalNode method to return the name of the default local node on this system.

Parameters

None.

Returns

String.

Example

In a Mobile Application Platform (MAP) application, use this method when generating a link to a classic component or to a fluid component. For example, the following PeopleCode generates a link to a fluid homepage.

&URL = GenerateComponentPortalURL(%IntBroker.DefaultPortalName(), %IntBroker.DefaultLocalNode(), MenuName.NUI_FRAMEWORK, %MAP_Market, Component.PT_LANDINGPAGE, Page.PT_LANDINGPAGE, "U");

Syntax

DefaultPortalName()

Description

Use the DefaultPortalName method to return the name of the default portal on this system.

Parameters

None.

Returns

None.

Example

In a MAP application, use this method when generating a link to a classic component or to a fluid component. For example, the following PeopleCode generates a link to a fluid homepage.

&URL = GenerateComponentPortalURL(%IntBroker.DefaultPortalName(), %IntBroker.DefaultLocalNode(), MenuName.NUI_FRAMEWORK, %MAP_Market, Component.PT_LANDINGPAGE, Page.PT_LANDINGPAGE, "U");

Syntax

DeleteLayoutCache(MAP_layout)

Description

Use this method to delete all cached copies of this Mobile Application Platform (MAP) application.

Parameters

Field or Control

Definition

MAP_layout

Specifies the name of the MAP application (layout) as a String.

Returns

A Boolean value: True if the method completes successfully, False otherwise.

Example

Use the DeleteLayoutCache method in the OnInitEvent to clear any cached copies of this MAP application:

&b = %IntBroker.DeleteLayoutCache("MAP_APP_2");

Syntax

DeleteOrphanedSegments(TransactionId)

Description

Use the DeleteOrphanedSegments method to delete segments that might have been orphaned if you were processing message segments using a Application Engine program that had to be restarted. Since each segment is committed to the database, if the application engine program is aborted, these segments need to be deleted from the database.

Parameters

Field or Control

Definition

TransactionId

Specify the transaction ID that identifies the message which contains the segments you want to delete.

Returns

A Boolean value: true if the method completes successfully, false otherwise.

Syntax

DeleteRESTCache(service_op, service_op_ver

Description

Use the DeleteRESTCache method to delete a server-side REST cache created by the SetRESTCache method.

Parameters

Field or Control

Definition

service_op

Specifies the Integration Broker service operation as a string.

service_op_ver

Specify the version of the specified operation as a string.

Returns

A Boolean value: True if the cache was deleted successfully, False otherwise.

Example

Local Message &MSG;
Local datetime &dt;
Local string &op, &ver;

&MSG.SetRESTCache(&dt);

&b_ret = %IntBroker.DeleteRESTCache(&op, &ver);

Syntax

GenLayoutDoc(layout_name, URI_index, &URI_doc [, use_custom_doc])

Description

Use the GenLayoutDoc method to return a new Document object from the one that was used to invoke the MAP layout. This allows you to run the MAP application and return just the data generated instead of the resulting HTML so that you can then generate a physical format (JSON or XML) from the Document.

Parameters

Field or Control

Definition

layout_name

Specifies the name of the MAP application (layout) as a String value.

URI_index

Specifies the URI index as an Integer.

Note: The URI index is the number on the Initialization page associated with each resource available within a MAP application. See Using the Layout Initialization Section of the Initialization Page for more information on URI indexes.

&URI_doc

Specifies the document for the MAP application to be invoked as a Document object.

use_custom_doc

Specifies an optional boolean value indicating whether to return the Document object based on the custom document instead of the parent document.

Returns

A Document object.

Example

In the following example, the returned Document object is used to generate a JSON (JavaScript Object Notation) structure:

local Document &Doc1 = CreateDocument("MAP_LAYOUT", "QE_FLIGHTTEST1_MAP", "v1");
&COM2 = &Doc1.DocumentElement;
&COM2.GetPropertyByName("PAGE_ID").Value = "INIT";
&COM2.GetPropertyByName("LAYOUT_ID").Value = - 1;
&COM2.GetPropertyByName("Pilot").Value = "Major Tom";
   
local Document &Doc2 = %IntBroker.GenLayoutDoc("QE_FLIGHTTEST", 1, &Doc1);
local string &data = &Doc2.GenJsonString();

Syntax

GenLayoutHTML(MAP_layout, URI_index, &doc [, element_ID] [, gen_JSON])

Description

Use this method to generate all or a portion of the HTML for a specified Mobile Application Platform (MAP) application. Use this method when you want to invoke another MAP application as an external page from the calling MAP application

Parameters

Field or Control

Definition

MAP_layout

Specifies the name of the MAP application (layout) as a String.

URI_index

Specifies the URI index as an Integer.

Note: The URI index is the number on the Initialization page associated with each resource available within a MAP application. See Using the Layout Initialization Section of the Initialization Page for more information on URI indexes.

&doc

Specifies the document for the MAP application to be invoked as a Document object.

element_ID

Specifies the ID for a specific element as a String, if only the HTML for that element is to be generated. Valid element types include containers, sidebars, headers, and footers. You can use either the system-generated ID or the developer-defined alternate ID for the element.

gen_JSON

Specifies a Boolean value indicating whether to also return the document data as a JSON string.

Returns

The return data type depends on the gen_JSON parameter:

  • When gen_JSON is False or is omitted, the method returns a String that is the HTML.

  • When gen_JSON is True, the method returns a two-dimensional Array of String:

    • The first element is the HTML.

    • The second element is the document data as a JSON string of attribute-value pairs.

Example

In the following example, the external MAP application is to be called from page 4 of the invoking MAP application. A Document object is created and populated with data from the current MAP application. Then, the GenLayoutHTML method is executed to return the portion of HTML corresponding to a specific container in the invoked MAP application. Finally, this returned HTML is assigned to a primitive that has been associated with an HTML area element in the invoking MAP application.

If &URICOM.GetPropertyByName("PAGE_ID").Value = 4 Then
   &Doc1 = CreateDocument("MAP_LAYOUT", "FLIGHTCARD1_MAP", "v1");
   &COM2 = &Doc1.DocumentElement;
   &COM2.GetPropertyByName("PAGE_ID").Value = "INIT";
   &COM2.GetPropertyByName("LAYOUT_ID").Value = - 1;
   &COM2.GetPropertyByName("Pilot").Value = &URICOM.GetPropertyByName("Pilot").Value;
   &COM2.GetPropertyByName("CardNbr").Value = &URICOM.GetPropertyByName("CardNbr").Value;
   &temp = %IntBroker.GenLayoutHTML("FLIGHTCARD", 2, &Doc1, "mapcont_start_1");
   
   &COM.GetPropertyByName("prim_text").Value = &temp;
end-if;

Syntax

GetArchData(TransactionId, SegmentIndex)

Description

Use the GetArchData method to retrieve an archived message from the message queue.

Note: This method shouldn't be used in standard message processing. It should only be used when accessing archived messages.

Parameters

Field or Control

Definition

TransactionId

Specify the transaction ID of the archived message you want to retrieve.

SegmentIndex

Specify the number of the segment of the archived message that you want to retrieve.

Returns

An XML string containing the archived data.

Syntax

GetArchIBInfoData(TransactionId, ParentTransactionId)

Description

Use the GetArchIBInfoData method to retrieve return archived IBInfo data.

Note: This method shouldn't be used in standard message processing. It should only be used when accessing archived messages.

Parameters

Field or Control

Definition

TransactionId

Specify the transaction ID of the archived message you want to retrieve.

ParentTransactionId

Specify the parent transaction ID, for the message.

Returns

An XML string containing the archived data.

Syntax

GetContentURI()

Description

Use the GetContentURI method to return the value of the content URI text defined for this system. For example:

http://myserver.example.com:8010/psc/MY_SITE/

Parameters

None.

Returns

A String value.

Syntax

GetDocSchema(DocumentKey &Key, Type[optional])

Description

Use the GetDocSchema method to access the saved schema for the specified document.

Parameters

Field or Control

Definition

DocumentKey

Specify the document by populating the Document Key object with package name, document name, and version name.

Type

By default, XML schema is returned if no value is passed.

You can use the following values to specify the schema type:

  • %IB_XML - Returns XML schema.

  • %IB_JSON - Returns JSON schema.

Returns

A string containing the specified document schema.

Example

Local DocumentKey &Key;

&Key = CreateDocumentKey("package", "document", "version");
&str_json = %IntBroker.GetDocSchema(&Key, %IB_JSON);

Syntax

GetIBInfoData(TransactionId, DataType)

Description

Use the GetIBInfoData to return the specified IBInfo data.

Parameters

Field or Control

Definition

TransactionID

Specify the transaction ID of the message that you want to access.

DataType

Specify the data type of the message you want to access. The valid values are:

Constant Value

Description

%IntBroker_BRK

Get the message for the web services gateway.

%IntBroker_PUB

Get the message for the publication contract.

%IntBroker_SUB

Get the message for the subscription contract.

Returns

An XML string containing the message data.

Syntax

GetIBTransactionIDforAE(OperID, RunCtlID)

Description

Use this method to get the Integration Broker transaction ID from within an Application Engine program. You can use this transaction ID to instantiate a message object and thereby retrieve the message content data.

Parameters

Field or Control

Definition

OperID

Specifies the operator ID for the Application Engine program as a string.

RunCtlID

Specifies the run control ID for the Application Engine program as a string.

Returns

A string representing the transaction ID.

Example

&TransID = %IntBroker.GetIBTransactionIDforAE(&opid, &runid);
&Msg = %IntBroker.GetMessage(&TransID, %IntBroker_SUB);

Syntax

GetImageURL(image_name)

Description

Use this method to get the URL to an image that has been uploaded using the Layout Image Upload page.

Parameters

Field or Control

Definition

image_name

Specifies the name of the image as a String.

Returns

A String value.

Example

Use the GetImageURL method in a Mobile Application Platform (MAP) application to return the image’s URL to be assigned to the designated dynamic image’s primitive.

&COM_NAV.GetPropertyByName("Altitude").Value = %IntBroker.GetImageURL("MAP_ACTIONS");

Syntax

GetMessage([TransactionId, DataType])

Description

Use the GetMessage method to return a message object.

If you specify a transaction ID and data type, the GetMessage method populates the message object with the data from that message.

If you do not specify any parameters, the GetMessage method doesn't populate the message with data. Instead, it creates a new instance of a message object. In this case, you must use another method, such as GetRowset, to populate the message object. You must always populate the message object with data before running any methods on it.

Parameters

Field or Control

Definition

TransactionId

Specify the transaction ID for the message that you want returned.

DataType

Specify the type of message that you want returned. The valid values are:

Constant Value

Description

%IntBroker_BRK

Get the message for the web services gateway.

%IntBroker_PUB

Get the message for the publication contract.

%IntBroker_SUB

Get the message for the subscription contract.

Returns

A reference to a message object if successful, Null if not successful.

Example

The following example returns a populated message object:

Local Message &MSG;
Local string &TransactionId;

&TransactionId = "0f3617dl-c6f4-11d9-a4bd-c12cbalbc2f9"
&MSG = %IntBroker.GetMessage(&TransactionId, %IntBroker_BRK);

Syntax

GetMessageErrors(TransactionId)

Description

Use the GetMessageErrors method to return an array that contains the errors that an application has set for the message, and have been written to the error queue. This method is generally only used with asynchronous messages.

Parameters

Field or Control

Definition

TransactionId

Specify the transaction ID for the message, as a string.

Returns

An array of string. If there are no error messages, the Len property of the array is 0.

Example

The following is an example of using the method for returning web services gateway error messages:

&MyErrors = %IntBroker.GetMessageErrors(&TransactionId);

Syntax

GetMsgSchema(MsgName, MsgVersion)

Description

Use the GetMsgSchema method to access the saved schema for the specified message.

If you specify a message that does not have a saved schema, you receive a null value.

Parameters

Field or Control

Definition

MsgName

Specify the name of the message for which you want to access a schema. You can either specify the name of the message as a string, or preface the message name with the keyword Message.

MsgVersion

Specify the message version.

Returns

A string containing the message schema. If you try to get a schema for a message that does not have a saved schema, returns null.

Syntax

GetPortalURI()

Description

Use the GetPortalURI method to return the value of the portal URI text defined for this system. For example:

http://myserver.example.com:8010/psp/MY_SITE/

Parameters

None.

Returns

A String value.

Syntax

GetSyncIBInfoData(TransactionId, %LogType [, Archive])

Description

Use the GetSyncIBInfoData method to return a log containing information about synchronous transactions.

Parameters

Field or Control

Definition

TransactionId

Specify the transaction ID of the published message.

LogType

Specify the type of log you want returned, based on the type of message. See below for the valid values.

Archive

Specify whether to retrieve any archived logs as well. This parameter takes a Boolean value: true to return archived logs, false otherwise. The default value is false.

For the LogType parameter, the valid values are:

Constant Value

Description

%Sync_RequestOrig

Gets the log for a sync request original data message.

%Sync_RequestTrans

Gets the log for a sync request transformed data message.

%Sync_ResponseOrig

Gets the log for a sync response original data message.

%Sync_ResponseTrans

Gets the log for a sync response transformed data message.

Returns

An XML string containing the log data.

Syntax

GetSyncLogData(TransactionId, %LogType [, Archive])

Description

Use the GetSyncLogData method to return a log containing information about the specified synchronous message.

You can use this information for debugging. Using this method, you can obtain the request and response data in a synchronous request, both pre- and post-transformation.

This function is used in the PeopleCode for the Message Monitor.

Parameters

Field or Control

Definition

TransactionId

Specify the transaction ID of the published message.

LogType

Specify the type of log you want returned, based on the type of message. See below for the valid values.

Archive

Specify whether to retrieve any archived logs as well. This parameter takes a Boolean value: true to return archived logs, false otherwise. The default value is false.

For the LogType parameter, the valid values are:

Constant Value

Description

%Sync_RequestOrig

Gets the log for a sync request original data message.

%Sync_RequestTrans

Gets the log for a sync request transformed data message.

%Sync_ResponseOrig

Gets the log for a sync response original data message.

%Sync_ResponseTrans

Gets the log for a sync response transformed data message.

Returns

An XML string containing the log data.

Syntax

GetURL(service_op_name, service_op_index, &doc_object, [secure_target], [encode_unsafe])

Description

Use this method to generate a fully qualified URL for any REST-based service operation resource.

Parameters

Field or Control

Definition

service_op_name

Specifies the Integration Broker service operation as a string.

service_op_index

Specifies the the index for the URI as an integer. This index corresponds to the row number in the URI grid of the REST Resource Definition section of the service operation definition.

&doc_object

Specifies the document template for the service operation as a Document object.

secure_target

Specifies whether the REST location is a secure target location. The default value is the non-secure target location.

encode_unsafe

Specifies whether to encode unsafe characters as a Boolean value. The default is False (no encoding).

Returns

A string populated with the fully qualified URL.

Example

HTML is generated within the OnRequest event of a REST-based provider service using links defined from other REST-based service operations. Note that the REST-based service operation resources on either the publishing node (the provider) or the subscribing node (the consumer) can be used to generate the fully qualified links.


import PS_PT:Integration:IRequestHandler;

class RESThandler implements PS_PT:Integration:IRequestHandler
   method OnRequest(&message As Message) Returns Message;
   method OnError(&request As Message) Returns string;
end-class;

method OnRequest
   /+ &message as Message +/
   /+ Returns Message +/
   /+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/
   
   Local Document &Doc_Tmpl, &DOC;
   Local Compound &COM_Tmpl, &COM;
   Local Message &response;
   Local string &STR, &STR1, &STR2, &STR3, &STR4, &strHTML;
   Local boolean &bRet;
   
   &response = CreateMessage(Operation.WEATHERSTATION_GET, %IntBroker_Response);
   
   /* read URI Document to get parms out from the request*/
   &Doc_Tmpl = &message.GetURIDocument();
   &COM_Tmpl = &Doc_Tmpl.DocumentElement;
   
   /* Instantiate a Document object based on the REST-based service operations    document template that you want to create a link for */
   
   &DOC = CreateDocument("Weather", "WeatherTemplate", "v1");
   &COM = &DOC.DocumentElement;
   
   /* based off the data from the request populate the Document object */
   
   If &COM_Tmpl.GetPropertyByName("state").Value = "Washington" Then
   
   &COM.GetPropertyByName("state").Value = "Washington";
   
   /* call new method to create fully qualified URL(s) */
   
   &COM.GetPropertyByName("city").Value = "WhiteSalmon";
   &STR = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC, true, true);
   
   &COM.GetPropertyByName("city").Value = "Troutlake";
   &STR1 = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC);
   
   &COM.GetPropertyByName("city").Value = "Yakima";
   &STR2 = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC);
   
   &COM.GetPropertyByName("city").Value = "Lyle";
   &STR3 = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC);
   
   /* use these URLs as bind variables for the HTML definition */
   &strHTML = GetHTMLText(HTML.WEATHER_CITIES, &STR, &STR1, &STR2, &STR3);
   
   /* set the data in the response message */
   &bRet = &response.SetContentString(&strHTML);
   
   End-If;
   
   Return &response;
   
end-method;

Syntax

InBoundPublish(&Message)

Description

Use the InBoundPublish method to send an asynchronous message based on the specified message to simulate an inbound asynchronous request from an external node. Although you are sending a message to yourself, it goes through all the inbound message processing that the specified message would.

Prior to call the InBoundPublish method, the Message object needs to populated with the requesting node and external operation name.

See Simulating Receiving Messages from External Nodes.

Parameters

Field or Control

Definition

&Message

Specify an already instantiated message object that you want to use for the message simulation.

Returns

A Boolean value, true if the message is published successfully, false otherwise.

Syntax

IsOperationActive(OperationName [,OperationVersion])

Description

Use the IsOperationActive method to determine if an operation is active or not.

Parameters

Field or Control

Definition

OperationName

Specify the name of the operation that you want to check the status of.

OperationVersion

Specify the version of the specified operation that you want to check the status of, as a string.

Returns

A Boolean value: true if the operation is active, false otherwise.

Syntax

MAPLogout(MAP_layout)

Description

Use this method to generate the logout URL for this Mobile Application Platform (MAP) application. This URL can be assigned to a button, link, or some other page element. When the user clicks this element, the user is signed out of the application.

Parameters

Field or Control

Definition

MAP_layout

Specifies the name of the MAP application (layout) as a String.

Returns

A String value.

Example

Use this method to return the URL that can be assigned to a button, which when clicked will sign the user out of the application.

&URL_str = %IntBroker.MAPLogout(&MAP.LayoutName); 

Syntax

MAPSessionTimeout()

Description

Use the MAPSessionTimeout method to return an Integer value representing the session timeout value (in minutes) as defined on the Map Security - General page.

Parameters

None.

Returns

A Integer value.

Syntax

MAPTimeout(layout_name)

Description

Use the MAPTimeout method to return the timeout URL for the specified MAP layout. The following provides an example of a timeout URL:

http://myserver.example.com:8010/PSIGW/RESTListeningConnector/MY_SITE/SUB1_MAP.v1/?cmd=maptimeout

Parameters

Field or Control

Definition

layout_name

Specifies the MAP application (layout) as a String value.

Returns

A String value.

Syntax

MsgSchemaExists(MsgName, MsgVersion)

Description

Use the MsgSchemaExists method to determine if a schema has been created and saved for the specified message.

Parameters

Field or Control

Definition

MsgName

Specify the name of the message for which you want to access a schema. You can either specify the name of the message as a string, or preface the message name with the keyword Message.

MsgVersion

Specify the message version.

Returns

A Boolean value: true if the message schema exists, false otherwise.

Syntax

Publish(&Message [, &ArrayofNodeNames] [,IsEnqueued])

Description

The Publish method publishes a message to the message queue for the default message version.

This method does not publish the message if the IsOperationActive property for the message is False.

This method publishes a message asynchronously, that is, a reply message is not automatically generated. To publish a message synchronously, use the SyncRequest method.

Note: This method supports nonrowset-based messages only if the data is populated using the SetXmlDoc method.

If the Publish method is called and the message isn't populated (either using SetXmlDoc or one of the rowset methods,) an empty message is published.

The Publish method can be called from any PeopleCode event, but is generally called from an Application Engine PeopleCode step or from a component.

When publishing from a component, you should publish messages only from the SavePostChange event, either from record field or component PeopleCode. This way, if there’s an error in your publish code, the data isn’t committed to the database. Also, since SavePostChange is the last Save event fired, you avoid locking the database while the other save processing is happening.

However, until the message is published, the tables involved with the component are locked and are not saved. To avoid problems with this, specify the Deferred_Mode property as true, so the message is published after the table data has been committed to the database.

Note: If you’re publishing a message from within an Application Engine program, the message won’t actually be published until the calling program performs a Commit.

Parameters

Field or Control

Definition

&Message

Specify an already instantiated message object to be published.

&ArrayofNodeNames

Specify an already instantiated array of string containing the names of the nodes that you want to publish to.

IsEnqueued

Specify whether the message is to be enqueued or not. This parameter takes a Boolean value: true if the message is to be enqueued, false otherwise. The default value is false.

Returns

None.

Example

Local Message &Msg;
Local Rowset &rs;
Local IntBroker &Ib;

&Flight_profile = GetLevel0();

&Msg = CreateMessage(Operation.ASYNC, %IntBroker_Request);

&Msg.CopyRowset(&FlightProfile);

&Ib = %IntBroker;

&Ib.Publish(&Msg);

Syntax

Resubmit({TransactionId, QueueName, DataType, SegmentIndex} | {TransactionIdArray, QueueNameArray, DataTypeArray, SegmentIndexArray})

Description

Use the Resubmit method to programmatically resubmit either a message, or a list of messages, from the message queue, much the same as you can do in the message monitor.

You may want to use this method after an end-user has finished fixing any errors in the message data, and you want to resubmit the message, rerunning the PeopleCode.

This method is only available when the message has one of the following statuses:

  • Canceled

  • Edited

  • Error

  • Timeout

If you are specifying an array of messages to be resubmitted, and any message in the array fails for any reason (for example, you specify a message that doesn't have the correct status) no messages are resubmitted and the method return value is false.

Parameters

Field or Control

Definition

TransactionId | TransactionIdArray

Specify either a single transaction ID as a string, or specify an array of string containing the transaction Ids of the messages you want to resubmit.

QueueName | QueueNameArray

Specify either a single queue name as a string, or specify an array of string containing the queue names that contain the messages you want to resubmit.

DataType | DataTypeArray

Specify either a single data type, or an array of string containing the data types. See below for the valid data type values.

SegmentIndex | SegmentIndexArray

Specify either a specific segment, or an array of integer containing the segment numbers you want to resubmit.

For the DataType or DataTypeArray parameters, the valid data types are:

Constant Value

Description

%IntBroker_BRK

Resubmit the message for the web services gateway.

%IntBroker_PUB

Resubmit the message for the publication contract.

%IntBroker_SUB

Resubmit the message for the subscription contract.

Returns

A Boolean value: true if the message or messages are resubmitted successfully, false otherwise.

Syntax

SetMessageError(TransactionID, MsgSet, MsgNumber, Error_Location, ParamListCounter, [Param] ...)

Description

Use the SetMessageError method to write messages to the error queue. This method is used with asynchronous messages only.

Parameters

Field or Control

Definition

TransactionID

Specify the transaction ID for the message as a string.

MsgSet

Specify the number of the message set that the message associated with the error is associated with.

MsgNumber

Specify the message number that you want to associate with this error.

Error_Location

Specify where the error occurred, or any additional information you want to give about the error. This is a string, and allows 254 characters.

ParamListCounter

An integer value from 0 to 4 specifying the number of Param substitution strings to be passed.

Param

Specify up to four Param values to be used as substitution strings in the message text. The first Param value is used in the first substitution (that is, for %1,) the second is used in the second (that is, for %2), and so on.

Returns

A Boolean value, true if the error message was associated correctly, false otherwise.

Example

The following is an example of setting an error message for the web services gateway:

&Rslt = %IntBroker.SetMessageError(&TransactionId, &msgset, &msgnum, "error location", 4, &parm1, &parm2, &parm3, &parm4);

If you are passing just two parameters, then the call would be similar to this:

&Rslt = %IntBroker.SetMessageError(&TransactionId, &msgset, &msgnum, "error location", 2, &parm1, &parm2);

Syntax

SetStatus(&Message, Status)

Description

Use the SetStatus method to set the status of a publication or subscription contract, much the same way you do it in the message monitor.

You may want to use this method after an end-user has finished fixing any errors in the message data.

You can set the status of a contract to one of the following statuses:

  • Canceled

  • Done

  • Error

  • New

The method is available only when the message instance has one of the following statuses:

  • Canceled

  • Done

  • Error

  • New

Parameters

Field or Control

Definition

&Message

Specify an already instantiated message object that you want to set the status for.

Status

Specify the status that you want to set the message to. Valid status are:

Constant Value

Description

%Operation_Canceled

Cancel the message.

%Operation_Done

Set the message to done.

%Operation_Error

Set the message to be in error.

%Operation_New

Specify the message as new.

Returns

None.

Syntax

SwitchAsyncEventUserContext(UserID, LanguageCode)

Description

Use the SwitchAsyncEventUserContext method to switch the user context within an Integration Broker asynchronous event.

Parameters

Field or Control

Definition

UserID

Specify the user ID, as a string, to which you want to switch the context.

LanguageCode

Specify the language code, as a string, for the user ID.

Returns

A Boolean value: true if the switch user was successful, false otherwise.

Example

&returnValue = %IntBroker.SwitchAsyncEventUserContext("VP1", "ENG");

Syntax

SyncRequest([&MsgArray, &NodeNames])

Description

Use the SyncRequest method to send multiple messages at the same time. You should only use this message with synchronous messages. You can also use this method to send a single synchronous message at a time, or you can use the SyncRequest Message class method.

If you want to publish messages asynchronously, use the Publish method.

Note: This method supports nonrowset-based messages only if the SetXmlDoc method is used to populate the message prior to using the SyncRequest method.

You must set the thread pool size of the application server on the receiving system to a value greater than 1 (the default) in order to process more than one message at a time.

How many threads you specify determines how many messages are worked on simultaneously. For example, if you have 10 messages in &MsgArray, and your thread pool size is 5, then only 5 messages are processed at a time.

The maximum number you can specify for your thread pool size is 10.

Parameters

Field or Control

Definition

&MsgArray

Specify an already instantiated array of messages that contains the messages you want to publish.

&NodeNames

Specify an already instantiated array of string containing the names of the nodes that you want to publish to. The first message in the array of messages is published to the first node, the second message is published to the second node, and so on.

Returns

An array of messages. These are the corresponding messages returned for the published messages. The first message in the returned array corresponds to the first message in the published array, the second message with the second, and so on.

Example

The following is an example of how creating and receiving a series of messages:

Local Rowset &FLIGHTPLAN, &FLIGHTPLAN_RETURN;
Local Message &MSG;
Local File &BI_FILE;
Declare Function out_BI_results PeopleCode QE_FLIGHTDATA.QE_ACNUMBER FieldFormula;

Local array of Message &messages;
Local array of Message &return_mesages;

&messages = CreateArrayRept(&MSG, 0);
&return_mesages = CreateArrayRept(&MSG, 0);

&FLIGHT_PROFILE = GetLevel0();
&messages [1] = CreateMessage(OPERATION.QE_FLIGHTPLAN_SYNC);
&messages [1].CopyRowset(&FLIGHT_PROFILE);

&messages [2] = CreateMessage(OPERATION.QE_FLIGHTPLAN_SYNC);
&messages [2].CopyRowsetDelta(&FLIGHT_PROFILE);

&return_mesages = %IntBroker.SyncRequest(&messages);

&FLIGHTPLAN_RETURN = &return_mesages [1].GetRowset();
&temp = &return_mesages [1].GenXMLString();

out_BI_results(&temp);

&FLIGHTPLAN_RETURN = &return_mesages [2].GetRowset();
&temp = &return_mesages [2].GenXMLString();

out_BI_results(&temp);

Syntax

Update(&Message)

Description

Use the Update method to update a message in the message queue with the specified message object.

Parameters

Field or Control

Definition

&Message

Specify an already instantiated and populated message object to be used to update an existing message in the message queue.

Returns

A Boolean value, true if the message is updated successfully, false otherwise.

Syntax

UpdateCSSMetadata(CSS)

Description

Use the UpdateCSSMetadata method to return the input style sheet after substituting an actual image for the %MAP_IMAGE meta-HTML variable.

Parameters

Field or Control

Definition

CSS

Specifies the free form style sheet data as a String value.

Returns

A String value.

Syntax

UpdateDocument(&doc, update_type)

Description

Use this method to update the database based on the data in the specified Document object. The method can be used in a Mobile Application Platform (MAP) event only.

Important! To use this method, the document must be defined as a physical relational document.

Parameters

Field or Control

Definition

&doc

Specifies the document as a Document object.

update_type

Specifies the type of update to perform as an Integer. The constant values are:

Constant Value

Description

%Document_Update

Update the database by adding the keys and data from the specified document.

%Document_Replace

Update the database by first deleting data associated with any keys specified in the document, and then replacing them with the keys and data from the specified document.

%Document_Delete

Update the database by deleting data associated with any keys from the specified document.

Returns

A Boolean value: True if the update occurred successfully, False otherwise.

Syntax

UpdateJSMetadata(JS)

Description

Use the UpdateJSMetadata method to return the input JavaScript after substituting the system's default local node name for the %MAP_NODE meta-HTML variable.

Parameters

Field or Control

Definition

JS

Specifies the JavaScript data as a String value.

Returns

A String value.

Syntax

UpdateXmlDoc(&XmlDoc, TransactionId, DataType)

Description

Use the UpdateXmlDoc method to update a message in the message queue with the specified message data.

Note: This method shouldn't be used in a subscription program.

Parameters

Field or Control

Definition

&XmlDoc

Specify an already instantiated and populated XmlDoc object.

TransactionId

Specify the transaction ID of the message you want to update.

DataType

Specify the data type of the message that you want to update. Valid values are:

Constant Value

Description

%IntBroker_BRK

Update the message for the web services gateway.

%IntBroker_PUB

Update the message for the publication contract.

%IntBroker_SUB

Update the message for the subscription contract.

Returns

A Boolean value, true if the message was updated successfully, false otherwise.