Merging message streams

Hi Node-REDers,

I want to download several email attachments and send them inside one email. Everything works so far.

I just want to ask you guys what the best solution would be to merge or provide several message streams to a single email function-node.

At this time I am sending as much messages with "node.send(msg);" as I provide mail attachments and I merge the messages with a join-node. The problem here is if the last attchments sends the msg.complete earlier than the first messages completes, because it's super lage and needs a bit longer to download, it is lost and does not get caught by the join-node.

You guys probably would do it in a smarter way. I am super happy about any advice and thanks in advance!

Ok the join-node needs to identify each message to be able to merge all messages in automatic mode. This even does not need a msg.complete. msg.parts.id and msg.topic just need to have a unique ID.

A simple example would be

//Send multiple messages and merge with a join-node
for (let i = 0 ; i<5; i++){
    msg.topc = msg._msgid;
    msg.parts = {
                    id: msg._msgid,
                    index: i,
                    count: 5,
    }
node.send(msg)
}

Fixed my problem but still, if you guys have a better, smarter solution please feel free to share

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