Message Processing (Normal, Error)
A message is string data that sends the processing result of an online service or error details to the calling channel. Normal messages and error messages are managed under the same scheme.
1. Message Management
When processing messages in a business program, the code is set, and its content is managed in BXM Web Admin.
2. Normal Messages
Configure the message to be returned when an online service is processed normally. The configured message is set in the Header.
Use the DefaultApplicationContext.addMessage() API to configure the message. Variable messages are handled by putting them into an Object[] object.
/*
* BXMI60000
* Default message: The transaction request has been processed normally.
*/
DefaultApplicationContext.addMessage("BXMI60000", null, new Object[] {}); // The transaction request has been processed normally.
3. Error Messages
Configure the message to be returned when an online service is processed with an error. For unintended runtime errors, the framework assembles the error message. Variable messages are handled by putting them into an Object[] object.
/*
* BXME30000
* Default message: The transaction request has not been processed normally.
* Detailed message: Detailed message: {0}
*/
throw new DefaultApplicationException("BXME30000", new Object[] {}, new Object[] { "Pre-Deploy Test Exception." }); // The message contained in the Object[] object is parsed at the {0} position.
/*
* BXME30006
* Default message: The processing of the requested service [{0}] operation [{1}] has exceeded the administrator-defined time limit [{2}]ms.
*/
throw new DefaultApplicationException("BXME30006", new Object[] {}, new Object[] {"DummyService", "getDummy", 5000}); // The processing of the requested service [DummyService] operation [getDummy] has exceeded the administrator-defined time limit [5000]ms.