1. Quick Start 1: download the latest version from the official website. The latest version is 5.9.0 2. Unzip the package, open cmd, enter the bin directory, and run activemq. (In linux, enter nohup activemq &) to check the output startup log. Loading message broker from: xbean: activemq. xml, which is the main configuration file. Using Persistence Adapter: KahaDBPersistenceAdapter, a dedicated activemq message storage, which is fast. Listening for connections at: tcp: /collonn-PC: 61616? MaximumConnections = 1000 & wireFormat. maxFrameSize = 104857600, which is one of the ports listened by activemq. ActiveMQ WebConsole available at http: // localhost: 8161/, which is the page-based console of activemq. 3: Open the browser, enter http: // localhost: 8161/, and select Manage ActiveMQ broker using the old console. It is more convenient to view and control activemq in the old way. Ii. Quick Introduction 1: Go to the activemq_install_dir/config directory. There are several important files (1) activemq. xml. In this file, you can configure many things of activemq, such as persistence of messages to the database. (2) credentials. properties, some passwords, mostly used for production and consumption password authentication. (3) jetty. xml and activemq have built-in jetty application server. (4) jetty-realm.properties, activemq console login password. 3. persistently send messages to MySQL 1: activemq_install_dir/examples/config. There are many sample configuration files for reference, such as persistence to databases and security issues. 2: copy the mysql driver to the activemq_install_dir/lib directory, and create an empty database named activemq in the database. 3: Modify the activemq. xml file, as shown in [html] below <! -- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. see the NOTICE file distributed with this work for additional information regarding copyright ownership. the ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file License t in compliance with the License. you may obtain a copy of the License Http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "as is" BASIS, without warranties or conditions of any kind, either express or implied. see the License for the specific language governing permissions and limitations under the License. --> <! -- Use JDBC for message persistence For more information, see: http://activemq.apache.org/persistence.html You need to add Derby database to your classpath in order to make this example work. download it from http://db.apache.org/derby/ and put it in the $ {ACTIVEMQ_HOME}/lib/optional/folder Optionally you can configure any other RDBM as shown below To run ActiveMQ with this configuration add xbean: Examples/conf/The activemq-jdbc.xml to your command e.g. $ bin/activemq console xbean: examples/conf/activemq-jdbc.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> </beans> <broker useJmx = "false" brokerName = "jdbcBroker" xmlns = "http://activemq.apache.org/schema/core"> <! -- See more database locker options at http://activemq.apache.org/pluggable-storage-lockers.html --> <persistenceAdapter> <jdbcPersistenceAdapter dataDirectory = "$ {activemq. data} "dataSource =" # mysql-ds "/> </persistenceAdapter> <transportConnectors> <transportctor name =" openwire "uri =" tcp: // 0.0.0.0: 61616 "/> </transportConnectors> </broker> <! -- Embedded Derby DataSource Sample Setup --> <! -- <Bean id = "derby-ds" class = "org. apache. derby. jdbc. embeddedDataSource "> <property name =" databaseName "value =" derbydb "/> <property name =" createDatabase "value =" create "/> </bean> --> <! -- S DataSource Sample Setup --> <! -- <Bean id = "s-ds" class = "org. postgresql. ds. PGPoolingDataSource "> <property name =" serverName "value =" localhost "/> <property name =" databaseName "value =" activemq "/> <property name =" portNumber "value = "0"/> <property name = "user" value = "activemq"/> <property name = "password" value = "activemq"/> <property name = "CENAME" value = "s"/> <property name = "initialConnections" value = "1"/> <prope Rty name = "maxConnections" value = "10"/> </bean> --> <! -- MySql DataSource Sample Setup --> <bean id = "mysql-ds" class = "org. apache. commons. dbcp. basicDataSource "destroy-method =" close "> <property name =" driverClassName "value =" com. mysql. jdbc. driver "/> <property name =" url "value =" jdbc: mysql: // localhost/activemq? RelaxAutoCommit = true "/> <property name =" username "value =" root "/> <property name =" password "value =" sa "/> <property name =" maxActive "value =" 200 "/> <property name =" poolPreparedStatements "value =" true "/> </bean> <! -- Oracle DataSource Sample Setup --> <! -- <Bean id = "oracle-ds" class = "org. apache. commons. dbcp. basicDataSource "destroy-method =" close "> <property name =" driverClassName "value =" oracle. jdbc. driver. oracleDriver "/> <property name =" url "value =" jdbc: oracle: thin: @ localhost: 1521: AMQDB "/> <property name =" username "value =" scott "/> <property name =" password "value =" tiger "/> <property name =" maxActive "value = "200"/> <property name = "poolPreparedStateme NT "value =" true "/> </bean> --> <! -- Enable web tracking les, REST and Ajax APIs and demos The web tracking les 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> 3: To make activemq safer, it can be produced and consumed only after authentication. In activemq. add the following to the xml file. Note that you can directly add it to the transportors node. The password referenced in the file is from activemq_install_dir/config/credentials. properties file, activemq. the complete xml content is as follows: [html] <! -- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. see the NOTICE file distributed with this work for additional information regarding copyright ownership. the ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file License t in compliance with the License. you may obtain a copy of the License Http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "as is" BASIS, without warranties or conditions of any kind, either express or implied. see the License for the specific language governing permissions and limitations under the License. --> <! -- Use JDBC for message persistence For more information, see: http://activemq.apache.org/persistence.html You need to add Derby database to your classpath in order to make this example work. download it from http://db.apache.org/derby/ and put it in the $ {ACTIVEMQ_HOME}/lib/optional/folder Optionally you can configure any other RDBM as shown below To run ActiveMQ with this configuration add xbean: Examples/conf/The activemq-jdbc.xml to your command e.g. $ bin/activemq console xbean: examples/conf/activemq-jdbc.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> </beans> <broker useJmx = "false" brokerName = "jdbcBroker" xmlns = "http://activemq.apache.org/schema/core"> <! -- See more database locker options at http://activemq.apache.org/pluggable-storage-lockers.html --> <persistenceAdapter> <jdbcPersistenceAdapter dataDirectory = "$ {activemq. data} "dataSource =" # mysql-ds "/> </persistenceAdapter> <plugins> <! -- Configure authentication; Username, passwords and groups --> <simpleAuthenticationPlugin> <users> <authenticationUser username = "system" password = "$ {activemq. password} "groups =" users, admins "/> <authenticationUser username =" user "password =" $ {guest. password} "groups =" users "/> <authenticationUser username =" guest "password =" $ {guest. password} "groups =" guests "/> </users> </simpleAuthenticationPlugin> </Plugins> <transportors ors> <transportctor name = "openwire" uri = "tcp: // 0.0.0.0: 61616"/> </transportors> </broker> <! -- Embedded Derby DataSource Sample Setup --> <! -- <Bean id = "derby-ds" class = "org. apache. derby. jdbc. embeddedDataSource "> <property name =" databaseName "value =" derbydb "/> <property name =" createDatabase "value =" create "/> </bean> --> <! -- S DataSource Sample Setup --> <! -- <Bean id = "s-ds" class = "org. postgresql. ds. PGPoolingDataSource "> <property name =" serverName "value =" localhost "/> <property name =" databaseName "value =" activemq "/> <property name =" portNumber "value = "0"/> <property name = "user" value = "activemq"/> <property name = "password" value = "activemq"/> <property name = "CENAME" value = "s"/> <property name = "initialConnections" value = "1"/> <prope Rty name = "maxConnections" value = "10"/> </bean> --> <! -- MySql DataSource Sample Setup --> <bean id = "mysql-ds" class = "org. apache. commons. dbcp. basicDataSource "destroy-method =" close "> <property name =" driverClassName "value =" com. mysql. jdbc. driver "/> <property name =" url "value =" jdbc: mysql: // localhost/activemq? RelaxAutoCommit = true "/> <property name =" username "value =" root "/> <property name =" password "value =" sa "/> <property name =" maxActive "value =" 200 "/> <property name =" poolPreparedStatements "value =" true "/> </bean> <! -- Oracle DataSource Sample Setup --> <! -- <Bean id = "oracle-ds" class = "org. apache. commons. dbcp. basicDataSource "destroy-method =" close "> <property name =" driverClassName "value =" oracle. jdbc. driver. oracleDriver "/> <property name =" url "value =" jdbc: oracle: thin: @ localhost: 1521: AMQDB "/> <property name =" username "value =" scott "/> <property name =" password "value =" tiger "/> <property name =" maxActive "value = "200"/> <property name = "poolPreparedStateme NT "value =" true "/> </bean> --> <! -- Enable web tracking les, REST and Ajax APIs and demos The web tracking les 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>