mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-5558 - make activemq-all jar executable
This commit is contained in:
parent
2b17fd8050
commit
7d14ddb0d1
|
@ -71,6 +71,10 @@
|
|||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -116,7 +120,13 @@
|
|||
<include>org.apache.geronimo.specs:geronimo-annotation_1.0_spec</include>
|
||||
<include>org.slf4j:slf4j-api</include>
|
||||
<include>org.slf4j:slf4j-log4j12</include>
|
||||
<include>org.slf4j:jcl-over-slf4j</include>
|
||||
<include>log4j:log4j</include>
|
||||
<include>org.springframework:spring-core</include>
|
||||
<include>org.springframework:spring-beans</include>
|
||||
<include>org.springframework:spring-context</include>
|
||||
<include>org.springframework:spring-expression</include>
|
||||
<include>org.apache.xbean:xbean-spring</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
|
||||
|
@ -140,6 +150,11 @@
|
|||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||
<resource>META-INF/spring.schemas</resource>
|
||||
</transformer>
|
||||
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>org.apache.activemq.console.command.ShellCommand</mainClass>
|
||||
</transformer>
|
||||
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<!--
|
||||
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 except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
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.
|
||||
-->
|
||||
<!-- START SNIPPET: example -->
|
||||
<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">
|
||||
|
||||
<!--
|
||||
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=">" expireMessagesPeriod="0" optimizedDispatch="true">
|
||||
<!-- 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="true"/>
|
||||
</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&wireFormat.maxFrameSize=104857600"/>
|
||||
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
|
||||
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
|
||||
<transportConnector name="mqtt" uri="mqtt+nio://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
|
||||
</transportConnectors>
|
||||
|
||||
</broker>
|
||||
|
||||
</beans>
|
||||
<!-- END SNIPPET: example -->
|
|
@ -0,0 +1,43 @@
|
|||
## ---------------------------------------------------------------------------
|
||||
## 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 except in compliance with
|
||||
## the License. You may obtain a copy of the License at
|
||||
##
|
||||
## 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.
|
||||
## ---------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# This file controls most of the logging in ActiveMQ which is mainly based around
|
||||
# the commons logging API.
|
||||
#
|
||||
log4j.rootLogger=INFO, console
|
||||
log4j.logger.org.apache.activemq.spring=WARN
|
||||
log4j.logger.org.apache.activemq.web.handler=WARN
|
||||
log4j.logger.org.springframework=WARN
|
||||
log4j.logger.org.apache.xbean=WARN
|
||||
log4j.logger.org.apache.camel=INFO
|
||||
log4j.logger.org.eclipse.jetty=WARN
|
||||
|
||||
# When debugging or reporting problems to the ActiveMQ team,
|
||||
# comment out the above lines and uncomment the next.
|
||||
|
||||
#log4j.rootLogger=DEBUG, logfile, console
|
||||
|
||||
# Or for more fine grained debug logging uncomment one of these
|
||||
#log4j.logger.org.apache.activemq=DEBUG
|
||||
#log4j.logger.org.apache.camel=DEBUG
|
||||
|
||||
# Console appender
|
||||
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.console.layout.ConversionPattern=%5p | %m%n
|
||||
log4j.appender.console.threshold=INFO
|
|
@ -48,31 +48,38 @@ public class ConsumerCommand extends AbstractCommand {
|
|||
LOG.info("Running " + parallelThreads + " parallel threads");
|
||||
|
||||
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl);
|
||||
Connection conn = factory.createConnection(user, password);
|
||||
conn.start();
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = factory.createConnection(user, password);
|
||||
conn.start();
|
||||
|
||||
Session sess;
|
||||
if (transactionBatchSize != 0) {
|
||||
sess = conn.createSession(true, Session.SESSION_TRANSACTED);
|
||||
} else {
|
||||
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
Session sess;
|
||||
if (transactionBatchSize != 0) {
|
||||
sess = conn.createSession(true, Session.SESSION_TRANSACTED);
|
||||
} else {
|
||||
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
}
|
||||
|
||||
|
||||
CountDownLatch active = new CountDownLatch(parallelThreads);
|
||||
|
||||
for (int i = 1; i <= parallelThreads; i++) {
|
||||
ConsumerThread consumer = new ConsumerThread(sess, ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE));
|
||||
consumer.setName("consumer-" + i);
|
||||
consumer.setBreakOnNull(false);
|
||||
consumer.setMessageCount(messageCount);
|
||||
consumer.setSleep(sleep);
|
||||
consumer.setTransactionBatchSize(transactionBatchSize);
|
||||
consumer.setFinished(active);
|
||||
consumer.start();
|
||||
}
|
||||
|
||||
active.await();
|
||||
} finally {
|
||||
if (conn != null) {
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CountDownLatch active = new CountDownLatch(parallelThreads);
|
||||
|
||||
for (int i = 1; i <= parallelThreads; i++) {
|
||||
ConsumerThread consumer = new ConsumerThread(sess, ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE));
|
||||
consumer.setName("consumer-" + i);
|
||||
consumer.setBreakOnNull(false);
|
||||
consumer.setMessageCount(messageCount);
|
||||
consumer.setSleep(sleep);
|
||||
consumer.setTransactionBatchSize(transactionBatchSize);
|
||||
consumer.setFinished(active);
|
||||
consumer.start();
|
||||
}
|
||||
|
||||
active.await();
|
||||
}
|
||||
|
||||
public String getBrokerUrl() {
|
||||
|
|
|
@ -55,34 +55,41 @@ public class ProducerCommand extends AbstractCommand {
|
|||
LOG.info("Running " + parallelThreads + " parallel threads");
|
||||
|
||||
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUrl);
|
||||
Connection conn = factory.createConnection(user, password);
|
||||
conn.start();
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = factory.createConnection(user, password);
|
||||
conn.start();
|
||||
|
||||
Session sess;
|
||||
if (transactionBatchSize != 0) {
|
||||
sess = conn.createSession(true, Session.SESSION_TRANSACTED);
|
||||
} else {
|
||||
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
Session sess;
|
||||
if (transactionBatchSize != 0) {
|
||||
sess = conn.createSession(true, Session.SESSION_TRANSACTED);
|
||||
} else {
|
||||
sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
}
|
||||
|
||||
CountDownLatch active = new CountDownLatch(parallelThreads);
|
||||
|
||||
for (int i = 1; i <= parallelThreads; i++) {
|
||||
ProducerThread producer = new ProducerThread(sess, ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE));
|
||||
producer.setName("producer-" + i);
|
||||
producer.setMessageCount(messageCount);
|
||||
producer.setSleep(sleep);
|
||||
producer.setMsgTTL(msgTTL);
|
||||
producer.setPersistent(persistent);
|
||||
producer.setTransactionBatchSize(transactionBatchSize);
|
||||
producer.setMessageSize(messageSize);
|
||||
producer.setMsgGroupID(msgGroupID);
|
||||
producer.setTextMessageSize(textMessageSize);
|
||||
producer.setFinished(active);
|
||||
producer.start();
|
||||
}
|
||||
|
||||
active.await();
|
||||
} finally {
|
||||
if (conn != null) {
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
|
||||
CountDownLatch active = new CountDownLatch(parallelThreads);
|
||||
|
||||
for (int i = 1; i <= parallelThreads; i++) {
|
||||
ProducerThread producer = new ProducerThread(sess, ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE));
|
||||
producer.setName("producer-" + i);
|
||||
producer.setMessageCount(messageCount);
|
||||
producer.setSleep(sleep);
|
||||
producer.setMsgTTL(msgTTL);
|
||||
producer.setPersistent(persistent);
|
||||
producer.setTransactionBatchSize(transactionBatchSize);
|
||||
producer.setMessageSize(messageSize);
|
||||
producer.setMsgGroupID(msgGroupID);
|
||||
producer.setTextMessageSize(textMessageSize);
|
||||
producer.setFinished(active);
|
||||
producer.start();
|
||||
}
|
||||
|
||||
active.await();
|
||||
}
|
||||
|
||||
public String getBrokerUrl() {
|
||||
|
|
|
@ -109,6 +109,10 @@ public class ShellCommand extends AbstractCommand {
|
|||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
main(args, System.in, System.out);
|
||||
}
|
||||
|
||||
public boolean isInteractive() {
|
||||
return interactive;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue