LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer to N Consumers notification

So many ideas, still I have one more to share (I was planning to write another P/C community nugget on multiple [>2] loops). You can code a 'multiplexer': Use a typdef'd enum and obtain the number of items via property node -> this is the number of output queues. Then use a for loop inside a while loop. In the outer while loop is the dequeue element, in the inner for loop there is the enqueue element; which is fed by the dequeued element from the outer loop. Each module accesses it's own queue via indexing with the typedefed enum.

For reporting back (data and errors), I still would go with the events I suggested (my community nugget), as I already would have the event structure in place on the UI loop.

 

Felix

0 Kudos
Message 11 of 16
(899 Views)

Could someone please post here the example code at : http://forums.openg.org/index.php?showtopic=991

 

I just registered but their system doesn't send me the activation email.

I would like to investigate the use of that notifier integrated into the message queue, bc I'm not able to get the idea about its use (is it sent upon insertion in the queue? why not upon de-queuing? where's the point?)

 

thanks for the numerous inputs, now I will try with doubling the queues and/or user events. I bet I will get a chockfull-wire diagram as usual 😞

0 Kudos
Message 12 of 16
(865 Views)

PS: If I'm undestanding right, the notifier integrated with openG messageQueue is quite useless in a general case because that notifier carries a string. So you can dequeue an element (at consumer level), make some operations, and then generate a notifier....passing a string like "Done". Then the producer has a "wait notifier" after the queue command operation, and so it can continue (or timing out) as soon as the notifier is generated at that particular consumer.

but then what do you do with a string? I guess nothing.... That notifier should carry variant data, so I could have plug a cluster of { error cluster, datas }.

0 Kudos
Message 13 of 16
(859 Views)

You can use strings the same way as variants using the flatten to string/unflatten from string functions.

 

Felix

0 Kudos
Message 14 of 16
(855 Views)

do you mean:

Consumer: dequeue -> operations... -> plug error out cluster into "flatten to string" -> connect this to generate notification, so the producer gets the error code.

 

It doesn't work bc:

1) in my LV2009 flatten to string an error cluster gives empty output

2) with unflatten to string I get a variant, and it is not compatibile with "variant to data" (passing a error cluster data type)

 

see attachment

0 Kudos
Message 15 of 16
(842 Views)

EDIT: ok it works. It seems that I picked up an old LV 7.x flatten to string function that is somehow obsolete.

There is another function with additional inputs and the corresponding unflatten version.

I post the complete example.

I think it is possibile to futher extend this by passing an arbitrary cluster of data (mimic "object") to be flattened for the notifier.

0 Kudos
Message 16 of 16
(835 Views)