Programming Guide



broadcast

Broadcasts a message to a client

Synopsis

broadcast [broadcastOption]... TYPE msgType (message)

Arguments

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 by client_init, which establishes the client connection. If you omit clientName, 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 by client_init.

If userName is not found on the system, this option is ignored and no error is raised. If you omit userName, all users receive the message.

TYPE msgType
Specifies the message's data type, where msgType is one of these values:

message
The message to broadcast. The message data must conform to the <TYPE>-specified data type.

Environment

JetNet, Oracle Tuxedo

Scope

Client, Server

Description

The broadcast command is used by the middleware to broadcast a message to all clients that match the criteria specified in broadcastOption. 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.

Exceptions

Execution of the broadcast command can raise the following exceptions:

Exception Severity Cause
TP_IDENTIFIER_TRUNCATED
TP_WARNING

clientName, lmid, or userName exceeds 30 characters.

TP_INVALID_ARGUMENT_LIST
TP_COMMAND

More than one argument is passed to message.

TP_MONITOR_ERROR
TP_COMMAND

Error reported from middleware.

TP_TIMEOUT
TP_COMMAND

Timeout condition occurs.

Example

// get the option menu choice and
// broadcast message accordingly
proc 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

See Also

client_init, notify, receive