on 12-11-2013 5:54 AM
Dear all,
I have written custom adapter module which was working fine. But in the audit log something weird is happening which I'm not sure what's the cause for this. I would appreciate if someone can pinpoint what I'm doing wrong here.
After deploying the module the first time Audit log looks good as I expected. Please see the screenshot below
The second time if I call same module the Audit log seems different comparing to the fist time. Please see the screenshot below
AuditAccess audit = null;
public ModuleData process(ModuleContext moduleContext,
ModuleData inputModuleData) throws ModuleException {
Object obj = null;
Message msg = null;
String msgType = null;
String nameSpace = null;
MessageKey key = null;
try {
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
XMLPayload xp = msg.getDocument();
try {
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
key = new MessageKey(msg.getMessageId(), msg
.getMessageDirection());
audit = PublicAPIAccessFactory.getPublicAPIAccess()
.getAuditAccess();
audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS,
"JMSRemoveHeader: Module called");
} catch (Exception e) {
ModuleException me = new ModuleException(e);
throw me;
}
if (xp != null) {
String xpload = xp.getText().toString();
String returnPayload = remove(xpload, key);
xp.setContent(returnPayload.getBytes());
}
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
audit.addAuditLogEntry(key, AuditLogStatus.ERROR,
"JMSRemoveHeader: Module Exception Caught .");
ModuleException me = new ModuleException(e);
throw me;
}
audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS,
"JMSRemoveHeader: Module executed successfully");
return inputModuleData;
}
public String remove(String src, MessageKey key) throws Exception {
String actualXML = src;
String cpHeader = "NO HEADER FOUND";
int firstXMLChar = src.indexOf("<");
if (firstXMLChar != -1) {
cpHeader = src.substring(0, firstXMLChar);
actualXML = src.substring(firstXMLChar, src.length());
}
try {
audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS,
" Header from Source:" + cpHeader);
} catch (Exception e) {
audit.addAuditLogEntry(key, AuditLogStatus.ERROR,
"Exception in Removing Header.");
}
return actualXML;
}
Thanks,
Justin.
Hi Justin,
I presume you're referring to the sequencing of the log messages here, yes? If so, I'd speculate that the issue is probably somehow a function of the buffering scheme used to output messages to the log. Without knowing the particulars of how SAP implemented this, I would imagine that there's a synchronization issue of some kind between the thread that coordinates the execution of the adapter modules and the thread your EJB is running in. Do you have a strong need to sync these up, or is this more of a curiosity?
Thanks,
James
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.