tppost
-post an event
#include <atmi.h>
int tppost(char *eventname, char *data, long len, long flags)
The caller uses tppost
to post an event and any accompanying data. The event is named by eventname
and data
, if not NULL, points to the data. The posted event and its data are dispatched by the BEA TUXEDO system event broker to all subscribers whose subscriptions successfully evaluate against eventname
and whose optional filter rules successfully evaluate against data
.
eventname
is a NULL-terminated string of at most 31 characters. eventname
's first character cannot be a dot (".") as this character is reserved as the starting character for all events defined by the BEA TUXEDO system itself.
If data
is non-NULL, it must point to a buffer previously allocated by tpalloc
(3) and len
should specify the amount of data in the buffer that should be posted with the event. Note that if data
points to a buffer of a type that does not require a length to be specified (for example, an FML fielded buffer), then len
is ignored. If data
is NULL, len
is ignored and the event is posted with no data.
When tppost
is used within a transaction, the transaction boundary can be extended to include those servers and/or stable-storage message queues notified by the event broker. When a transactional posting is made, some of the recipients of the event posting are notified on behalf of the poster's transaction (for example, servers and queues), while some are not (for example, clients).
If the poster is within a transaction and the TPNOTRAN
flag is not set, the posted event goes to the event broker in transaction mode such that it dispatches the event as part of the poster's transaction. The broker dispatches transactional event notifications only to those service routine and stable-storage queue subscriptions that used the TPEVTRAN bit setting in the ctl->flags
parameter passed to tpsubscribe
(3). Client notifications, and those service routine and stable-storage queue subscriptions that did not use the TPEVTRAN bit setting in the ctl->flags
parameter passed to tpsubscribe
(3), are also dispatched by the event broker but not as part of the posting process' transaction.
Following is a list of valid flags
.
TPNOTRAN
TPNOREPLY
tppost
not to wait for the event broker to process all subscriptions for eventname
before returning. When TPNOREPLY
is set, tpurcode
is set to zero regardless of whether tppost
returns successfully or not. When the caller is in transaction mode, this setting cannot be used unless TPNOTRAN
is also set.
TPNOBLOCK
tperrno
is set to TPEBLOCK
. When TPNOBLOCK
is not specified and a blocking condition exists, the caller blocks until the condition subsides or a timeout occurs (either transaction or blocking timeout).
TPNOTIME
TPSIGRSTRT
TPSIGRSTRT
is not specified and a signal interrupts a system call, then tppost
fails and tperrno
is set to TPGOTSIG
.
Upon successful return from tppost
, tpurcode
contains the number of event notifications dispatched by the event broker on behalf of eventname
(that is, postings for those subscriptions whose event expression evaluated successfully against eventname
and whose filter rule evaluated successfully against data
). Upon return where tperrno
is set to TPESVCFAIL
, tpurcode
contains the number of non-transactional event notifications dispatched by the event broker on behalf of eventname
. This function returns -1 on error and sets tperrno
to indicate the error condition.
Under the following conditions, tppost
fails and sets tperrno
to one of the following values. (Unless otherwise noted, failure does not affect the caller's transaction, if one exists.)
TPEINVAL
]
eventname
is NULL).
TPENOENT
]
TPETRAN
]
TPNOTRAN
was not set and tppost
contacted an event broker that does not support transaction propagation (that is, TMUSREVT
(5) is not running in a BEA TUXEDO system group that supports transactions).
TPETIME
]
TPNOBLOCK
nor TPNOTIME
were specified. If a transaction timeout occurred, any attempts to do new work will fail with TPETIME
until the transaction has been aborted.
TPESVCFAIL
]
tpurcode
contains the number of non-transactional event notifications dispatched by the event broker on behalf of eventname
; transactional postings are not counted since their effects will be aborted upon completion of the transaction. Note that so long as the transaction has not timed out, further communication may be performed before aborting the transaction and that any work performed on behalf of the caller's transaction will be aborted upon transaction completion (that is, for subsequent communication to have any lasting effect, it should be done with TPNOTRAN
set).
TPEBLOCK
]
TPNOBLOCK
was specified.
TPGOTSIG
]
TPSIGRSTRT
was not specified.
TPEPROTO
]
tppost
was called in an improper context.
TPESYSTEM
]
TPEOS
]
tpsubscribe
(3), tpunsubscribe
(3), EVENTS
(5), TMUSREVT
(5), TMSYSEVT
(5)