Handling Unrecognized Messages
When designing a Queued Message Handler (QMH) that takes in multiple inputs, there is the chance that you receive messages that do not map to a designated case. To avoid producing errors, ensure all Case structures in an MHL have a
Default message diagram. The code in the Default message diagram executes when the MHL reads a message that does not have a corresponding message diagram. Having a Default message diagram is important because messages are strings that are entered while programming or during UI, not values you select from an enum.
Ignoring Errors when Reading from the Message Queue
- From the Project Explorer window, open Message Queue.lvlib:Dequeue Message.vi and display the block diagram.
- Find the Case structure nested inside the Error case
- To ignore errors when reading from the message queue, add error codes to the case selector label of the nested Case structure.
- The errors to ignore depend on your application. For example, if you are reading the queue over a network, you might want to ignore timeout errors.