Programming Guide |
Broadcasts a message to a client
broadcast [broadcastOption
]... TYPEmsgType
(message
)
broadcastOption
- One or more of the following options:
CLIENT [
clientName
]
- Identifies the client to receive the message, where
clientName
can be up to 30 characters long. A client's name is set byclient_init
, which establishes the client connection. If you omitclientName
, all clients receive the message.LMID
lmid
- Specifies the logical ID of a machine to get the broadcast, where
lmid
can be up to 30 characters long. (Oracle Tuxedo only)NOTIMEOUT
- Disregards the blocking timeout. Transaction timeouts remain in effect.
USER [
userName
]
- Identifies the user to receive the message, where
userName
can be up to 30 characters long. A client's user name is set byclient_init
.If
userName
is not found on the system, this option is ignored and no error is raised. If you omituserName
, all users receive the message.TYPE
msgType
- Specifies the message's data type, where
msgType
is one of these values:
JAMFLEX
For more information on message data types, refer to "Service Messages and Data Types" in JetNet/Oracle Tuxedo Guide.
message
- The message to broadcast. The message data must conform to the
<TYPE>
-specified data type.
JetNet, Oracle Tuxedo
Client, Server
The
broadcast
command is used by the middleware to broadcast a message to all clients that match the criteria specified inbroadcastOption
. Clients and servers can broadcast a message to other clients. If no options are specified, the message is broadcast to all clients.For example, the following command broadcasts a
JAMFLEX
-type message to client supervisor. It uses source to identify itself as the source of the message:broadcast CLIENT "supervisor" TYPE JAMFLEX \
({source="broadcast_security", ACCOUNT=acct, DATE=date,\
SECURITY=code, MSG=message})Messages delivered via broadcast are unsolicited. In order for unsolicited messages to be interpreted correctly by agents receiving them, a message handler must be installed. Because the handler is unaware of a message's origin, it is important that a standard method of identifying the source of unsolicited messages be established for the entire application. For more information on writing a message handler for your application, refer to "Message Handlers" in JetNet/Oracle Tuxedo Guide.
Execution of the
broadcast
command can raise the following exceptions:
// get the option menu choice and
// broadcast message accordinglyproc brdcast_to()
if opt_mnu == "All"
{
broadcast (message)
}
else if opt_mnu == "Customers"
{
broadcast USER "Customer" (message)
}
else if opt_mnu == "Employees"
{
broadcast USER "Employee" (message)
}
else if opt_mnu == "Select Customer"
{
send BUNDLE "scr_title" DATA opt_menu
call sm_jwindow(&get_name)
receive BUNDLE "name" DATA cust_last_name
broadcast USER "Customer" CLIENT cust_last_name (message)
}
else if opt_mnu == "Select Employee"
{
send BUNDLE "scr_title" DATA opt_menu
call sm_jwindow(&get_name)
receive BUNDLE "name" DATA emp_last_name
broadcast CLIENT emp_last_name (message)
}
return 0