on 06-20-2008 2:03 PM
Hi All,
I am creating an adapter module and with in the module I am validating the content of the payload. On erroneous conditions, I need to stop the whole message flow. How can I achive this?
I could write error message in Audit Log but this will not be an error. The message processing will still continue passing the standard adapter module. I do not want this to happen.
I have added throws ModuleException to my process method signature and with in the method I am using the statements
ModuleException m = new ModuleException("Stopped Message Flow");
throw m;
But this does not have any impact on the Message Flow at all.
Regards,
Jaishankar
Please use
throw new ModuleException("Stopped Message Flow");
instead of
ModuleException m = new ModuleException("Stopped Message Flow");
throw new m;
/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gabriel,
Both the statements create a new ModuleException object with string "Message Flow Stopped". So I dont think this is the reason. Am I missing some thing here?
My code snippet would lokk some thing like this
public ModuleData process(ModuleContext moduleContext,ModuleData inputModuleData) throws ModuleException {
try {
Message msg = (Message) inputModuleData.getPrincipalData();
XMLPayload xmlPayload = msg.getDocument();
AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(), AuditDirection.OUTBOUND);
Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR,"Custom module: Created Exception");
throw new ModuleException("Stopped Message Flow");
}
catch (Exception e){
e.printStackTrace();
}
return inputModuleData;
}
Hi
Paste throw new ModuleException("Stopped Message Flow");
in catch block.
public ModuleData process(ModuleContext moduleContext,ModuleData inputModuleData) throws ModuleException {
try {
Message msg = (Message) inputModuleData.getPrincipalData();
XMLPayload xmlPayload = msg.getDocument();
AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(), AuditDirection.OUTBOUND);
Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR,"Custom module: Created Exception");
}
catch (Exception e){
throw new ModuleException("Stopped Message Flow");
}
return inputModuleData;
}
/people/ganesh.karicharla2/blog/2008/02/20/adapter-module-development-module-configuration
Just check with the below code
public ModuleData process(ModuleContext moduleContext,
ModuleData inputModuleData)
throws ModuleException {
//Handler to get Message object
Message msg = null;
try {
//Fetch the PrincipalData
msg = (Message)inputModuleData.getPrincipalData();
if (msg.getMessageDirection()
== MessageDirection.INBOUND)
amk = new AuditMessageKey(msg.getMessageId(),
AuditDirection.INBOUND);
else
amk = new AuditMessageKey(msg.getMessageId(),
AuditDirection.OUTBOUND);
XMLPayload xmlpayload = msg.getDocument();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,
"AO: Now got the xml payload object.");
String xmltxt = xmlpayload.getText();
String convertedtext = swiftRead(xmltxt);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,
"AO: Value returned after calling swiftRead:");
xmlpayload.setText(convertedtext);
inputModuleData.setPrincipalData(msg);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,
"AO: Text put into inputModuleData");
} catch (Exception e) {
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,
"AO: Module Exception caught:");
ModuleException me = new ModuleException(e);
throw me;
}
return inputModuleData;
}
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.