A special queue called system exists to receive QAnywhere system messages. There are two types of message that are sent to the system queue:
The following C# code processes system and normal messages and can be useful if you are using an on demand policy. It assumes that you have defined the message handling methods onMessage() and onSystemMessage() that implement the application logic for processing the messages.
// Declare the message listener and system listener. private QAManager.MessageListener _receiveListener; private QAManager.MessageListener _systemListener; ... // Create a MessageListener that uses the appropriate message handlers. _receiveListener = new QAManager.MessageListener( onMessage ); _systemListener = new QAManager.MessageListener( onSystemMessage ); ... // Register the message handler. mgr.SetMessageListener( queue-name, _receiveListener ); mgr.SetMessageListener( "system", _systemListener ); |
The system message handler may query the message properties to identify what information it contains. The message type property
indicates if the message holds a network status notification. For example, for a message msg
, you could perform the following processing:
msg_type = (MessageType)msg.GetIntProperty( MessageProperties.MSG_TYPE ); if( msg_type == MessageType.NETWORK_STATUS_NOTIFICATION ) { // Process a network status change. mgr.TriggerSendReceive( ); } else if ( msg_type == MessageType.PUSH_NOTIFICATION ) { // Process a push notification. mgr.TriggerSendReceive( ); } else if ( msg_type == MessageType.REGULAR ) { // This message type should not be received on the // system queue. Take appropriate action here. } |
Network status notifications
Notifications of push notification
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |