LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can a Messenger Channel have multiple readers and writers?

Solved!
Go to solution

I get that Messenger Channels can have multiple writers but will multiple readers on the same Channel work too? 

Here's a simplified example of what I am asking

chsnipCapture.PNG

I believe the loops should just ignore any messages that they are not programmed to handle. 

Or will there be a race condition where the first loop to dequeue the message gets it but the others don't even see it?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 7
(637 Views)
Solution
Accepted by topic author RTSLVU

It seems to work like a queue, so each enqueued element can only be dequeued once.

 

If you want each reader to get a copy I think you need the Event Messenger channel type and its interesting dataflow requirements.

avogadro5_6-1779212075040.png

 

 

 

avogadro5_3-1779211669057.png

 

 

0 Kudos
Message 2 of 7
(611 Views)

Damn you are right, I just ran a quick test and the Messenger Channels act like a Queue with multiple readers there's a race condition dequeuing the channel and only the first "reader" to dequeue the message gets it. 

 

Oh well I just wanted to save some wires on my block diagram.  

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 7
(597 Views)

Event MessengerM Channel Wire Toolkit for LabVIEW - Download - VIPM by JKI

you can specify the receiver by an integer or string using that toolkit.

CLA
Message 4 of 7
(512 Views)

I will give that a look for my next project. At first glance though I'm not sure if it will work for this project without a lot of rewriting code. My architecture is basically a QMH but with Messenger channel wires. My message contains a text "command" for the state machine in the receiving loop and an optional variant payload.   

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 7
(496 Views)

Your usecase is exactly what this was created for.

CLA
Message 6 of 7
(488 Views)

@RTSLVU wrote:

Damn you are right, I just ran a quick test and the Messenger Channels act like a Queue with multiple readers there's a race condition dequeuing the channel and only the first "reader" to dequeue the message gets it.


If you dig into the generated Channel VIs, you will find that it is mostly just a wrapped up queue. So this behavior makes complete sense.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 7
(480 Views)