Or, you can use the KEY option when starting a process. The key is
included in the STAF/Process/End notification message. So, you can use a
specific key for one set of processes and another key for another set of
processes and check the key in the STAF/Process/End notification message
after each QUEUE GET request.
Or, note that when using the NOTIFY ONEND option on a PROCESS START
request, you can specify an additional option on what handle number (via
the NOTIFY ONEND HANDLE <Handle#>) or handle name (via the NOTIFY ONEND
NAME <HandleName> to send the notification to (otherwise, it defaults to
sending the STAF/Process/End message to the handle that submitted the
process). See the STAF User's Guide for more information on these
options.
Note that if you don't want a notification message for a process, don't
specify the NOTIFY ONEND message.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, [EMAIL PROTECTED]
(512) 838-8347 or Tieline 678-8347
David Bender/Austin/[EMAIL PROTECTED]
10/23/2008 01:07 PM
To
staf-users@lists.sourceforge.net
cc
[EMAIL PROTECTED]
Subject
Re: [staf-users] Queue service question
You will probably need to keep track of the handle numbers that get
returned from the PROCESS START NOTIFY ONEND requests, and check the
incoming messages on the queue to determine if the message's request
number is one that you are interested in.
If you are really doing these requests from the command line, then you
could use different static handles, such as:
# Create a static handle and submit 2 process start requests
$ STAF local HANDLE CREATE HANDLE NAME MyHandle1
Response
--------
23
$ export STAF_STATIC_HANDLE=23
$ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT NOTIFY ONEND
Response
--------
24
$ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT NOTIFY ONEND
Response
--------
25
# Create a second static handle and submit 2 process start requests
$ STAF local HANDLE CREATE HANDLE NAME MyHandle2
Response
--------
26
$ export STAF_STATIC_HANDLE=26
$ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT NOTIFY ONEND
Response
--------
27
$ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT NOTIFY ONEND
Response
--------
28
# Use the first static handle and submit a queue get, notice we get the
queued message for process handle 24
$ export STAF_STATIC_HANDLE=23
$ STAF local QUEUE GET WAIT 5000
Response
--------
{
Priority : 5
Date-Time : 20081023-12:58:51
Machine : local://local
Handle Name: STAF_Process
Handle : 1
User : none://anonymous
Type : STAF/Process/End
Message : {
endTimestamp: 20081023-12:58:51
fileList : [
{
data: The current date is: Thu 10/23/2008
Enter the new date: (mm-dd-yy)
rc : 0
}
]
handle : 24
key :
rc : 1
}
}
# Use the second static handle and submit some queue gets, notice we get
the queued messages for process handles 27 and 28
$ export STAF_STATIC_HANDLE=26
$ STAF local QUEUE GET WAIT 5000
Response
--------
{
Priority : 5
Date-Time : 20081023-12:59:25
Machine : local://local
Handle Name: STAF_Process
Handle : 1
User : none://anonymous
Type : STAF/Process/End
Message : {
endTimestamp: 20081023-12:59:25
fileList : [
{
data: The current date is: Thu 10/23/2008
Enter the new date: (mm-dd-yy)
rc : 0
}
]
handle : 27
key :
rc : 1
}
}
$ STAF local QUEUE GET WAIT 5000
Response
--------
{
Priority : 5
Date-Time : 20081023-12:59:26
Machine : local://local
Handle Name: STAF_Process
Handle : 1
User : none://anonymous
Type : STAF/Process/End
Message : {
endTimestamp: 20081023-12:59:26
fileList : [
{
data: The current date is: Thu 10/23/2008
Enter the new date: (mm-dd-yy)
rc : 0
}
]
handle : 28
key :
rc : 1
}
}
$ STAF local QUEUE GET WAIT 5000
Error submitting request, RC: 37
# Now switch back to the first static handle and submit some queue gets,
notice we get the queued message for process handle 25
$ export STAF_STATIC_HANDLE=23
$ STAF local QUEUE GET WAIT 5000
Response
--------
{
Priority : 5
Date-Time : 20081023-12:58:52
Machine : local://local
Handle Name: STAF_Process
Handle : 1
User : none://anonymous
Type : STAF/Process/End
Message : {
endTimestamp: 20081023-12:58:52
fileList : [
{
data: The current date is: Thu 10/23/2008
Enter the new date: (mm-dd-yy)
rc : 0
}
]
handle : 25
key :
rc : 1
}
}
$ STAF local QUEUE GET WAIT 5000
Error submitting request, RC: 37
David Bender
STAF/STAX Development
8-1268 (512-838-1268)
IBM Austin Bldg. 903-5B002
Internet: [EMAIL PROTECTED]
Arvind Chandra <[EMAIL PROTECTED]>
10/23/2008 12:04 PM
Please respond to
[EMAIL PROTECTED]
To
staf-users@lists.sourceforge.net, David Bender/Austin/[EMAIL PROTECTED]
cc
Subject
Re: [staf-users] Queue service question
Hi David,
Thanks for the response. I now have a followup question again about
queues.
This is my scenario. I launch 4 processes in async mode with notify
onend option using process service. Then I run staf local queue get wait
<timeout>
But immediately after that I launch 4 other processes in async mode
with notfiy onend option using process service. Then I run staf local
queue get wait <anothertimout>
How do I ensure that process launched in the second set not end up
getting into first queue.
Thanks,
Arvind
--- On Wed, 10/22/08, David Bender <[EMAIL PROTECTED]> wrote:
> From: David Bender <[EMAIL PROTECTED]>
> Subject: Re: [staf-users] Queue service question
> To: staf-users@lists.sourceforge.net
> Cc: [EMAIL PROTECTED]
> Date: Wednesday, October 22, 2008, 2:16 PM
> You can use the QUEUE DELETE request to delete all messages
> in the queue.
> So for example:
>
> $ STAF local HANDLE CREATE HANDLE NAME MyHandle
> Response
> --------
> 198
>
> $ export STAF_STATIC_HANDLE=198
>
> # Execute a process with notify onend, and do a queue get
> wait
>
> $ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT
> NOTIFY ONEND
> Response
> --------
> 200
>
> $ STAF local QUEUE GET WAIT 5000
> Response
> --------
> {
> Priority : 5
> Date-Time : 20081022-16:09:58
> Machine : local://local
> Handle Name: STAF_Process
> Handle : 1
> User : none://anonymous
> Type : STAF/Process/End
> Message : {
> endTimestamp: 20081022-16:09:58
> fileList : [
> {
> data: The current date is: Wed 10/22/2008
> Enter the new date: (mm-dd-yy)
> rc : 0
> }
> ]
> handle : 200
> key :
> rc : 1
> }
> }
>
> # Now execute 3 processes with notify onend, and then do 4
> queue get waits
>
> $ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT
> NOTIFY ONEND
> Response
> --------
> 201
>
> $ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT
> NOTIFY ONEND
> Response
> --------
> 202
>
> $ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT
> NOTIFY ONEND
> Response
> --------
> 203
>
> $ STAF local QUEUE GET WAIT 5000
> Response
> --------
> {
> Priority : 5
> Date-Time : 20081022-16:11:39
> Machine : local://local
> Handle Name: STAF_Process
> Handle : 1
> User : none://anonymous
> Type : STAF/Process/End
> Message : {
> endTimestamp: 20081022-16:11:39
> fileList : [
> {
> data: The current date is: Wed 10/22/2008
> Enter the new date: (mm-dd-yy)
> rc : 0
> }
> ]
> handle : 201
> key :
> rc : 1
> }
> }
>
> $ STAF local QUEUE GET WAIT 5000
> Response
> --------
> {
> Priority : 5
> Date-Time : 20081022-16:11:40
> Machine : local://local
> Handle Name: STAF_Process
> Handle : 1
> User : none://anonymous
> Type : STAF/Process/End
> Message : {
> endTimestamp: 20081022-16:11:40
> fileList : [
> {
> data: The current date is: Wed 10/22/2008
> Enter the new date: (mm-dd-yy)
> rc : 0
> }
> ]
> handle : 202
> key :
> rc : 1
> }
> }
>
> $ STAF local QUEUE GET WAIT 5000
> Response
> --------
> {
> Priority : 5
> Date-Time : 20081022-16:11:40
> Machine : local://local
> Handle Name: STAF_Process
> Handle : 1
> User : none://anonymous
> Type : STAF/Process/End
> Message : {
> endTimestamp: 20081022-16:11:40
> fileList : [
> {
> data: The current date is: Wed 10/22/2008
> Enter the new date: (mm-dd-yy)
> rc : 0
> }
> ]
> handle : 203
> key :
> rc : 1
> }
> }
>
> # Now execute 3 processes with notify onend, and then do a
> queue get wait
> followed by a queue delete
>
> $ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT
> NOTIFY ONEND
> Response
> --------
> 204
>
> $ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT
> NOTIFY ONEND
> Response
> --------
> 205
>
> $ STAF local PROCESS START SHELL COMMAND date RETURNSTDOUT
> NOTIFY ONEND
> Response
> --------
> 206
>
> $ STAF local QUEUE GET WAIT 5000
> Response
> --------
> {
> Priority : 5
> Date-Time : 20081022-16:13:03
> Machine : local://local
> Handle Name: STAF_Process
> Handle : 1
> User : none://anonymous
> Type : STAF/Process/End
> Message : {
> endTimestamp: 20081022-16:13:03
> fileList : [
> {
> data: The current date is: Wed 10/22/2008
> Enter the new date: (mm-dd-yy)
> rc : 0
> }
> ]
> handle : 204
> key :
> rc : 1
> }
> }
>
> $ STAF local QUEUE DELETE
> Response
> --------
> 2
>
> $ STAF local QUEUE GET WAIT 5000
> Error submitting request, RC: 37
>
> # Notice that the result buffer of the QUEUE DELETE
> indicates that 2
> messages were deleted from the queue, and the subsequent
> QUEUE GET WAIT
> times out.
>
> David Bender
> STAF/STAX Development
> 8-1268 (512-838-1268)
> IBM Austin Bldg. 903-5B002
> Internet: [EMAIL PROTECTED]
>
>
>
>
> Arvind Chandra <[EMAIL PROTECTED]>
> 10/22/2008 03:43 PM
> Please respond to
> [EMAIL PROTECTED]
>
>
> To
> staf-users@lists.sourceforge.net
> cc
>
> Subject
> [staf-users] Queue service question
>
>
>
>
>
>
> Hi,
> This is my scenario. I issue 10 process commands with
> the options
> "notify onend" option on my local machine. Then I
> issue command
> staf local get wait <timeoutvalue>
>
> Now when 1st process finishes the queue command returns
> and that is
> expected. Then I examine the result of the completed
> process. After that I
> again issue the command
> staf local get wait <anothertimeoutvalue>
>
> Problem happens when multiple process finish. Now when
> I issue the
> command
> staf local get wait <anothertimeoutvalue>
> This is probably because it has the notification from
> the second
> completed process.
> Is there a way I can clear the queue before issuing
> the command
> again.
> Thanks,
> Arvind
>
>
>
>
>
-------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK
> & win great
> prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users