These examples provide a brief preview of the Transact-SQL messaging interface.
This example sends a message to a queue:
select msgsend('hello world', 'tibco_jms:tcp://my_jms_host:7222?queue=queue.sample 'MESSAGE PROPERTY' 'city=Detroit')
This example reads a message from a queue, with and without a filter:
select msgrecv('tibco_jms:tcp://my_jms_host:7222?queue=queue.sample') select msgrecv ('tibco_jms:tcp://my_jms_host:7222?queue=queue.sample 'MESSAGE SELECTOR' 'city=Detroit')
This example publishes a message to a topic:
sp_msgadmin register, subscription, sub1, 'tibco_jms:tcp://my_jms_host:7222?topic=topic.sample', select msgpublish('hello world', 'sub1' 'MESSAGE PROPERTY' 'city=Boston')
This example consumes a message from a topic:
select msgconsume('sub1')
This example illustrates working with properties:
select msgconsume('sub1') declare @pcount integer declare @curr integer declare @pname varchar(100) select @curr=1 select @pcount = msgpropcount() while(@curr<=@pcount) begin select @name=msgpropname(@curr) select msgproptype(@pname) select msgpropvalue(@pname) select @curr=@curr+1 end
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |