Difference between revisions of "MQCURMSGS()"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 
{{YLM to do}}
 
{{YLM to do}}
 +
==Purpose==
 +
Return the number of unread messages in the specified queue
 +
 +
 +
==Syntax==
 +
MQCURMSGS(<expN>)
 +
 +
 +
==See Also==
 +
[[MQCLOSE()]], [[MQCREATE()]], [[MQOPEN()]], [[MQRECEIVE()]], [[MQSEND()]]
 +
 +
 +
==Description==
 +
The MQCURMSGS() function returns the current number of unread messages in the queue specified by <expN>.
 +
 +
 +
==Example==
 +
<code lang="recital">
 +
mqdes=mqopen("/myqueue")
 +
if (mqdes < 0)
 +
  messagebox(strerror()+",errno="+alltrim(str(error())))
 +
  return
 +
endif
 +
do while (mqcurmsgs(mqdes) > 0)
 +
  mstr=mqreceive(mqdes)
 +
  if (empty(mstr))
 +
      messagebox(strerror()+",errno="+alltrim(str(error())))
 +
      return
 +
  endif
 +
  messagebox(mstr)
 +
end do
 +
mqclose(mqdes)
 +
</code>
 +
 +
==Products==
 +
Recital, Recital Server
 +
[[Category:Documentation]]
 +
[[Category:Functions]]
 +
[[Category:Messaging]]
 +
[[Category:Messaging Functions]]

Revision as of 16:28, 17 November 2009

Template:YLM to do

Purpose

Return the number of unread messages in the specified queue


Syntax

MQCURMSGS(<expN>)


See Also

MQCLOSE(), MQCREATE(), MQOPEN(), MQRECEIVE(), MQSEND()


Description

The MQCURMSGS() function returns the current number of unread messages in the queue specified by <expN>.


Example

mqdes=mqopen("/myqueue")
if (mqdes < 0)
   messagebox(strerror()+",errno="+alltrim(str(error())))
   return
endif
do while (mqcurmsgs(mqdes) > 0)
   mstr=mqreceive(mqdes)
   if (empty(mstr))
      messagebox(strerror()+",errno="+alltrim(str(error())))
      return
   endif
   messagebox(mstr)
end do
mqclose(mqdes)

Products

Recital, Recital Server