Sending and receiving messages from a queue  Examples

Chapter 3: Real Time Messaging Services

Publishing and consuming messages from a topic

Transact-SQL applications can publish messages to – or consume messages from – a JMS topic with the msgpublish and msgconsume functions. You must first register a subscription with sp_msgadmin 'register', which creates a name that msgpublish, msgconsume, msgsubscribe, and msgunsubscribe can reference. A subscription can be registered as either durable or non-durable:

You can specify a message selector to control the messages that come in, ensuring that only messages of interest are read.

You can use msgsubscribe to inform the JMS provider to hold messages until the Adaptive Server application is ready to process them, and you can use msgunsubscribe to inform the JMS provider that the application is no longer interested in messages on this subscription. msgunsubscribe can also delete durable subscriptions from the JMS provider. Message properties in messages that have been read can be individually processed by the application.





Copyright © 2004. Sybase Inc. All rights reserved. Examples

View this book as PDF