Running an ActiveMQ Broker

运行ActiveMQ代理

Note if you want to use an embedded broker then see How do I embed a Broker inside a Connection

注意,如果您想要使用嵌入式代理,那么请参见如何在连接中嵌入代理。

The binary distribution of ActiveMQ comes with a script called 'activemq' which allows you to run a broker.
For details regarding the activemq init script file review  Unix Shell Script  and  ActiveMQ Command Line Tools Reference

ActiveMQ的二进制发行版附带了一个名为“ActiveMQ”的脚本,它允许您运行代理。有关activemq init脚本文件审查的详细信息,请参阅Unix Shell脚本和activemq命令行工具引用。

 

 

Typing the following will run an ActiveMQ Broker using the out of the box configuration in the foreground

键入下面的内容将运行一个ActiveMQ代理,使用前景中的框配置。

bin/activemq console

You can then use a Broker Configuration URI to specify how to start and configure your broker using a single URI. For example

然后,您可以使用代理配置URI来指定如何使用单个URI启动和配置代理。例如

bin/activemq console broker:(tcp://localhost:61616,network:static:tcp://remotehost:61616)?persistent=false&useJmx=true

Or you can a Broker XBean URI to customize the Message Broker using the Xml Configuration to suit your needs. You can run a broker with a specific XML configuration as

或者,您可以使用代理XBean URI来定制消息代理,使用Xml配置来满足您的需要。您可以使用特定的XML配置运行代理。

bin/activemq console xbean:foo.xml

Or you can use a Broker Properties URI to customize the Message Broker using a properties file; which avoids the dependency on Spring, xbean-spring and XML.

或者,您可以使用代理属性URI来定制使用属性文件的消息代理;它避免了对Spring、xbean-spring和XML的依赖。

bin/activemq console properties:foo.properties

Monitoring the broker

监控代理

You can monitor ActiveMQ using the Web Console by pointing your browser at

您可以通过指向浏览器来监视ActiveMQ。

http://localhost:8161/admin

http://localhost:8161 / admin

From ActiveMQ 5.8 onwards the web apps is secured out of the box.
The default username and password is admin/admin. You can configure this in the conf/jetty-real.properties file.

从activemq5.8开始,web应用程序被安全地从盒子中取出。默认的用户名和密码是admin/admin。您可以在conf/jetty-real中配置它。属性文件。

Or you can use the JMX support to view the running state of ActiveMQ.

或者,您可以使用JMX支持来查看ActiveMQ的运行状态。

For more information see the file docs/WebConsole-README.txt in the distribution.

有关更多信息,请参见文件文档/ webconsol - readme。三种的分布。

Running the broker inside a Servlet Engine

在Servlet引擎中运行代理。

See the source code (or WAR) of the Web Console for an example of how to run the broker inside a web application using Spring.

请参阅Web控制台的源代码(或WAR),以了解如何使用Spring在Web应用程序中运行代理。

Running the broker inside your J2EE Application Server

在J2EE应用程序服务器中运行代理。

Whether its Apache Geronmio, JBoss, WebLogic or some other J2EE container you should be able to just reconfigure and then deploy the activemq-*.rar which is included in the binary distribution as a deployment unit in your app server. By default the rar is not configured to start an embedded broker. But by setting the brokerXmlConfig on the resource adapter configuration, the resource adapter will start an embedded broker.

您应该能够重新配置并部署activemq-*,无论是Apache germio、JBoss、WebLogic还是其他J2EE容器。在应用服务器中作为部署单元的二进制分布中包含的rar。默认情况下,rar没有配置为启动嵌入式代理。但是,通过在资源适配器配置上设置brokerXmlConfig,资源适配器将启动一个嵌入式代理。

For more details see J2EE

有关更多细节,请参见J2EE。

Running the broker from the source code

从源代码运行代理。

From the latest checkout of the code you can run a broker using the ActiveMQ Performance Plugin

从最新的代码签出中,您可以使用ActiveMQ性能插件运行代理。

Running the broker from maven

从maven运行代理。

You can download and install the ActiveMQ Startup Maven Plugin via the following command if you are in a directory with a pom.xml. More detailed usage here

您可以通过以下命令下载并安装ActiveMQ启动Maven插件,如果您所在的目录中有一个pom.xml。更详细的使用在这里

mvn org.apache.activemq.tooling:maven-activemq-plugin:5.0-SNAPSHOT:run    

You can also include it the pom and run it using:

您还可以将其包括在pom中,并使用:

mvn activemq:run          

Handling JMS brokers going down

处理JMS代理的下降。

A common requirement is that if the JMS broker goes down you want to automatically detect the failure and try to reconnect under the covers so that your application does not have to worry about reconnection.

一个常见的需求是,如果JMS代理下降,您希望自动检测故障并尝试重新连接到覆盖层,这样您的应用程序就不必担心重新连接。

There is detailed documentation on this in Configuring Version 5 Transports; briefly...

在配置版本5传输过程中有详细的文档说明;短暂的……

Just change your connection URI i to

只需更改连接URI i到。

failover:tcp://host:port

And the JMS client will auto-reconnect to the broker if it is shutdown and restarted later on.

如果JMS客户端关闭并在稍后重新启动,它将自动重新连接到代理。

© 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