|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Validation at MQInput Node |
« View previous topic :: View next topic » |
Author |
Message
|
SpitFire |
Posted: Wed Jan 11, 2006 11:15 pm Post subject: Validation at MQInput Node |
|
|
 Acolyte
Joined: 01 Aug 2005 Posts: 59 Location: India
|
Hi All,
In one of my message flows, I am trying to validate the incoming message at the Input node itself, using the 'Validation' properties of the same node.
I changed the 'Validation' properties of the MQInput node as follows
-----------------------------------------------------------------------------
Validate: Content & Value
Failure Action: Exception
Timing: Immediate
-----------------------------------------------------------------------------
I configured the MQInput node to receive messages in the MRM-XML format, conforming to a custom defined message set. Now, when I try sending a message that is not at all in the XML format, the MQInput node senses the error and redirects the output/error message & exception information to the failure terminal directly and not to the catch terminal. Why?
The same happens when the 'Timing' property indicated above is changed to 'Complete'. Only in the 'Deferred' mode, does the error message & the exception information pass through the catch terminal.
Can someone point out the information I'm overlooking here? Also, where exactly do I search for more information in this regard? _________________ ...: 5|71+ph1|23 :... |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Jan 11, 2006 11:45 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi _z33,
Quote: |
Set a value for Timing from the following list:
Deferred: a message is validated only as each field is parsed. This is the default behavior.
Immediate: a message is validated immediately, but subsets are permitted to remain unresolved (this supports Composition values Choice and Message under circumstances where the element is not yet resolved).
Complete: the entire message is validated immediately.
The options available for this property take advantage of the partial parsing capability of parsers in that you can choose either to validate only the fields that are accessed (Deferred), or to validate the entire message (Immediate and Complete). The former provides improved performance, the latter increased security. |
This should explain why Deferred is working as it is...
But Immediate and Complete should have also worked if your messege is entirely junk
Can we see the msg.
Regards. |
|
Back to top |
|
 |
SpitFire |
Posted: Thu Jan 12, 2006 12:44 am Post subject: Input Msg Structure |
|
|
 Acolyte
Joined: 01 Aug 2005 Posts: 59 Location: India
|
Hi,
Thanks for the pointer and I understood how Deferred works or rather why it works
Regarding the message structure, I have included the same below:-
----------------------------------------------------------------------------
<emp> ===> Type 'emp' (Complex)
<employeeID> ===> Type 'xsd:int' (Min: 1, Max: 1)
</employeeID>
</emp>
----------------------------------------------------------------------------
When I say junk messsage, my input is of the form, shown below:-
----------------------------------------------------------------------------
JUNK MESSAGE
----------------------------------------------------------------------------
Is there anything more you need on this scenario? _________________ ...: 5|71+ph1|23 :... |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 12, 2006 1:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Yes. You need to cause the bitstream to be parsed. To do that, just attempt to access any field within the message. |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Jan 12, 2006 1:39 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi _z33,
Ok, this I think is what is happening...
All the three types of validation know that the message is junk...
The two(Complete & Immediate) are meant to throw the message out immediately.
But as the word deferred means "postpone till later", in its case, the message is being given a chance to flow through until you ask for a parsing(say in a RCD etc)...it would fail there....that is why you got to pick the message from Catch and not out.
I guess it gives you this option, thinking that you will map this junk to some sensible structure in a later compute.
I could be totally yapping here Someone please confirm/correct.
Regards. |
|
Back to top |
|
 |
SpitFire |
Posted: Thu Jan 12, 2006 1:57 am Post subject: FailureAction |
|
|
 Acolyte
Joined: 01 Aug 2005 Posts: 59 Location: India
|
Hi Elvis_gn,
You seem to be correct here as your explanation seems to be the only plausible solution. However, I still don't understand the meaning for 'FailureAction'.
As you say, I agree that 'Deferred' provides some more time for the message to throw an exception and the error happens only when some field is referenced in the message. In that case, then for the other two 'Timing' vaues namely 'Immediate' and 'Complete', the FailureAction should be disabled. Because, even if I set the failureaction to 'Exception' in case of 'Immediate' and 'Complete', the message & exception information passes to Failure terminal. This is not the case in reality! Are we misunderstanding some rudimentary detail here? Please, guide me. _________________ ...: 5|71+ph1|23 :... |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jan 12, 2006 2:07 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Just to clear up the confusion...
Regardless of your validation settings, the message broker will not parse the bitstream at all unless you attempt to access a field in your ESQL (or mapping node).
Validation Timing allows you to override this behaviour. Setting Validation Timing to 'Immediate' or 'Complete' forces a parse to happen, so that invalid messages get trapped even if you have not accessed any fields.
'Failure Action' controls what happens when a validation error is detected. It is therefore independent of the Validation Timing setting.
Quote: |
In that case, then for the other two 'Timing' vaues namely 'Immediate' and 'Complete', the FailureAction should be disabled. Because, even if I set the failureaction to 'Exception' in case of 'Immediate' and 'Complete', the message & exception information passes to Failure terminal. This is not the case in reality! |
I'm not sure I understand your point. If you've asked for an exception to be thrown, your message will go to the failure terminal. Isn't that what you wanted? If you don't want the message to go to the failure terminal, set 'Validation Action' to something else. |
|
Back to top |
|
 |
aks |
Posted: Thu Jan 12, 2006 9:06 pm Post subject: |
|
|
Voyager
Joined: 19 Jul 2002 Posts: 84
|
I've found that validating an XML MRM message in a Compute node (wired to the MQInput node) to work better than doing it in the MQInput node.
Turn off validation on the MQInput node and configure the node to accept BLOB or XML messages. Wire an RCD node to set the message to the desired MRM and then wire it to a Compute node, where you can do something like this
Code: |
CREATE COMPUTE MODULE "ValidateXML"
CREATE FUNCTION main() RETURNS BOOLEAN BEGIN
SET OutputRoot = InputRoot;
DECLARE tempBlob BLOB ASBITSTREAM(InputRoot.MRM ENCODING InputRoot.MQMD.Encoding
CCSID InputRoot.MQMD.CodedCharSetId SET <mrm id> TYPE '<message name>' FORMAT 'XML');
CREATE LASTCHILD OF OutputRoot.XML DOMAIN('MRM')
PARSE(tempBlob OPTIONS
BITOR(ValidateContent, ValidateException, ValidateComplete, ValidateFullConstraints)
ENCODING InputRoot.MQMD.Encoding CCSID InputRoot.MQMD.CodedCharSetId SET <mrm Id> TYPE '<message name>' FORMAT 'XML');
SET OutputRoot.XML = NULL;
RETURN TRUE;
END;
END MODULE; |
Connect the failure and catch terminals of the MQInput node to an error flow to handle the error where you can access the InputExceptionList
Alan |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|