当前位置: 首页 > ActiveMQ in Action 读书笔记 > 正文

7 使用 ActiveMQ 创建 Java 程序

 7 Creating Java applications with ActiveMQ

This chapter covers
 Embedding ActiveMQ in Java applications
 Embedding ActiveMQ using Spring
 Creating request/reply applications
 Writing JMS clients using Spring

 7 使用ActiveMQ创建Java程序

本章内容包括:
嵌入ActiveMQ到Java程序
Spring中集成ActiveMQ
创建问询/应答程序
使用Spring创建JMS客户端

Thus far the book has concentrated on ActiveMQ as a software application. Most ofthe information we’ve presented has concerned the internal structure of ActiveMQand how its components can be configured. But apart from basic JMS examples,using ActiveMQ in your applications hasn’t been discussed. This chapter is dedicatedto explaining how to create applications with ActiveMQ.

到目前位置,ActiveMQ被当成应用软件来看待.我们关注的大部分信息都是关于ActiveMQ的内部结构以及如何配置ActiveMQ组件的.但是,除了那两个基本的JMS例子,我们尚未讨论过在你自己的程序中使用ActiveMQ.因而,本章将讨论如何使用ActiveMQ创建应用程序.

 One of the things you might want to do with ActiveMQ is to embed it into yourapplication. Since ActiveMQ is written in Java, it can naturally be integrated inanother Java application. As you’ll see, you can configure the broker using eitherJava code or XML (via the Spring Framework). A fully configured broker can serveclients from the same application (using the VM protocol) as well as clients fromremote applications to exchange messages over the network. This scenario isdepicted in figure 7.1.

将ActiveMQ嵌入到你的应用程序可能是你要做的.因为ActiveMQ是用Java写的,ActiveMQ天生的具有集成到其他Java程序中的能力.你将看到,你可以使用Java代码或者XML文件(通过Spring矿建)来配置代理.配置好的代理可以为应用程序自身服务(通过VM协议)也可以为远程应用程序的客户端服务以便通过网络交换消息.图7.1描述了这一场景.

The first section of this chapter will explore various techniques available for embeddingActiveMQ in your Java applications. The second section will explain how toembed ActiveMQ using Spring. You’ll see how to configure ActiveMQ using both pureSpring XML and custom namespaces, as well as the standard ActiveMQ XML viaApache XBean (http://mng.bz/EAfX). This will be followed by a discussion of someadvanced programming techniques that include ActiveMQ. This is a vast topic andwe’ll dig into two common use cases. We’ll also take a look at how to create a request/reply system using JMS and ActiveMQ. We’ll discuss advantages of such a system overthe traditional client-server architecture.

本章第一节节将介绍各种可用的技术用来将ActiveMQ嵌入到Java程序中,第二节的内容将介绍如何使用Spring来嵌入ActiveMQ.你将看到如何使用Spring的配置文件和自定义命令空间以及使用Apache XBean(http://mng.bz/EAfX)的标准ActiveMQ XML文件来配置ActiveMQ.接着,我们会讨论一些ActiveMQ相关的高级编程技术.这里我们会通过两个基本的用例来讨论这个广阔的话题.我们还将看到如何使用JMS和ActiveMQ创建一个问询/应答系统并讨论使用ActiveMQ消息的系统比传统的CS架构系统的优越性.

Finally, you’ll learn about using Spring JMS to simplify the creation of JMS clientswith ActiveMQ. Using the stock portfolio sample application, we’ll use Spring JMS toset up connections, consumers, and producers in a quick manner. To begin, let’s discussembedding ActiveMQ in your applications. There’s no single correct way toembed ActiveMQ. The method you choose will probably depend on your applicationdesign.

最后,你将学习如何利用Spring JMS来简化通过ActiveMQ创建JMS客户端的过程.使用stock portfolio例子,我们可以使用Spring JMS快速设置连接,消息消费者和消息生产者.现在,让我从讨论在你自己的应用程序中嵌入ActiveMQ开始.没有所谓的正确的嵌入ActiveMQ的方式,你需要根据你程序的架构来选择使用何种方式嵌入ActiveMQ.

打个赏呗

   微信打赏  支付宝打赏


本文固定链接: https://www.jack-yin.com/coding/translation/activemq-in-action/1540.html | 边城网事

该日志由 边城网事 于2013年10月30日发表在 ActiveMQ in Action 读书笔记 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: 7 使用 ActiveMQ 创建 Java 程序 | 边城网事

7 使用 ActiveMQ 创建 Java 程序 暂无评论

发表评论

快捷键:Ctrl+Enter