6.7. 例子

向Queue中发送消息(TextMessage类型)。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\queue\QueueSend

异步从Queue接受消息。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\queue\AsynchronousQueueReceive

同步从Queue中接受消息。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\queue\SynchronousQueueReceive

浏览Queue中的消息。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\queue\QueueBrowse

使用事务Session实现以all-or-none的方式向Queue发送两个消息(TextMessage类型)。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\queue\TransactedQueueSession

向Topic发布消息。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\topic\TopicPublish

注册持久化订阅,注销持久化订阅,异步从Topic接受消息。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\topic\DurableTopicSubscribe

本示例模拟"批发商-零售商"交易过程。

Wholesaler(批发商): 通过HotDeals主题发布商品价格调整信息,并且通过BuyOrdersTopic(TemporaryTopic)接受订单。

Retailer(零售商): 订阅HotDeals,如果发现某商品价格下调超过10%,那么就购进此商品1000件,并且给批发商发出订单。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\topic\Wholesaler-Reatailer

从目的地(Destination)接受消息。这里的目的地可以是队列(Queue)

也可以是主题(Topic)。如果你不再希望从Queue而是Topic接受消息,那么你只需要简单的改变Destination名称,而不必改变任何业务相关代码

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\domain-independent\DomainIndependentConsumer

向目的地(Destination)发送一个消息(TextMessage类型)。这里的目的地可以是队列(Queue),也可以是主题(Topic)。如果你不再希望发送消息到Queue而是Topic,那么你只需要简单的改变Destination名称,而不必改变任何业务相关代码。

具体代码请看APUSIC_MQ_HOME\client\javaclient\sample\domain-independent\DomainIndependentProducer