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. epel源报错怎么解决?

    http://mirrors.aliyun.com/centos/6/extras/x86_64/repodata/81fdefdd048c01dcc6cda1fd53aacec2a0613ea10d ...

  2. 记一次坑爹的golang 二维map判断问题

    记一次坑爹的golang 二维map判断问题 2018年10月18日 23:16:21 yinnnnnnn 阅读数:32更多 个人分类: golang   版权声明:本文为博主原创文章,未经博主允许不 ...

  3. EasyUI的treegrid组件动态加载数据问题的解决办法

    http://www.jquerycn.cn/a_3455 —————————————————————————————————————————————————————————————————————— ...

  4. centos 部署 SparkR

    ---恢复内容开始--- 环境配置—— 操作系统:CentOS 6.5 JDK版本:1.7.0_67 Hadoop集群版本:CDH 5.3.0 安装过程—— 1.(1)安装R yum install ...

  5. 《FPGA全程进阶---实战演练》第二章之焊接板子及调试注意事项

    1.若是读者第一次做板子,强烈建议画完PCB板后将PCB图打印出来,然后对照你买的芯片将芯片放置对 应的位置,然后查看所有的封装格式适不适合,否则等你做出板子来后再试,为时晚矣.笔者虽然知道要这么 做 ...

  6. 查询相应id下的数据

    ---恢复内容开始--- u方法这样的:带不起模板引擎 <a href="{:U('Del/wzxg','','')}/{$vo.id}">修改</a> 这 ...

  7. php eval函数一句话木马代码

    eval可以用来执行任何其他php代码,所以对于代码里发现了eval函数一定要小心,可能是木马 就这一句话害死人,这样任何人都可以post任何文件上来,所以要做好防范 <?php @eval($ ...

  8. php 错误和异常处理

    一.错误和异常处理 1.1 错误类型和基本的调试方法 PHP程序的错误发生一般归属于下列三个领域: 语法错误: 语法错误最常见,并且也容易修复.如:代码中遗漏一个分号.这类错误会阻止脚本的执行. 运行 ...

  9. Oracle居然把Java EE的未来押在Rest API上了

        然而Lehman并不赞同Rahman对Java EE 9的说法,所以他重申Oracle暂时专注于Java EE 8."我们正在倾全力推出EE 8,现在这是我们主要的关注点," ...

  10. [kfaka] Apache Kafka:下一代分布式消息系统

    简介 Apache Kafka是分布式发布-订阅消息系统.它最初由LinkedIn公司开发,之后成为Apache项目的一部分.Kafka是一种快速.可扩展的.设计内在就是分布式的,分区的和可复制的提交 ...