[hornetq-commits] JBoss hornetq SVN: r9201 - branches/HnetQ_323_cn/docs/user-manual/zh.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu May 6 03:19:38 EDT 2010
Author: gaohoward
Date: 2010-05-06 03:19:38 -0400 (Thu, 06 May 2010)
New Revision: 9201
Modified:
branches/HnetQ_323_cn/docs/user-manual/zh/embedding-hornetq.xml
Log:
done
Modified: branches/HnetQ_323_cn/docs/user-manual/zh/embedding-hornetq.xml
===================================================================
--- branches/HnetQ_323_cn/docs/user-manual/zh/embedding-hornetq.xml 2010-05-05 08:24:45 UTC (rev 9200)
+++ branches/HnetQ_323_cn/docs/user-manual/zh/embedding-hornetq.xml 2010-05-06 07:19:38 UTC (rev 9201)
@@ -17,25 +17,20 @@
<!-- permitted by applicable law. -->
<!-- ============================================================================= -->
<chapter id="embedding-hornetq">
- <title>Embedding HornetQ</title>
- <para>HornetQ is designed as set of simple Plain Old Java Objects (POJOs). This means HornetQ
- can be instantiated and run in any dependency injection framework such as JBoss
- Microcontainer, Spring or Google Guice. It also means that if you have an application that
- could use messaging functionality internally, then it can <emphasis>directly
- instantiate</emphasis> HornetQ clients and servers in its own application code to
- perform that functionality. We call this <emphasis>embedding</emphasis> HornetQ.</para>
- <para>Examples of applications that might want to do this include any application that needs
- very high performance, transactional, persistent messaging but doesn't want the hassle of
- writing it all from scratch.</para>
- <para>Embedding HornetQ can be done in very few easy steps. Instantiate the configuration
- object, instantiate the server, start it, and you have a HornetQ running in your virtual
- machine. It's as simple and easy as that.</para>
+ <title>嵌入式HornetQ</title>
+ <para>HornetQ是由简单传统Java对象(POJO)实现,因此它可以在任何依赖注入的框架中运行,比如JBoss
+ Microcontainer,Sprint或Google Guice。另外如果你的应用程序内部需要消息功能,你可以在程序中
+ <emphasis>直接实例化</emphasis>HornetQ的客户端或服务器端。我们称之为<emphasis>嵌入式</emphasis>
+ HornetQ。</para>
+ <para>有些应用需要高性能、事务性及持久化的消息服务,但是又不希望自己去费时费力实现它。于是嵌入式HornetQ就
+ 成为了一个很适当的选择。</para>
+ <para>要使用嵌入式HornetQ只需要几个简单的步骤。首先初始化配置对象,再初始化服务器并启动它,在你的虚拟机
+ 中就运行越来了一个HornetQ服务器。就是这么简单。</para>
<section>
- <title>POJO instantiation</title>
- <para>You can follow this step-by-step guide:</para>
- <para>Create the configuration object - this contains configuration information for a
- HornetQ. If you want to configure it from a file on the classpath, use <literal
- >FileConfigurationImpl</literal></para>
+ <title>POJO的初始化</title>
+ <para>按照以下步骤去做:</para>
+ <para>创建配置对象--这个对象包装了HornetQ的配置信息。如果你想使用配置文件,则使用<literal
+ >FileConfigurationImpl</literal>。</para>
<programlisting>import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.FileConfiguration;
@@ -45,12 +40,10 @@
Configuration config = new FileConfiguration();
config.setConfigurationUrl(urlToYourconfigfile);
config.start();</programlisting>
- <para>If you don't need to support a configuration file, just use <literal
- >ConfigurationImpl</literal> and change the config parameters accordingly, such as
- adding acceptors. </para>
- <para>The acceptors are configured through <literal>ConfigurationImpl</literal>. Just add
- the <literal>NettyAcceptorFactory</literal> on the transports the same way you would
- through the main configuration file.</para>
+ <para>如果不需要配置文件,可以用<literal>ConfigurationImpl</literal>,只要将其中的各种配置参数设置好
+ 即可。如添加适当的接收器。</para>
+ <para><literal>ConfigurationImpl</literal>用来配置接收器。和主要配置文件相似,只需要添加
+ <literal>NettyAcceptorFactory</literal>即可。</para>
<programlisting>import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -63,9 +56,8 @@
transports.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
config.setAcceptorConfigurations(transports);</programlisting>
- <para>You need to instantiate and start HornetQ server. The class <literal
- >org.hornetq.api.core.server.HornetQ</literal> has a few static methods for creating
- servers with common configurations.</para>
+ <para>接着就需要初始化并启动HornetQ服务。<literal
+ >org.hornetq.api.core.server.HornetQ</literal>类有一些静态方法可用来创建HornetQ服务器。</para>
<programlisting>import org.hornetq.api.core.server.HornetQ;
import org.hornetq.core.server.HornetQServer;
@@ -74,25 +66,22 @@
HornetQServer server = HornetQ.newHornetQServer(config);
server.start();</programlisting>
- <para>You also have the option of instantiating <literal>HornetQServerImpl</literal>
- directly:</para>
+ <para>你还可以直接实例化<literal>HornetQServerImpl</literal>:</para>
<programlisting>HornetQServer server =
new HornetQServerImpl(config);
server.start();</programlisting>
</section>
<section>
- <title>Dependency Frameworks</title>
- <para>You may also choose to use a dependency injection framework such as <trademark>JBoss
- Micro Container</trademark> or <trademark>Spring Framework</trademark>.</para>
- <para>HornetQ standalone uses JBoss Micro Container as the injection framework. <literal
- >HornetQBootstrapServer</literal> and <literal>hornetq-beans.xml</literal> which are
- part of the HornetQ distribution provide a very complete implementation of what's needed
- to bootstrap the server using JBoss Micro Container. </para>
- <para>When using JBoss Micro Container, you need to provide an XML file declaring the
- <literal>HornetQServer</literal> and <literal>Configuration</literal> object, you
- can also inject a security manager and a MBean server if you want, but those are
- optional.</para>
- <para>A very basic XML Bean declaration for the JBoss Micro Container would be:</para>
+ <title>使用依赖注入框架</title>
+ <para>你还可以使用一个依赖注入框架来启动HornetQ,比如<trademark>JBoss
+ Microcontainer</trademark>或<trademark>Spring框架</trademark>。</para>
+ <para>HornetQ独立服务器使用的是JBoss Microcontainer作为其框架。在HornetQ的发布中包括的<literal
+ >HornetQBootstrapServer</literal>和<literal>hornetq-beans.xml</literal>文件共同实现了
+ 在JBoss Microcontainer中对HornetQ服务器的引导。</para>
+ <para>要使用JBoss Microcontainer,需要在xml文件中声明<literal>HornetQServer</literal>
+ 和<literal>Configuration</literal>对象。另外还可以注入一个安全管理器和一个MBean服务器。但是这些
+ 注入是可选的。</para>
+ <para>下面是一个基本的JBoss Microcontainer的XML Bean的声明:</para>
<programlisting><?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
@@ -112,19 +101,17 @@
</constructor>
</bean>
</deployment></programlisting>
- <para><literal>HornetQBootstrapServer</literal> provides an easy encapsulation of JBoss
- Micro Container.</para>
+ <para><literal>HornetQBootstrapServer</literal>实现了JBoss Microcontainer的简单封装。</para>
<programlisting>HornetQBootstrapServer bootStrap =
new HornetQBootstrapServer(new String[] {"hornetq-beans.xml"});
bootStrap.run();</programlisting>
</section>
<section>
- <title>Connecting to the Embedded HornetQ</title>
- <para>To connect clients to HornetQ you just create the factories as normal:</para>
+ <title>连接嵌入式HornetQ</title>
+ <para>嵌入式HornetQ的连接和普通的连接一样要创建连接工厂:</para>
<section>
- <title>Core API</title>
- <para>If using the core API, just create the <literal>ClientSessionFactory</literal> and
- use the regular core API.</para>
+ <title>核心接口</title>
+ <para>使用核心接口,需要创建一个<literal>ClientSessionFactory</literal>然后正常建立连接。</para>
<programlisting>ClientSessionFactory nettyFactory = HornetQClient.createClientSessionFactory(
new TransportConfiguration(
InVMConnectorFactory.class.getName()));
@@ -152,10 +139,9 @@
session.close();</programlisting>
</section>
<section>
- <title>JMS API</title>
- <para>Connection on an Embedded HornetQ through JMS is also simple. Just instantiate
- <literal>ConnectionFactory</literal> directly. The following example
- illustrates that.</para>
+ <title>JMS接口</title>
+ <para>使用JMS接口连接嵌入HornetQ同样简单。只需要直接实例化
+ <literal>ConnectionFactory</literal>即可。如下面例子所示:</para>
<programlisting>ConnectionFactory cf =
HornetQJMSClient.createConnectionFactory(
new TransportConfiguration(InVMConnectorFactory.class.getName()));
@@ -186,8 +172,7 @@
</section>
</section>
<section>
- <title>JMS Embedding Example</title>
- <para>Please see <xref linkend="examples.embedded"/> for an example which shows how to setup
- and run HornetQ embedded with JMS.</para>
+ <title>JMS嵌入式HornetQ的例子</title>
+ <para>有关如何设置与运行JMS嵌入式HornetQ的例子请参见<xref linkend="examples.embedded"/>。</para>
</section>
</chapter>
More information about the hornetq-commits
mailing list