Create a stored procedure named ml_qa_listener_queue (where queue is the name of a message queue) to receive messages asynchronously.
|1||Message ID||VARCHAR(128). You can obtain the message ID from the QAnywhere Listener.|
This procedure is different from all the other QAnywhere stored procedures in that the stored procedure is not provided. If you create a stored procedure named ml_qa_listener_queue, where queue is a message queue, then it is used by QAnywhere.
Although messages can be received synchronously on a connection, it is often convenient to receive messages asynchronously. You can create a stored procedure that is called when a message has been queued on a particular address. The name of this procedure must be ml_qa_listener_queue, where queue is the message queue. When this procedure exists, the procedure is called whenever a message is queued on the given address.
This procedure is called from a separate connection. As long as a SQL error does not occur while this procedure is executing, the message is automatically acknowledged and committed.
Do not commit or rollback within this procedure.
The queue name is part of the QAnywhere address. For more information, see QAnywhere message addresses.
The following example creates a procedure that is called whenever a message is queued on the address named executesql. In this example, the procedure assumes that the content of the message is a SQL statement that it can execute against the current database.
CREATE PROCEDURE ml_qa_listener_executesql(IN @msgid VARCHAR(128)) begin DECLARE @execstr LONG VARCHAR; SET @execstr = ml_qa_gettextcontent( @msgid ); EXECUTE IMMEDIATE @execstr; end
|Envoyer votre avis sur cette page par email.||Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|