Publish method: IntBroker class
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
| Parameter | Description |
|---|---|
|
&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);
Related Topics