|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Row count and discarding input message |
« View previous topic :: View next topic » |
Author |
Message
|
mmarq |
Posted: Wed Oct 30, 2002 6:30 am Post subject: Row count and discarding input message |
|
|
Acolyte
Joined: 19 Sep 2002 Posts: 74 Location: Newton, MA
|
Hi all,
I have two questions:
1. I'm doing a select att1, att2 from mytable and beyond getting the
values themselves, I'd like to see how many rows were returned.
Is there anyway to capture this? I don't see any database return
codes that I would be able to pick up.
2. After checking the message, I may need to discard the message and
stop processing. Ideally, send this to a failure queue midstream and stop processing. How can I do this?
Thanks,
Melissa _________________ M Marquis |
|
Back to top |
|
 |
lillo |
Posted: Wed Oct 30, 2002 6:50 am Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
Hi,
Q1: Use the CARDINALITY function after the select.
Q2: What do you mean by stop processing?
Cheers, _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
mmarq |
Posted: Wed Oct 30, 2002 7:18 am Post subject: follow up |
|
|
Acolyte
Joined: 19 Sep 2002 Posts: 74 Location: Newton, MA
|
Thanks!
Depending on what I get in the message, I may not need to do any further processing once I have examined it. So, I'd like to record that I got the message but it didn't matter to me and stop processing (e.g., the message flow would not continue and would pick up the next message in the queue) . _________________ M Marquis |
|
Back to top |
|
 |
kirani |
Posted: Wed Oct 30, 2002 5:20 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
If you want to discard the message then don't connect the out/true/false terminal of your Compute/Filter node, the message will be discarded automatically! _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
mmarq |
Posted: Thu Oct 31, 2002 6:42 am Post subject: Reply |
|
|
Acolyte
Joined: 19 Sep 2002 Posts: 74 Location: Newton, MA
|
Well, based on the message I may want to process it so I'd go out the out terminal or I may need to just record that I got something that is not applicable to the processing I'm doing and stop processing.
I've read lots of threads on this forum regarding just having attaching the CATCH terminal of the input node instead of having error handling at each failure terminal. So, I'd like to perhaps issue a THROW which (I believe but need to test) would go back to the CATCH terminal where the error handling specifies grabbing the input data, environment, exception list, write it and then log it to a failure queue.
Can I just have:
if (Environment.Variables.FOO is null) THEN
THROW .......
END IF;
To send back to the catch terminal which has an attached generic error handling sub flow that will write what happened and then stop processing.
Does this sound feasible?
Also, can I have my own "Catalog" of messages to use the THROW with and if so, is this a general good practice to do (or not)?
Thanks,
Melissa _________________ M Marquis |
|
Back to top |
|
 |
kirani |
Posted: Thu Oct 31, 2002 9:39 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
well... you could use Code similar to following in a filter node to check whether the message should be processed or not,
IF (Environment.Variables.FOO is NULL) THEN
return false;
ELSE
return true;
END IF;
Attach a Trace node to the false terminal of your Filter node, you could log info about "unwanted message" in this Trace node. After logging info your message will be discarded automatically.
If you get the correct message the condition will become true and your message will be propagated thru True terminal of your filter node, in this path you could process your "normal" message.
I hope this helps! _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
mmarq |
Posted: Sun Nov 03, 2002 5:10 am Post subject: Reply |
|
|
Acolyte
Joined: 19 Sep 2002 Posts: 74 Location: Newton, MA
|
Thanks very much for the reply.
I've been trying to avoid the trace nodes at every failure terminal of my compute nodes for sanity's sake. I do have a generic subflow for tracing but it still looks a bit busy. So I've attached a single generic exception handler to my Input node's catch terminal that grabs the environment tree, logs it to a file, and ships it to a a FAILURE queue.
IF (Environment.Variables.FOO is NULL) THEN
THROW USER EXCEPTION CATALOG 'TestException' MESSAGE 100 VALUES('Test Exception Level 100 occurred during ',
Environment.Variables.CURRENTNODE, 'Message: <message>', "InputBody"."OFC_NO",
' ', "InputBody"."FC_NO", ' ', "InputBody"."ML_AC_NO", ' ', "InputBody"."ROW_LUP_TS", ' ', "InputBody"."AC_WEB_LOG_CRT_TS",
' ', "InputBody"."CLI_CAPC_SQ_NO", ' ', "InputBody"."CLI_NCAPC_SBSQ_NO");
return false;
ELSE
return true;
END IF;
I'm not sure I need 'return false' in the above code but my hope is that the throw will send me all the way back to the Input node catch terminal and log the exception as mentioned above as well as issue the rollback (this is in my generic exception handler subflow).
Does the above code and the explaination of the behavior sane?
It sounds like 'return false' will always go out the failure terminal(?)
Thanks,
Melissa _________________ M Marquis |
|
Back to top |
|
 |
kirani |
Posted: Sun Nov 03, 2002 6:59 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
return false in a compute node will not propagate the message at all. You don't need return false in your compute node after the THROW statemnt.
Your logic looks ok .. but again it depends on your requirement, if you get unwanted messages and if you want to handle them like failure messages .. then this logic looks perfect!! _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
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
|
|
|
|