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