Split/Join with change of type

Dear noderaiders,

I found a tricky one and I'd like to get your advise on this one.

I want to process a UDP stream, I receive a stream of bytes and I want to produce a payload object.

A UDP message consists of a set of 3 different sub-messages that I process separately.
I SPLIT the UDP message in 3 chunks of bytes and process them. For each submessage, its chunk of bytes becomes a payload property, a different property for each submessage.
At the end, I'd love to JOIN all 3 sub messages by merging their payload properties.

Somehow, JOIN always fails to join all 3 sub messages and always spits out 2 messages (it only joins the first 2.) I tried all possible JOIN options.

I wonder if the issue could be caused by the fact that SPLIT works on a certain type of object (split a buffer in 3) and JOIN works on another type of object (merge properties of 3 message payloads.)

Does someone see a workaround to this?

(To move forward, I made my own custom function, temporarily storing portions of the message until I get all 3 portions, then let the message flow. But I'm not satisfy with the workaround.)

I have a test case flow if necessary.

Thank you in advance.

Best regards.

P.

Welcome to the forum @devleaks

Are you splitting and feeding the sub sections through nodes in parallel or feeding them one after the other through nodes in series?
Do the three parts have to be processed differently?
A screenshot of your flow might be helpful to see the layout. You can paste an image in here directly.

Thank you for your prompt reply. Here is the flow.

I forgot to say that I use 1.3.2, since it came ou earlier today.
I found a surprisingly interesting thing:

  • After the switch, if I only set one and only one payload value in each change node (Set speed, Set heading, Set altitude), it works! As soon as I add another payload value in the second change node (i.e. set two payload properties in Set heading), it stops working, only merging the first two, ignoring the third one...
    If I look at the output of each change node, it looks ok.

I think I got it... (see my last post).
JOIN waits for a "number of message parts", and it seems that each payload property counts as a "message part".
When I ask JOIN to wait for all (11) properties rather than all (3) messages, I get a single message after join.

Could someone confirm that this is the behavior?
Thank you.

Can you show us how you have configured the Join node?

Here it is.
If I put "3" in "A number of message parts", it seems to me that a message is sent each time it has that number of properties set in msg.payload. So I get two.
If I put "11" like I did (Set speed sets 1 value, Set heading sets 4 values, and set altitude sets 6), I only get one message.
If I put "1" in "A number of message parts", I get three messages.

Is that the expected behavior? A doc bug?
Thanks.

1 Like

Because you have selected merged object it works by merging all the properties in each payload together so it ends up with a payload with the properties of all the incoming messages. In that mode, message parts refers to the number of properties in the final payload.
If you had selected Key/Value Object mode then each message would count as a 'part'.

I'm not sure I understand.
Can I combine the three payloads into one with "Key/Value Object" mode? What do I have to set as a topic then?
Pierre

In the Change nodes give each of the messages a topic value and in the Join node select key/value mode. Then the payload will consist an object with three properties, which are the topic values, and in those will be the payload values.
this article in the cookbook has an example using the node in that way.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.