Public Responses

Worker APIs

Overview

Purpose
Message Type
Icon Glyph
File Prefix

Send message to Caller from Worker

Asynchronous

rsp_

Public Response Purpose

A Public Response is a message that can be sent to a Caller from a Worker, however, the Caller must first register to receive the Response message from the Worker.

A Public Response is a message that can be sent to a Caller from a Worker

Public Response usage example

The image below demonstrates the use of a Public Response VI sending a message from a MHL case of Worker B to a MHL case of Worker A. Worker B doesn't know which case of the Caller the Response message will be sent to. It is up to the Caller, when initializing Worker B, to register the Response message, providing the Caller's MHL case that will receive the Response message to Worker B.

Worker B : Main.vi - Public Response VI example

Public Response VI

A Public Response VI is required to be wired in-line with a Worker's Main Data Wire, as shown in the block diagram image above. The Public Response VI will send a message to the Worker's Caller, IF the Caller has registered to receive the Response message.

Every Public Response VI filename takes the prefix: rsp_ (response). Every Public Response VI icon contains a pink glyph in its bottom-right corner. An example of a Public Response VI is shown below.

Worker B : rsp_Return Number.vi

Data in

Data that will be sent along with the message. By default, this is a typedef that has the same filename as the Public Response VI.

Message Priority

The priority of the message (default is Normal) can be set to either Low, Normal or High.

Show in Debugger?

When this flag is TRUE, then meta-data about this message will be sent to the Workers Debug Server.

Public Response VTD VI

Every Public Response is created with a VTD VI. This VI is used by a Worker's Caller to convert the data sent with the Response message to its specific data type. This VI is placed in the registered Public Response MHL Case of the Caller.

Every Public Response VTD VI filename takes the prefix: rspvtd_ (response variant to data). Every Public Response VTD VI icon contains a pink rectangular glyphin its bottom-right corner. An example of a Public Response VTD VI is shown below.

Worker B : rspvtd_Return Number.vi

Data in

Variant data that was sent along with the Response message.

Data out

The strictly typed data that was sent along with the response message. By default, this is a typedef that has the same filename as the Public Response VI.

Public Response Typedef

Public Response typedefs are created with the same icon and filename as their matching Public Response VI. Their purpose is to provide a custom container (cluster) for the data that will be sent along with the message to the Public Response's registered MHL case of the Caller.

Public Response MHL Cases

The MHL case that will receive a Public Response message exists in the Worker's Caller. A Caller must register to receive a Response message from a subWorker. The image below shows a MHL case in Worker A that will receive a Response message from Worker B. MHL cases that are created to receive a Response message will be added to the Worker's case structure section called --- RESPONSE CASES ---. To convert the data sent with the Response message to its specific data type, a Response VTD (Variant to Data) VI is used at the beginning of every registered Response MHL case.

Worker A : Main.vi - registered Response MHL cases

Public Response Folders

Public Response VIs created by the Public API Builder tool are added to a Worker's Local API >> Responses folder. Their scope is set to protected because they are designed to be used only from within the Worker that owns them.

Public Response VTD VIs are added to a Worker's Public API >> Response VTDs folder. Their scope is set to public because they are designed to be used from a Worker's Caller.

Public Response folder structure within a Worker

Response Cases.ctl

A Public Response requires the name of the Caller's MHL case to be passed into the Worker through the Worker's Initialization Data.ctl. This process occurs when a Worker's Public Response is registered with the Worker's Caller.

Every time a new Public Response is created with the Public API Builder tool, a Case Label string control will be added automatically to the Worker's Response Cases.ctl typedef. The image below shows all of the Case Label string controls that have been added to a Worker's Response Cases.ctl typedef.

A Worker's Response Cases.ctl, used to register a Worker's Public Responses with a Caller

Every new Worker and Worker base class (Workers 5.0 onwards) wires a Worker's Response Cases.ctl from a Worker's Initialization Data.ctl typedef to the Response Cases.ctl contained within the Worker's Main Data Wire. Without this transfer of information to the Worker's Main Data Wire, the Public Response VIs won't have the required data to know which of the Caller's MHL cases to send the Public Response messages to.

Transferring a Caller's registered Response MHL Cases into a Worker.

Last updated