19.03.2015 Views

www.it-ebooks.info

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Development of Tuxedo – Various APIs<br />

Tuxedo provides an event-broker server called TMUSREVT. It helps to store the<br />

subscription <strong>info</strong>rmation as tpsubscribe() is being called; similarly, tppost()<br />

invokes <strong>it</strong> to post an event for the subscriber(s). In the case of unsolic<strong>it</strong>ed<br />

subscription, this server creates a message using tppost() and sends an unsolic<strong>it</strong>ed<br />

message to the clients that subscribed to that unsolic<strong>it</strong>ed event. Let us look at how<br />

we can subscribe, post, and unsubscribe from an event:<br />

• Subscribe to an event by name using the tpsubscribe() function. The<br />

event-expr argument is the name of one or more events, filterptr is the<br />

rule to select the specific event, ctlptr is the pointer to an event-control<br />

structure (<strong>it</strong> is NULL for unsolic<strong>it</strong>ed notifications), and the flags parameter is<br />

TPEVSERVICE, TPEVQUEUE, TPEVTRAN, or TPEVPERSIST. The tpsubscribe()<br />

function returns a handler for a specific subscription, which should be used<br />

for unsubscription.<br />

tpsubscribe – long tpsubscribe (char *event-expr, char<br />

*filterptr, TPEVCTL *ctlptr, long flags)<br />

• Post (in<strong>it</strong>iate or notify) an event by using tppost(). It posts an event<br />

identified by event-name; indata is the message you would like to pass to<br />

<strong>it</strong>s subscriber(s), length is the message length, and flags can have values<br />

TPSIGRSTRT, TPNOTRAN, TPNOREPLY, TPNOBLOCK, and TPNOTIME.<br />

tppost – tppost(char *event-name, char *indata, long length,<br />

long flags)<br />

• Unsubscribe from the event by using tpunsubscribe(). The subscription is<br />

a valid handler returned by tpsubscribe(). A client must use this function<br />

before <strong>it</strong> calls tpterm().<br />

tpunsubscribe –int tpunsubscribe (long subscription-name,<br />

long flags)<br />

So, there are two ways to use event-based communication, namely unsolic<strong>it</strong>ed client<br />

notification by using the tpnotify() and tpbroadcast() functions, and eventbroker<br />

server by using the tppost() and tpsubscribe() functions.<br />

Transaction in Tuxedo<br />

This is one of the most important sections in client/server arch<strong>it</strong>ecture. The<br />

foundation of Tuxedo ATMI is a proven, reliable transaction processor, also known<br />

as a Transaction Processing (TP) mon<strong>it</strong>or. This transaction processing has very<br />

unique characteristics consisting Atomic<strong>it</strong>y, Consistency, Isolation, and Durabil<strong>it</strong>y,<br />

also known as ACID.<br />

[ 90 ]<br />

<strong>www</strong>.<strong>it</strong>-<strong>ebooks</strong>.<strong>info</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!