• transport connectors which consist of transport channels and wire formats TODO: add a link to a page explaining what transport connectors are how to configure and use them.
  • 传输连接器包括传输通道和有线格式:在页面上添加一个链接,说明传输连接器是如何配置和使用的。
  • network connectors using network channels or discovery TODO: add a link to a page explaining what network connectors are how to configure and use them.
  • 使用网络通道或发现TODO的网络连接器:在页面中添加一个链接,说明如何配置和使用网络连接器。
  • discovery agents TODO: add a link to a page explaining what discovery agents are how to configure and use them.
  • 发现代理程序:在页面上添加一个链接,解释发现代理是如何配置和使用它们的。
  • persistence providers & locations TODO: add a link to a page explaining what persistence providers are how to configure and use them.
  • 持久性提供者和位置:在页面中添加一个链接,解释持久性提供者如何配置和使用它们。
  • custom message containers (such as last image caching etc)
  • 自定义消息容器(如最后的图像缓存等)

We use XBean to perform the XML configuration.

我们使用XBean来执行XML配置。

For details of the XML see the Xml Reference

有关XML的详细信息,请参阅XML引用。

Be careful with broker names and URIs

Make sure you do not use any strange characters in the names of brokers as they are converted to URIs which do not allow things like underscores in them etc.

请确保在代理的名称中不要使用任何奇怪的字符,因为它们被转换为uri,而uri不允许像下划线之类的东西。

Examples

例子

The default ActiveMQ configuration: current default config.

默认的ActiveMQ配置:当前的默认配置。

xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> <!-- Allows us to use system properties as variables in this configuration file --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>file:${activemq.conf}/credentials.properties</value> </property> </bean> <!-- Allows accessing the server log --> <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery" lazy-init="false" scope="singleton" init-method="start" destroy-method="stop"> </bean> <!-- The <broker> element is used to configure the ActiveMQ broker. --> <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}"> <destinationPolicy> <policyMap> <policyEntries> <policyEntry topic=">" > <!-- The constantPendingMessageLimitStrategy is used to prevent slow topic consumers to block producers and affect other consumers by limiting the number of messages that are retained For more information, see: http://activemq.apache.org/slow-consumer-handling.html --> <pendingMessageLimitStrategy> <constantPendingMessageLimitStrategy limit="1000"/> </pendingMessageLimitStrategy> </policyEntry> </policyEntries> </policyMap> </destinationPolicy> <!-- The managementContext is used to configure how ActiveMQ is exposed in JMX. By default, ActiveMQ uses the MBean server that is started by the JVM. For more information, see: http://activemq.apache.org/jmx.html --> <managementContext> <managementContext createConnector="false"/> </managementContext> <!-- Configure message persistence for the broker. The default persistence mechanism is the KahaDB store (identified by the kahaDB tag). For more information, see: http://activemq.apache.org/persistence.html --> <persistenceAdapter> <kahaDB directory="${activemq.data}/kahadb"/> </persistenceAdapter> <!-- The systemUsage controls the maximum amount of space the broker will use before disabling caching and/or slowing down producers. For more information, see: http://activemq.apache.org/producer-flow-control.html --> <systemUsage> <systemUsage> <memoryUsage> <memoryUsage percentOfJvmHeap="70" /> </memoryUsage> <storeUsage> <storeUsage limit="100 gb"/> </storeUsage> <tempUsage> <tempUsage limit="50 gb"/> </tempUsage> </systemUsage> </systemUsage> <!-- The transport connectors expose ActiveMQ over a given protocol to clients and other brokers. For more information, see: http://activemq.apache.org/configuring-transports.html --> <transportConnectors> <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> </transportConnectors> <!-- destroy the spring context on shutdown to stop jetty --> <shutdownHooks> <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" /> </shutdownHooks> </broker> <!-- Enable web consoles, REST and Ajax APIs and demos The web consoles requires by default login, you can disable this in the jetty.xml file Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details --> <import resource="jetty.xml"/> </beans>

From a binary distribution there is an activemq script allowing you to run a Message Broker as a stand alone process from the command line easily providing the $ACTIVEMQ_HOME/bin directory is on your PATH.

从二进制发行版中,有一个activemq脚本,允许您以独立的方式运行Message Broker,从命令行中轻松地提供$ACTIVEMQ_HOME/bin目录在您的路径上。

Configuring embedded brokers

配置嵌入式代理

You can also use the XML Configuration to configure embedded brokers. For example using the JNDI configuration mechanism you can do the following
BrokerXmlConfigFromJNDITest
Or of you want to explicitly configure the embedded broker via Java code you can do the following
BrokerXmlConfigTest

您还可以使用XML配置来配置嵌入式代理。例如,使用JNDI配置机制,您可以执行以下BrokerXmlConfigFromJNDITest,或者您希望通过Java代码显式地配置嵌入式代理,您可以执行以下BrokerXmlConfigTest。

User Submitted Configurations

用户提交的配置

We have a page which allows users to submit details of their configurations.

我们有一个页面,允许用户提交他们配置的详细信息。

Background

背景

Since ActiveMQ has so many strategy pattern plugins for transports, wire formats, persistence and many other things, we wanted to leave the configuration format open so that you the developer can configure and extend ActiveMQ in any direction you wish.

由于ActiveMQ有许多用于传输、连接格式、持久性和许多其他东西的策略模式插件,所以我们希望保留配置格式,以便开发人员可以按照您希望的任何方向配置和扩展ActiveMQ。

So we use the Spring XML configuration file format, which allows any beans / POJOs to be wired together and configured. However often Spring's XML can be kinda verbose at times, so we have implemented an ActiveMQ extension to the Spring XML which knows about the common, standard ActiveMQ things you're likely to do (e.g. tags like connector, wireFormat, serverTransport, persistence) - but at any time you can fall back to the normal Spring way of doing things (with tags like bean, property etc).

因此,我们使用Spring XML配置文件格式,它允许将任何bean / pojo连接在一起并进行配置。然而通常Spring的XML可以有点冗长,我们实现了一个ActiveMQ扩展Spring XML知道常见的标准ActiveMQ你可能做的事情(如标签如连接器、wireFormat、serverTransport、持久性),但在任何时候你可以回到正常的春天的做事方式(像bean标签、属性等)。

To see documentation of the XML file we use or to get access to the XSD/DTD see the Xml Reference

要查看我们使用的XML文件或访问XSD/DTD的文档,请参阅XML引用。

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram