This chapter covers

 Introduction to the use case for each of the book examples

 Use of Maven for compiling and running the examples

 How to use the example applications with ActiveMQ

本章内容包括:

介绍本书中所有实例的用例

使用Maven编译和运行书中实例

如何使用ActiveMQ的示例应用程序

ActiveMQ provides all the features from the JMS specification and adds many more powerful features on top of that. This is depicted in figure 3.1 and these features will be discussed through the rest of the book. In order to best demonstrate these features, two new examples have been created that are modeled after real business domains. Compared to the example that’s part of the ActiveMQ distribution, these examples lend themselves to demonstrating the features in ActiveMQ in a more complete and easy manner.

ActiveMQ提供JMS规范中的所有功能,同时还具有很多规范之外的强大功能,如图3.1所示.这些功能将在本书

的剩余部分中讨论.为了说明这些功能,书中创建了两个基于真实业务场景的实例.

相对于ActiveMQ版本中的自带的实例来说,书中的两个实例更能够用一种简单的方式完整的展示ActiveMQ的功能.

One of the examples is based on a stock portfolio and the other is based on a

job queue. These two examples are more extensive than the examples that come

with ActiveMQ. The use case for each of these examples is introduced briefly, followed

by a deeper discussion of how to use them. You can refer back to this chapter

at any time throughout the book if you need a refresher on the examples.

两个实例一个是基于股票,另一个是基于任务队列的.这两个实例比ActiveMQ自带的实例拥有更广泛的参考性.

在两个实例用例简洁的介绍之后,是关于如何深入使用用例的深入介绍.

你可以在阅读本书的过程中适时的回顾本章以复习这两个实例.

The stock portfolio demonstrates the publish/subscribe messaging domain.

Publishers broadcast stock price messages to many interested subscribers.

Messages are published to a JMS destination called a topic and clients with

active subscriptions receive messages. Using this model, the broker delivers messages to each

subscriber without the need to poll for messages.

Every active subscriber receives its own copy of each message published to the topic.

Publishers are decoupled from subscribers via the topic. Unless durable subscriptions are

used, subscribers must be active in order to receive messages sent by publishers to the topic.

A copy of each message on a given destination is delivered to all topic subscribers using the pub/sub domain.

stock portfolio这个实例介绍了发布/订阅消息的使用.发布者广播股票价格消息给许多感兴趣的订阅者.

消息被发布到一个被称为主题(topic)JMS目的地(destination),这样客户端的活跃的订阅者将会收到消息.

使用这个模型,代理分发消息给每一个订阅者不需要推送消息.每一个活跃的消息订阅者将收到属于他们自己

已被发布得到主题(topic)的消息拷贝.消息发布者和接收者通过主题实现解耦.除非持久订阅,否则每一个消息

接收者必须是活动的,以便接受消息发布者发送给主题的消息.通过使用发布/订阅模型,

每一个带有指定目的地的消息拷贝会被分发给所有的主题订阅者.

The job queue demonstrates the point-to-point (PTP) messaging domain. Message

producers send job messages to a JMS queue, from which message consumers receive

the job messages for processing. There’s no timing requirement for the producers

and consumers to be online at the same time with the point-to-point domain. The

queue holds messages until consumers are available to receive them. As consumers

are available, messages are delivered to all consumers, but no two consumers receive

the same message. Messages on a given destination are delivered to queue consumers

in a round-robin fashion using the PTP domain.

job queue这个实例介绍了点对点消息的使用(PTP).消息生产者发送job消息给JMS消息队列,消息

消费者从消息队列接收消息然后做相应的处理.使用点对点消息模式,消息生产者和消费者不需要同时在线.

消息队列将保存消息直到消息消费者成功的接收了消息.在消息消费者可用时,消息被分发给所有消费者,

但是两个消费者不会收到同一个消息.点对点消息发送模型,将带有指定目的地的消息通过轮询的方式分发给

队列中的消费者.

Not only is each example focused on a different messaging domain, but each is

also focused on a separate use case. Additionally, although the diagrams depicted later

in this chapter for each example look nearly the same at first glance, the important

difference between the two lies in the two messaging domains. The stock portfolio

example uses topics for pub/sub messaging, whereas the job queue example uses

queues for point-to-point messaging. The source for these examples is readily available

and can be downloaded from the Manning website via the following URL: http://

manning.com/snyder/activemq-in-action-examples-src.zip.

两个实例不仅仅使用了不同的消息发送模型,而且每一个实例各自关注独立的用例.另外,

尽管如本章稍后所示,两个例子的示意图乍看起来很相似,但是两个实例使用的消息

发送模型是不同的.stock portfolio实例使用主题实现消息的发布/订阅,而job queue的例子

使用消息队列实现点对点的消息发送和接收.这两个例子的源代码可以从下面的链接下载:

http://manning.com/snyder/activemq-in-action-examples-src.zip.

(译注:貌似现在这个连接已失效,可以同这个页面http://manning.com/snyder/,在Downloads部分下载)

In this chapter, first we’ll download Maven and install it in order to compile and

run the examples. After this is complete, we’ll review each example and demonstrate

how each one should behave. After the completion of these exercises, you’ll be familiar

enough with the examples to recognize them throughout the book and see how

they’re used to demonstrate the features in ActiveMQ.

本章中,我们首先下载并安装Maven,以便编译和运行实例代码.之后,我们将复习每一个实例并说明

每一个实例的应当如何运行.完成这些后,你对这两个实例已经很熟悉了,可以很清楚的看到在本书

中这两个实例时如何说明ActiveMQ的各种功能的.

activemq 实战 一的更多相关文章

  1. ActiveMQ实战篇之ActiveMQ实现request/reply模型(二)

    ActiveMQ实战篇之ActiveMQ实现request/reply模型(二)

  2. spring +ActiveMQ 实战 topic selecter指定接收

    spring +ActiveMQ 实战 topic selecter指定接收 queue:点对点模式,一个消息只能由一个消费者接受 topic:一对多,发布/订阅模式,需要消费者都在线(可能会导致信息 ...

  3. Windows Server环境下消息队列之ActiveMQ实战

    环境准备 1.安装jdk1.7+ 2.下载新版ActiveMQ http://activemq.apache.org/ 3.启动activemq服务 4.启动成功后的界面是  5.启动成功后 浏览器访 ...

  4. 消息中间件-activemq实战之整合Spring(四)

    前面的理论准备已经很充分,这一节我们来实战:将activemq整合到Spring框架才行中,因为Spring已经集成了JMS,这也为我们配置activermq带来了方便. 1. Spring对jms的 ...

  5. ActiveMQ的作用总结(应用场景及优势)以及springboot+activeMq 实战

      业务场景说明: 消息队列在大型电子商务类网站,如京东.淘宝.去哪儿等网站有着深入的应用, 队列的主要作用是消除高并发访问高峰,加快网站的响应速度. 在不使用消息队列的情况下,用户的请求数据直接写入 ...

  6. Java消息队列--ActiveMq 实战

    1.下载安装ActiveMQ ActiveMQ官网下载地址:http://activemq.apache.org/download.html ActiveMQ 提供了Windows 和Linux.Un ...

  7. Spring下ActiveMQ实战

    MessageQueue是分布式的系统里经常要用到的组件,一般来说,当需要把消息跨网段.跨集群的分发出去,就可以用这个.一些典型的示例就是: 1.集群A中的消息需要发送给多个机器共享: 2.集群A中消 ...

  8. Apache ActiveMQ实战(2)-集群

    ActiveMQ的集群 内嵌代理所引发的问题: 消息过载 管理混乱 如何解决这些问题--集群的两种方式: Master slave Broker clusters ActiveMQ的集群有两种方式: ...

  9. Apache ActiveMQ实战(1)-基本安装配置与消息类型

    ActiveMQ简介 ActiveMQ是一种开源的,实现了JMS1.1规范的,面向消息(MOM)的中间件,为应用程序提供高效的.可扩展的.稳定的和安全的企业级消息通信.ActiveMQ使用Apache ...

  10. ActiveMQ实战之 Queue点对点消息

    前言:ActiveMQ消息模式点对点编码 运行:先运行消费者在开启消息生产者即可接收到消息 消息生产者 /** * @摘要 测试发送单条数据的类 */ public class ZMQOneSendT ...

随机推荐

  1. MySQL死锁原因分析

    行级锁有三种模式: innodb 行级锁 record-level lock大致有三种:record lock, gap lock and Next-KeyLocks. record lock  锁住 ...

  2. [转]解决eclipse无法设置NDK问题

    参考:http://jingyan.baidu.com/album/4d58d5413000a09dd4e9c0fe.html?picindex=1  到android sdk官网下载r23版本的ad ...

  3. LintCode - Copy List with Random Pointer

    LintCode - Copy List with Random Pointer LintCode - Copy List with Random Pointer Web Link Descripti ...

  4. 控件EditText

    (一)监听EditText输入内容变化 EditText.addTextChangedListener(textWatcher); //EditText change listener    //此方 ...

  5. 关于Unity中UI中的Slider,Toggle和InputField等节点

    一.Slider节点 1.创建一个Canvas 2.对Canvas进行一些初始化操作 3.创建一个Image的UI节点在Canvas下面作为子节点 4.把Image铺满整个Canvas,把宽高设置为6 ...

  6. C API 连接MySQL及批量插入

    CMySQLMgr.h: #ifndef _CMYSQLMGR_H_ #define _CMYSQLMGR_H_ #include <iostream> #include "my ...

  7. 谷歌修复了 FFmpeg 中上千个 bug

    谷歌在科技业界中几乎每天都会创造出新闻素材,它的触手涉及到了生活中的多个领域.最近谷歌将其Google +社交网络与邮件服务Gmail相结合.然而今天谷歌宣布他们修复了FFmpeg的上千个bug.   ...

  8. (转)引用---FFMPEG解码过程

    视频播放过程 首先简单介绍以下视频文件的相关知识.我们平时看到的视频文件有许多格式,比如 avi, mkv, rmvb, mov, mp4等等,这些被称为容器(Container), 不同的容器格式规 ...

  9. [转]MySQL远程连接ERROR 2003 (HY000):Can't connect to MySQL server on'XXXXX'(111) 的问题

    问题描述: 从一台Linux远程连接另一台linux上的MySQL, 出现ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.x ...

  10. 第一个OC程序

    第一个OC程序源码如下: #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @auto ...