To receive messages synchronously, your application explicitly polls the queue for messages. It may poll the queue periodically, or when a user initiates a particular action such as clicking a Refresh button.
Declare message objects to hold the incoming messages.
QAMessage msg; QATextMessage text_msg; |
Poll the message queue, collecting messages:
for(;;) { msg = mgr.GetMessageNoWait("queue-name"); if( msg == null ) { break; } addMessage( msg ); } |
Declare message objects to hold the incoming messages.
QAMessage * msg; QATextMessage * text_msg; |
Poll the message queue, collecting messages:
for( ;; ) { msg = mgr->getMessageNoWait( "queue-name" ); if( msg == NULL ) { break; } addMessage(msg); } |
Declare message objects to hold the incoming messages.
QAMessage msg; QATextMessage text_message; |
Poll the message queue, collecting messages:
if(mgr.start()) { for ( ;; ) { msg = mgr.getMessageNoWait("queue-name"); if ( msg == null ) { break; } addMessage(msg); } mgr.stop(); } |
Declare an object to hold the message ID.
begin declare @msgid varchar(128); |
Poll the message queue, collecting messages.
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 |
See:
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |