Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
返回当前排队等候给定地址的下一条消息的消息 ID。
VARCHAR(128) 形式的消息 ID。
返回排队等候给定地址的下一条消息的消息 ID。如果没有消息排队等候此地址,则返回空值。
此存储过程用于同步检查是否有消息在等候指定的 QAnywhere 消息地址。如果想在有消息等候指定的 QAnywhere 地址时异步调用 SQL 过程,则使用监听器。
有关在有消息可用之前一直阻塞的信息,请参见ml_qa_getmessage和ml_qa_getmessagetimeout。
在当前事务提交之前,与返回的消息对应的消息将不被视为已收到。一旦接收被提交,此 QAnywhere API 或其它任何 QAnywhere API 就不能再次收到该消息。同样,对当前事务的回退表示未收到该消息,这样,对 ml_qa_getmessage 的后续调用可能会返回同一个消息 ID。
在对当前事务执行提交或回退之前,可由各种 ml_qa_get 存储过程读取已接收消息的属性和内容。一旦对当前事务执行了提交或回退,就不能再读取消息数据了。在提交之前,应以表格形式或在 SQL 变量中存储您所需要的任何消息数据。
下面的示例显示了在地址 myaddress 处等候的所有消息直到都被读取之前的内容(读取最后一条消息后提交通常比读取每条消息后提交的效率更高):
begin declare @msgid varchar(128); loop set @msgid = ml_qa_getmessagenowait( 'myaddress' ); if @msgid is null then leave end if; message 'a message with content ' || ml_qa_gettextcontent( @msgid ) || ' has been received'; end loop; commit; end