The following case study demonstrates how you set up an external system to use External Messaging Agent. Suppose your company's Human Resources department uses PeopleSoft as the host system for Perceptive Content. The HR administrator needs to change Sally Smith's last name to Johnson without creating a new employee ID for her and maintaining her employee ID of 123456. To complete this task, the administrator completes the name change in PeopleSoft, which activates a name-change script that uses SQL to insert rows in your Perceptive Content database.
During implementation of Perceptive Content, the External Message Agent configuration file, inserverEM.ini, was configured to execute a custom iScript, HR_UpdateName.js, for an employee name change. As a result of the host system inserting this message, INEMUSER runs the iScript, which updates all of Sally's documents by changing her last name to Johnson while maintaining her employee ID.
In this case study, the following message is inserted into the agent:
Begin Trans
insert into in_extern_msg (EXTERN_MSG_ID, MSG_TYPE, MSG_NAME, MSG_DIRECTION,
MSG_STATUS, START_TIME) values ( 'PS_1227306536156', 'Employee_Update', 'Update_Name',
1, 1, CURRENT_TIMESTAMP)
insert into in_extern_msg_prop (EXTERN_MSG_ID, PROP_NAME, PROP_TYPE, PROP_VALUE)
values ('PS_1227306536156', 'emplId', 0,'12356')
insert into in_extern_msg_prop (EXTERN_MSG_ID, PROP_NAME, PROP_TYPE, PROP_VALUE)
values ('PS_1227306536156', 'newLastName', 0,'Smith')
Commit Trans
To process this message, inserverEM.ini contains the following configuration:
[General] num.workers=5 message.pulling.interval=10 max.messages.per.type=100 [Employee_Update] Update_Name=HR_UpdateName.js Update_EmplId=HR_UpdateEmplId.js [Some_other_Process] PurgeDocument=HR_PurgeDocument.js
When received, inserverEM.ini processes the message and executes HR_UpdateName.js, which contains the following code:
function main()
{
var externalMsgObj = getInputPairs();
var emplId = externalMsgObj["emplId"];
var newName = externalMsgObj["newLastName"];
printf("Updating employee %s with new last name of %s\n", emplId, newName);