那是一段如此自以为是,又如此狼狈不堪的青春岁月。
有欢笑,也有泪水;有朝气,也有颓废;
有甜蜜,也有荒唐;有自信,也有迷茫。



Initial Configuration

Required JARs

To make ActiveMQ easy to use, the default activemq.jar comes complete with all the libraries required. If you prefer to have explicit control over all the jars used by ActiveMQ here is the full list of individual jars required

  • activemq-core.jar
  • activeio.jar
  • commons-logging.jar
  • backport-util-concurrent.jar
  • mx4j (if running on Java 1.4)
  • J2EE APIs which could be the j2ee.jar from Sun or your J2EE container or you could use Geronimo's freely distributable geronimo-spec-j2ee.jar. If you are inside a servlet container and being dependent on the j2ee.jar causes you troubles, the parts of the J2EE jar we are dependent on are as follows...
    • geronimo-spec-jms.jar
    • geronimo-spec-jta.jar
    • geronimo-spec-j2ee-management.jar

If you want to grab a J2EE specification jar we recommend the Apache repository

需要的JAR包:
为了使用方便,默认的activemq.jar包含了全部需要的类包。如果你更喜欢明确的操作所有的jars,下面列出了ActiveMQ所用到每个单独的jar包:

  • activemq-core.jar
  • activeio.jar
  • commons-logging.jar
  • backport-util-concurrent.jar
  • mx4j (if running on Java 1.4)
  • j2ee.jar

Optional JARS

  • spring.jar - if you wish to use the XML configuration file for configuring the Message Broker
  • if you wish to use message persistence then you need to add a persistent jar to your classpath (see below). If you just want a lightweight message bus with no durability you can leave this step out but we highly recommend persistence for production deployments.
  • if you want to use Zeroconf based discovery then you need the jmdns.jar
    Note:
    The zeroconf protol is no longer supported in AMQ 4.x.
  • spring.jar -如果你想要通过XML配置文件来配置消息Broker
  • 如果你想要使用消息持久化,你必须在你的类路径下添加一个持久化相关的jar包(看下面)。如果你仅仅是想要进行轻量级的消息传输,不需要耐久性,你可以跳过这一步骤,不过我们强烈推荐你在产品开发的时候使用持久化。
  • Zeroconf 协议在AMQ4.x中已经不再支持,这里相关的就不介绍了。

Persistence Support

We support persistence via JDBC and a high performance journal. For full explict control over configuration check out the Xml Configuration.

我们通过JDBC和高性能的日志来支持持久化。详细的配置信息请看XML Configuration。
如何通过XML文件来配置管理AMQ,会单独介绍。

Next steps

One of the first things you might want to do is start a broker. Once you have a broker running you could try using the JNDI Support which shows how to run an example JMS program. Or there are some other example programs

If you don't want to use JNDI you can just instantiate an ActiveMQConnectionFactory, configure its properties directly and then you're ready to use the standard JMS API to create Connections, Sessions, MessageProducer and MessageConsumer instances.

你想做的第一件事情也许就是启动一个broker。如果你已经有了一个启动的broker,你可以试着使用一下JNDI Support 来运行一个JMS例子项目。当来,如果你不想使用JNDI,也可以运行别的例子程序,这些是通过 ActiveMQConnectionFactory直接配置属性,然后你可以使用标准的JMS API来创建连接,Sessions,消息创造者和消息消费者等实例。


0 Comments: