The xpamb program can act as a "classical" message bus interface between clients and servers. A client can send a data request to the message bus, which then interfaces with multiple servers and returns the data back to the client.
A "classical" message bus (such as ToolTalk) consists of servers and clients, along with a mediating program that transfers data between different processes. XPA takes a slightly different approach in that communication between clients and servers is direct. This generally is the correct technique when there is only one connection (or even a small number of connections), but can become inefficient for the serving program if a large amount of data is being transferred to many clients. For example, if a real-time data acquisition program is broadcasting a FITS image to several clients, it would need to transmit that image to each client individually. This might interfere with its own processing cycles. The preferable mechanism would be to pass the image off to an intermediate program that can then broadcast the data to the several clients.
The xpamb program can alleviate such problems by functioning as a message bus in cases where such an intermediary process is wanted. It pre-defines a single access point named XPAMB:xpamb to which data can be sent for re-broadcast. You also can tell xpamb to save the data, and associate with that data a new access point, so that it can be retrieved later on.
All interaction with xpamb is performed through xpaset and xpaget (or the corresponding API routines, XPASet() and XPAGet()) to the XPAMB:xpamb access point. That is, xpamb is just another XPA-enabled program that responds to requests from clients. The paramlist is used to specify the targets to which the data will be for re-broadcast, as well as the re-broadcast paramlist:
data | xpaset xpamb [switches] broadcast-target broadcast-paramlistOptional switches are used to store data, and manipulate stored data, and are described below.
In its simplest form, you can, for example, send a FITS image to xpamb for broadcasting to all SAOtng image simply by executing:
cat foo.fits | xpaset xpamb "SAOTNG:*" fits foo.fitsSince SAOTNG is the class name for the SAOtng image display program, this will result in the FITS image being re-sent to all fits access points for all active image display programs. The optional switches are used to save data and manipulate the saved data:
xpaget xpamb foo -info(along with other information such as the date/time of storage and the size of the data buffer) if the -info switch is specified.
Switches can be used in any combination that makes sense. For example:
cat foo.fits | xpaset xpamb -save foo -info "FITS" "SAOTNG:*" fits foo.fitswill broadcast the foo.fits image to all access points of class SAOTNG. In addition, the foo.fits file will be saved under the name of foo for later manipulation such as:
xpaset -p xpamb -send foo "DS9:*" fits foo.fitswill re-broadcast the foo.fit image to all access points of class "DS9".
You can send stored data and new data to the same set of access points at the same time. The stored data always is send first, followed by the new data:
cat foo2.fits | xpaset xpamb -send foo "SAOTNG:*" fits foo.fitswill first send the foo.fits file, and then the foo2.fits file to all access points of class SAOTNG. Notice that in this example, the foo2.fits file is not saved, but it could be saved by using the -add [name] switch on the command line.
The xpaget command can be used to retrieve a stored data buffer, or retrieve information about a stored data buffer. If no arguments are given:
xpaget xpambthen information about all currently stored data buffers is returned. This information includes the data and time at which the data was stored, the size in bytes of the data, and the supplied info string.
If the -info switch is used with a specific name:
xpaget xpamb foo -infothen the info about that stored data buffer will be returned.
If no switch is used with a specific name:
xpaget xpamb foothen the stored data itself will be returned.