Arve, Here is the same example as shown in the Event Service User's Guide except that all STAF commands are being submitted via the command line using the STAF executable instead of being submitted via a Java program. The following three machines will be used in this example: - lucas.austin.ibm.com: Is the Event service machine (e.g. the machine where the Event service is registered in its STAF.cfg file) - staf6e.austin.ibm.com: Is a machine that registers to be notified when an event with type "build" is generated by the Event service machine - staf1e.austin.ibm.com: Is a machine that submits a request to the Event service machine to generate an event with type "build"
1) Machine staf6e's MyTestHandle registers with the Event service machine (lucas) to be notified for events with type "build": So, first on staf6e, since this example is from the command line, I'll create a static STAF handle to use for this test and set environment variable STAF_STATIC_HANDLE to this handle so that the STAF requests that I submit from this terminal will be submitted using this STAF handle (instead of the STAF executable creating a new STAF handle each time it is called). staf6e:~ root# STAF local HANDLE CREATE HANDLE Name MyTestHandle Response -------- 736 staf6e:~ root# export STAF_STATIC_HANDLE=736 Then handle MyTestHandle on machine staf6e registers with the Event service machine (lucas) to be notified for events with type "build". It will be notified by handle name (which is the default), not by handle number. staf6e:~ root# STAF lucas EVENT REGISTER TYPE build Response -------- To show the registration(s) for event type "build" on the Event service machine (lucas), you can list the registrations as follows: staf6e:~ root# STAF lucas EVENT LIST REGISTRATIONS TYPE build Response -------- Type Subtype Machine Notify By Notifiee ----- ------- -------------------------------- --------- ------------ build <None> ssl://staf6e.austin.ibm....@6550 Name MyTestHandle 2) Machine staf6e's MyTestHandle waits for a message with type "STAF/Service/Event" to be sent to its queue: The handle we created named MyTestHandleMachine on machine staf6e submits a local request to wait indefinitely for a message with type "STAF/Service/Event" to be sent to its queue. Note that every STAF handle has a queue associated with it. staf6e:~ root# STAF local QUEUE GET WAIT TYPE STAF/Service/Event This request will not complete until it receives a message with TYPE "STAF/Service/Event" on its queue (since I didn't specify a maximum wait time for the WAIT option). Note that you could submit this request after the event is generated instead of before the event is generated. It doesn't matter. 3) Machine staf1e generates an event with type build and subtype win32 on the Event service machine lucas: Note that the event service machine (lucas) must give machine staf1e.austin.ibm.com trust level 4 or greater as that's the trust level that it requires to submit a GENERATE request to the Event service. [r...@staf1e ~]# STAF lucas EVENT GENERATE TYPE build SUBTYPE win32 Response -------- 2 This triggers the Event service machine (lucas) to send a "STAF/Service/Event" type message to MyTestHandle's queue on machine staf6e. 4) The message arrives on MyTestHandle's queue on machine stat6e: The "STAF local QUEUE GET WAIT TYPE STAF/Service/Event" request previously submitted on machine staf6e completes when the message arrives on its queue: staf6e:~ root# STAF local QUEUE GET WAIT TYPE STAF/Service/Event Response -------- { handle : 6 handleName : STAF/SERVICE/Event machine : ssl://lucas.austin.ibm....@6550 message : { eventID : 2 eventServiceName: Event handle : 509 handleName : STAF/Client machine : ssl://staf1e.austin.ibm....@6550 propertyMap : {} subtype : win32 timestamp : 20101014-13:35:55 type : build } priority : 5 staf-map-class-name: STAF/Service/Queue/Entry timestamp : 20101014-13:26:23 type : STAF/Service/Event user : none://anonymous } -------------------------------------------------------------- Sharon Lucas IBM Austin, luc...@us.ibm.com (512) 286-7313 or Tieline 363-7313 From: Arve Knudsen <arve.knud...@gmail.com> To: Sharon Lucas/Austin/i...@ibmus Cc: staf-users@lists.sourceforge.net Date: 10/14/2010 12:55 PM Subject: Re: [staf-users] How do I receive an event from another machine? Hi Sharon I've now looked at the example, although it really showcases event propagation between two processes on the same machine rather than on two different machines. It looks quite similar to what I've been trying to do on the commandline however. Could you please provide a condensed commandline example that I can try out for myself, and see that it actually works? Thanks! Arve On Thu, Oct 14, 2010 at 6:12 PM, Sharon Lucas <luc...@us.ibm.com> wrote: The Event Service User's Guide at http://staf.sourceforge.net/current/event.pdf provides a working example in section "Example 1: Using the Event Service Via Two Java Applications" that includes registering for events, generating events, and and receving event messages on a STAFHandle's queue. Does that provide what you're looking for? -------------------------------------------------------------- Sharon Lucas IBM Austin, luc...@us.ibm.com (512) 286-7313 or Tieline 363-7313 From: Arve Knudsen <arve.knud...@gmail.com> To: staf-users@lists.sourceforge.net Date: 10/14/2010 10:58 AM Subject: [staf-users] How do I receive an event from another machine? Hello Can someone please provide me with a working example of how machine A can register for an event at machine B, and receive it etc.? I've tried and tried and can't seem to figure out how to make it work. Thanks! Arve ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users