Sending messages to the system engine

To send messages into the system engine, Java code can invoke the CloverleafLink.doMessageIn() method.
public String doMessagesIn(ArrayList<String[]> msgs, boolean doRecoveryDB)
  • msgs parameter is a list of six items in a string array.
  • doRecoveryDB is a boolean parameter that tells the engine you are putting the message into the recovery database.

This method returns a string, where OK means success or ERROR indicates failure.

This code fragment shows how to invoke the method:

ArrayList<String[]> callAl = new ArrayList<String[]>();
String[] retStrings = new String[DrCon.IB_SIZE]; // First message
retStrings[DrCon.IB_USER_DATA] = userDataValS;
retStrings[DrCon.IB_MSG_TYPE] = DrCon.TYPE_DATA;
retStrings[DrCon.IB_MSG] = msgS;
retStrings[DrCon.IB_TRXID] = trxidValS;
// Assemble the key/subkey into driver control for next protocol thread
String drCtl = "MSG_KEY " + keyS; // Key must exist for us
if ((subKeyS != null) && (subKeyS.length() > 0))
    drCtl = drCtl + " MSG_SUBKEY " + subKeyS;
if (expectReplyB) { // Add our thread id so can get the reply
    drCtl = drCtl + " " + DrCon.CON_DRCTL_KEY + threadIdL;
}
retStrings[DrCon.IB_DRIVER_CTL] = drCtl;
callAl.add(retStrings); // Only one message
// Call and do not wait for msg to be in rdb
String retS = cl.doMessagesIn(callAl, false);
if (retS == null) {
    return "Driver call returned null String.";
}