ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker (ACE) SupportMQSI/WMQI Multiply Node

Post new topicReply to topic
MQSI/WMQI Multiply Node View previous topic :: View next topic
Author Message
jamoreland
PostPosted: Tue May 17, 2005 3:15 am Post subject: MQSI/WMQI Multiply Node Reply with quote

Newbie

Joined: 16 May 2005
Posts: 1

The Multiply Node (which does the opposite of the Aggregator plugin) is an unsupported primitive node. Does anyone have the source code for the node. It should have a ".c" and a ".h" file minimum. I would like to try rebuilding it for the release we're moving to (first 2.1 CSD4 then CSD8)


Jim
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue May 17, 2005 3:24 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What does this node do that PROPAGATE doesn't?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Tibor
PostPosted: Tue May 17, 2005 6:33 am Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

Jim,
multiply_node.zip sent.

Jeff,
It was a "before PROPAGATE" custom node.

Tibor
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue May 17, 2005 6:37 am Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Tibor wrote:
Jeff,
It was a "before PROPAGATE" custom node.


I understood that.

If it does nothing that PROPAGATE doesn't, then I wouldn't use it - custom nodes are a lot of overhead.

If it does SOMETHING that PROPAGATE doesn't, then... I'm intrigued, and want to know what!
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Tibor
PostPosted: Tue May 17, 2005 8:50 am Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

Jeff,

I'd also recommend the command propagate, because I personally prefer a native ESQL code.

This is the contents of readme.txt:
Quote:
**** Multiply Node

** Author: Greg Brail (brail@us.ibm.com)

** Summary

The Multiply node provides a simple mechanism for turning a single input message
into multiple output messages. The number of copies of the message can be set
statically or dynamically.

** Description and Rationale

A number of MQSI customers have tried to use the product in a “one to many”
design pattern. For instance, the results of a database select will be used to
generate a single output message for each row in the database result set, or a
single input message may consist of an array, and MQSI must break this message
in to multiple output messages, one for each array element.

For instance, an input message might consist of an array, and MQSI may be
required to produce an output message for each array element. Using the built-in
processing nodes in MQSI, one can solve this problem using four nodes:

1) A Compute node is used to set a temporary variable (ideally in the
DestinationList) that stores the number of elements in the array. This should
be a numeric field, but this step may be unnecessary if the count is already
in the message. This node also sets an increment variable to 1.
2) A Filter node tests if the increment variable is less than or equal to the
repeat count. The “true” terminal of this node is wired to nodes 3 and 4 in
this example (the terminal must be connected to both nodes). The “false”
terminal could be used to pass the original message on to the rest of the
message flow for “finishing up” if desired.
3) A Compute node increments the increment variable by one, and passes it back
to the input terminal of the Filter node (node 2).
4) Another Compute node creates a new copy of the original message, but only
containing the single array element that is desired.

This solution works, but it has two problems.

First, this design pattern results in a crash of the MQSI broker if the loop is
repeated too many times. Every time a node propagates a message to an output
terminal, a function call is made. In this example, nodes 2 and 3 will loop.
Each loop causes the stack to grow. Eventually, the stack overflows (because
multi-threaded programs generally have fixed-size stacks), and the broker
crashes.

Second, the output from node 4 may be in reverse order. If the Filter node
passes its “true” output to the last Compute node (node 4) first, then the
messages will appear in normal order. However, if the “true” output calls the
increment node (node 3) first, then the output will be in reverse order. There
is no way for a user to determine the order in which these terminals will be
called, so the resulting order will be arbitrary.

The Multiply node works like this:

1) If necessary, a Compute node sets the number of array elements in an integer
field in the message.
2) The message is passed to the Multiply node. This node propagates the message
to its “out” terminal once for each count set in the count field that was set
by node 1. An increment field is added to the message to contain the index of
each output message. Finally, the original message is propagated to a “done”
terminal for additional processing if necessary.
3) A Compute node will be invoked once for each time the Multiply node
propagates a message. This node makes a new message containing only the array
element in question by using the increment count set by the Multiply node.

Using the Multiply node, the same solution takes fewer nodes. Also, the message
flow can handle an arbitrary number of iterations without crashing.

Both solutions should have similar performance. Both solutions create the same
number of copies of the message if used correctly. That is, there should be one
copy per iteration, but this goes to the final Compute node, which should copy a
single array element rather than the entire input message. Arguably, the
Multiply node does not work out the SQL engine as much, so it should be a little
faster.

** Multiply node terminals

? “in”: The input terminal.
? “out”: This output terminal receives one copy of the input message for each
iteration of the loop.
? “done”: This output terminal receives one copy of the original input message
after all the copies of the message have been propagated to the “out”
terminal.
? “failure”: The original message is passed to this terminal if there is a
failure (and if it is connected).

** Multiply node attributes

? “CountType”: This can have two values: “Static” or “Dynamic”. This determines
if the message will be propagated a fixed number of times, or according the
value of a field in the message.
? “CountFieldName”: If CountType is set to “Static”, then this should contain
an integer indicating the number of times to iterate. If it is set to
“Dynamic”, then this should contain the name of an integer field which will
be used to set the iteration count. If the field does not exist, or if it is
not an integer field, then the iteration count will be set to zero. The name
uses the usual MQSI naming conventions, and may begin with “Root”, “Body”,
“ExceptionList”, or “DestinationList”.
? “IndexFieldName”: A field of this name will be created in the message sent to
the “out” terminal, and set to the number of the current iteration through
the loop. If this field already exists, the message will not be propagated.
Otherwise, it will be created and set for each iteration.
? “CopyMode”: This indicates whether the message (Root), exception list, or
destination list of the message will be copied. One copy of this part of the
message will be made, the “IndexFieldName” field will be created there once,
and the value will be changed for each iteration through the loop. This field
should match the value of “IndexFieldName”. For best results, set this to
“DestinationList” or “ExceptionList”.

** Example

For example, a message flow may contain an integer field called
“Root.MRM.ArraySize”, and an array called “Root.MRM.Array”. The Multiply node
could be used like this:

CountType = Dynamic
CountFieldName = Body.ArraySize
IndexFieldName = DestinationList.Tmp.Increment
CopyMode = DestinationList

Depending on the value of “Root.MRM.ArraySize”, the Multiply node will propagate
the message multiple times to the node attached to the “out” terminal. For
instance, this terminal could be a Compute node with the following expression:

-- First, copy the header fields ONLY using the GUI feature
SET OutputRoot.MRM.ArrayElement =
InputBody.Array[InputDestinationList.Tmp.Increment];


Tibor
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker (ACE) SupportMQSI/WMQI Multiply Node
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.