To "get" messages off a queue you should be using the QUEUE service's GET 
request.

If  the queue is empty and you did not specify the WAIT option on your 
QUEUE GET request, it returns STAF RC 29 (No Queue Element) which is 
defined as follows:

C:\>STAF local HELP ERROR 29
Response
--------
Description: No queue element
Details    : This indicates that you tried to GET or PEEK a particular 
element i
n a queue, but no such element exists, or the queue is empty.

You can code for that.

However, as I told you before and as the examples I provided show, the way 
most people use it (and how STAF services's use it), is to do use the WAIT 
option with the GET request so that the QUEUE GET WAIT request will return 
when there is at least one message on the queue. or if you specified a 
time limit, it times out with STAF RC 37 (Timeout).

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   "Dedhia, Hardik" <hardik.ded...@netapp.com>
To:     Sharon Lucas/Austin/IBM@IBMUS
Date:   06/29/2011 01:47 PM
Subject:        RE: [staf-users] Type of MESSAGE in QUEUE



I tried the GET request initially but it returns unsuccessful if the QUEUE 
is empty or no messages to read.
 
I intend to achieve message oriented communication using asynchronously 
Queued messages.
 
Thanks,
 
Hardik. 
 
From: Sharon Lucas [mailto:luc...@us.ibm.com] 
Sent: Wednesday, June 29, 2011 2:44 PM
To: Dedhia, Hardik
Cc: staf-users
Subject: RE: [staf-users] Type of MESSAGE in QUEUE
 
To get messages off a queue, you should use the QUEUE service's GET 
request (with the ALL option if you want to get all messages off the 
queue), not the LIST and DELETE requests.  Note that between the time you 
submit a QUEUE LIST request and a QUEUE DELETE request, additional 
messages may have been added to the queue. 

See the STAF User's Guide for a description of the QUEUE service's GET 
request. 

And see the example that I previously sent you that use the QUEUE 
service's GET request.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        "Dedhia, Hardik" <hardik.ded...@netapp.com> 
To:        Sharon Lucas/Austin/IBM@IBMUS 
Date:        06/29/2011 01:37 PM 
Subject:        RE: [staf-users] Type of MESSAGE in QUEUE 




Thanks for that … 
 
I’m using QUEUE LIST to save queue contents in a resultPtr 
This is followed by a QUEUE DELETE. 
Then I use the resultPtr to operate on the messages found in the queue. 
 
I do LIST and DELETE sequentially not to lose delete messages which have 
been queued after the LIST request. 
 
But, I’m losing messages sometimes in an incoherent way. Is there some 
step which I am missing? 
 
Thanks, 
Hardik. 
  
From: Sharon Lucas [mailto:luc...@us.ibm.com] 
Sent: Wednesday, June 29, 2011 12:06 PM
To: Dedhia, Hardik
Cc: staf-users@lists.sourceforge.net
Subject: Re: [staf-users] Type of MESSAGE in QUEUE 
  
See the description of the QUEUE service's QUEUE request in section 
"8.13.2 QUEUE" in the STAF User's Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDRQUEUESRV.  It also 
provides an example of using the TYPE option. 
STAF local QUEUE QUEUE NAME "MyApplication" TYPE "info" MESSAGE "START" 

Note that you can see the syntax for QUEUE service requests by using its 
HELP option.  For example: 

C:\>STAF local QUEUE HELP 
Response 
-------- 
*** QUEUE Service Help *** 

QUEUE  MESSAGE <Message> 
      [HANDLE <Handle>] | [NAME <Name>] [PRIORITY <Priority>] [TYPE 
<Type>] 

GET    [PRIORITY <Priority>]... [MACHINE <Endpoint>]... [NAME <Name>]... 
      [HANDLE <Handle>]... [USER <User>]... [TYPE <Type>]... 
      [CONTAINS <String>]... [ICONTAINS <String>]... 
      [FIRST <Number> | ALL] 
      [WAIT [<Number>[s|m|h|d|w]]] 

PEEK   [PRIORITY <Priority>]... [MACHINE <Endpoint>]... [NAME <Name>]... 
      [HANDLE <Handle>]... [USER <User>]... [TYPE <Type>]... 
      [CONTAINS <String>]... [ICONTAINS <String>]... 
      [FIRST <Number> | ALL] 
      [WAIT [<Number>[s|m|h|d|w]]] 

DELETE [PRIORITY <Priority>]... [MACHINE <Endpoint>]... [NAME <Name>]... 
      [HANDLE <Handle>]... [USER <User>]... [TYPE <Type>]... 
      [CONTAINS <String>]... [ICONTAINS <String>]... 

LIST   [HANDLE <Handle>] 

HELP 

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        "Dedhia, Hardik" <hardik.ded...@netapp.com> 
To:        <staf-users@lists.sourceforge.net> 
Date:        06/29/2011 10:57 AM 
Subject:        [staf-users] Type of MESSAGE in QUEUE 
 






Hello, 
 
I wanted to change the type of message that I am putting in the Queue 
using the Queue Service’ Queue request. 
 
Staf local QUEUE QUEUE MESSAGE START NAME MyApplication 
 
This message is delivered as type none by default. How can I change this? 
To say Type Info. 
 
Thanks, 
 
Hardik.
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users 

<<image/gif>>

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to