From 913f0268ad5a11626cc8d8d455e43076dbe3e7c3 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 22 Dec 2015 10:01:49 +0000 Subject: [PATCH 1/6] restrict maven version to 3.1 --- pom.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pom.xml b/pom.xml index d8f963e228..9a4a781577 100644 --- a/pom.xml +++ b/pom.xml @@ -776,6 +776,26 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 1.4.1 + + + enforce-maven + + enforce + + + + + 3.1 + + + + + + org.codehaus.mojo javacc-maven-plugin From 87cfac381b13b86cbc993bc58ddbcd460a81cc76 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 22 Dec 2015 11:10:32 +0000 Subject: [PATCH 2/6] remove release notes and tidy up --- .../src/main/resources/README.html | 41 +++---------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/artemis-distribution/src/main/resources/README.html b/artemis-distribution/src/main/resources/README.html index ce353d6a0c..0b0953c525 100644 --- a/artemis-distribution/src/main/resources/README.html +++ b/artemis-distribution/src/main/resources/README.html @@ -66,13 +66,11 @@ NAME artemis create - creates a new broker instance SYNOPSIS - artemis create [--allow-anonymous] - [--cluster-password <clusterPassword>] [--cluster-user <clusterUser>] - [--clustered] [--data <data>] [--encoding <encoding>] [--force] - [--home <home>] [--host <host>] [--java-options <javaOptions>] - [--password <password>] [--port-offset <portOffset>] [--replicated] - [--role <role>] [--shared-store] [--silent] [--user <user>] [--] - <directory> + artemis create [--allow-anonymous] [--cluster-password <clusterPassword>] [--cluster-user <clusterUser>] + [--clustered] [--data <data>] [--encoding <encoding>] [--force] + [--home <home>] [--host <host>] [--java-options <javaOptions>] + [--password <password>] [--port-offset <portOffset>] [--replicated] + [--role <role>] [--shared-store] [--silent] [--user <user>] [--] <directory> ... @@ -107,33 +105,6 @@ The broker comes shipped with an in depth user manual and a bunch of examples to The examples are shipped inside the distribution folder under "examples"

-

Release Notes - Apache ActiveMQ Artemis 1.1.0

-

A complete list of JIRAs for the 1.1.0 release can be found at the Apache ActiveMQ Artemis project JIRA

-

Overall Apache ActiveMQ Artemis 1.1.0 has several improvements and it's a nice polish on top of Apache ActiveMQ Artemis 1.0.0, things like better examples, better OpenWire support and the first release of MQTT.

-

We would like to highlight the following accomplishments on this release:

-
    -
  • [ARTEMIS-154] This is our first implementation of the MQTT support.

  • -
  • ARTEMIS-178 The examples are now using the CLI to create and start servers reflecting real cases used in production. The documentation about the examples has been updated. Please refer to the documentation for more information about this.

  • -
  • [ARTEMIS-116] The CLI has been improved. There are new tools to compact the journal and we did a lot of polish around the CLI.

  • -
  • Improvements on OpenWire We fixed several issues around OpenWire

  • -
-

Where we are still improving.

-

1.1.0 has improved a lot, and these are the areas we are still working on:

-
    -
  • This is the first release with MQTT. We would like to hear from you if you have any issues around MQTT as we are continuously improving the MQTT support

  • -
  • Short list of what need to be implemented on OpenWire for future releases: -
      -
    • Reconnection
    • -
    • Better Flow Control on producers
    • -
    • Compressed messages
    • -
    • Optimized ACKs
    • -
    • Streamlet support
    • -
  • -
- - -

Release Notes - ActiveMQ Artemis 1.0.0

- -The ActiveMQ Artemis 1.0.0 release notes can be found in the Apache ActiveMQ Artemis project JIRA. +Release Notes for all version can be found at here From 1d91680a6de95e3e8362582f241e36a51548cea2 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 22 Dec 2015 11:14:00 +0000 Subject: [PATCH 3/6] capitalisation fix --- .../activemq/artemis/core/server/ActiveMQServerLogger.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index d31e3d1271..526abca111 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -90,7 +90,7 @@ public interface ActiveMQServerLogger extends BasicLogger { void serverStopped(String version, SimpleString nodeId); @LogMessage(level = Logger.Level.INFO) - @Message(id = 221003, value = "trying to deploy queue {0}", format = Message.Format.MESSAGE_FORMAT) + @Message(id = 221003, value = "Trying to deploy queue {0}", format = Message.Format.MESSAGE_FORMAT) void deployQueue(SimpleString queueName); @LogMessage(level = Logger.Level.INFO) From 3ef184aba5dea337cf03017eca9e7cbbd3dba013 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 22 Dec 2015 11:38:01 +0000 Subject: [PATCH 4/6] added ActiveMQ style uptime at shutdown --- .../core/server/ActiveMQServerLogger.java | 4 +- .../core/server/impl/ActiveMQServerImpl.java | 27 ++++++- .../activemq/artemis/utils/TimeUtils.java | 77 +++++++++++++++++++ 3 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 artemis-server/src/main/java/org/apache/activemq/artemis/utils/TimeUtils.java diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index 526abca111..8b31875d50 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -86,8 +86,8 @@ public interface ActiveMQServerLogger extends BasicLogger { void serverStarted(String fullVersion, SimpleString nodeId, String identity); @LogMessage(level = Logger.Level.INFO) - @Message(id = 221002, value = "Apache ActiveMQ Artemis Message Broker version {0} [{1}] stopped", format = Message.Format.MESSAGE_FORMAT) - void serverStopped(String version, SimpleString nodeId); + @Message(id = 221002, value = "Apache ActiveMQ Artemis Message Broker version {0} [{1}] stopped, uptime {2}", format = Message.Format.MESSAGE_FORMAT) + void serverStopped(String version, SimpleString nodeId, String uptime); @LogMessage(level = Logger.Level.INFO) @Message(id = 221003, value = "Trying to deploy queue {0}", format = Message.Format.MESSAGE_FORMAT) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index 8b3dae087b..cc2c73df23 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -26,6 +26,7 @@ import java.lang.management.ManagementFactory; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -133,6 +134,7 @@ import org.apache.activemq.artemis.utils.ExecutorFactory; import org.apache.activemq.artemis.utils.OrderedExecutorFactory; import org.apache.activemq.artemis.utils.ReusableLatch; import org.apache.activemq.artemis.utils.SecurityFormatter; +import org.apache.activemq.artemis.utils.TimeUtils; import org.apache.activemq.artemis.utils.VersionLoader; /** @@ -266,6 +268,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { private ServiceRegistry serviceRegistry; + private Date startDate; // Constructors // --------------------------------------------------------------------------------- @@ -369,6 +372,8 @@ public class ActiveMQServerImpl implements ActiveMQServer { return; } + startDate = new Date(); + state = SERVER_STATE.STARTING; if (haPolicy == null) { @@ -771,10 +776,10 @@ public class ActiveMQServerImpl implements ActiveMQServer { scaledDownNodeIDs.clear(); if (identity != null) { - ActiveMQServerLogger.LOGGER.serverStopped("identity=" + identity + ",version=" + getVersion().getFullVersion(), tempNodeID); + ActiveMQServerLogger.LOGGER.serverStopped("identity=" + identity + ",version=" + getVersion().getFullVersion(), tempNodeID, getUptime()); } else { - ActiveMQServerLogger.LOGGER.serverStopped(getVersion().getFullVersion(), tempNodeID); + ActiveMQServerLogger.LOGGER.serverStopped(getVersion().getFullVersion(), tempNodeID, getUptime()); } } @@ -2075,4 +2080,22 @@ public class ActiveMQServerImpl implements ActiveMQServer { } } } + + public String getUptime() { + long delta = getUptimeMillis(); + + if (delta == 0) { + return "not started"; + } + + return TimeUtils.printDuration(delta); + } + + public long getUptimeMillis() { + if (startDate == null) { + return 0; + } + + return new Date().getTime() - startDate.getTime(); + } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/utils/TimeUtils.java b/artemis-server/src/main/java/org/apache/activemq/artemis/utils/TimeUtils.java new file mode 100644 index 0000000000..faf109d5ad --- /dev/null +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/utils/TimeUtils.java @@ -0,0 +1,77 @@ +/** + * 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. + */ +package org.apache.activemq.artemis.utils; + +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.util.Locale; + +/** + * Time utils. + * + * @version + */ +public final class TimeUtils { + + private TimeUtils() { + } + + /** + * Prints the duration in a human readable format as X days Y hours Z minutes etc. + * + * @param uptime the uptime in millis + * @return the time used for displaying on screen or in logs + */ + public static String printDuration(double uptime) { + // Code taken from Karaf + // https://svn.apache.org/repos/asf/karaf/trunk/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/InfoAction.java + + NumberFormat fmtI = new DecimalFormat("###,###", new DecimalFormatSymbols(Locale.ENGLISH)); + NumberFormat fmtD = new DecimalFormat("###,##0.000", new DecimalFormatSymbols(Locale.ENGLISH)); + + uptime /= 1000; + if (uptime < 60) { + return fmtD.format(uptime) + " seconds"; + } + uptime /= 60; + if (uptime < 60) { + long minutes = (long) uptime; + String s = fmtI.format(minutes) + (minutes > 1 ? " minutes" : " minute"); + return s; + } + uptime /= 60; + if (uptime < 24) { + long hours = (long) uptime; + long minutes = (long) ((uptime - hours) * 60); + String s = fmtI.format(hours) + (hours > 1 ? " hours" : " hour"); + if (minutes != 0) { + s += " " + fmtI.format(minutes) + (minutes > 1 ? " minutes" : " minute"); + } + return s; + } + uptime /= 24; + long days = (long) uptime; + long hours = (long) ((uptime - days) * 24); + String s = fmtI.format(days) + (days > 1 ? " days" : " day"); + if (hours != 0) { + s += " " + fmtI.format(hours) + (hours > 1 ? " hours" : " hour"); + } + return s; + } + +} From 6e7ed2348f97d703d87afeaccaf5766eb6740d90 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 22 Dec 2015 14:49:11 +0000 Subject: [PATCH 5/6] added log message to show jolkia path when available, also added a logger --- .../commands/etc/bootstrap-web-settings.txt | 2 +- artemis-web/pom.xml | 14 ++++- .../activemq/artemis/ActiveMQWebLogger.java | 55 +++++++++++++++++++ .../artemis/component/WebServerComponent.java | 14 ++++- 4 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt index 66468dcadc..4ea400a92c 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt @@ -1,4 +1,4 @@ - + diff --git a/artemis-web/pom.xml b/artemis-web/pom.xml index 00366246df..af09fa1151 100644 --- a/artemis-web/pom.xml +++ b/artemis-web/pom.xml @@ -32,6 +32,12 @@ + + org.jboss.logging + jboss-logging-processor + provided + true + org.apache.activemq artemis-dto @@ -64,7 +70,13 @@ ${project.version} - + + + org.jboss.logging + jboss-logging + diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java b/artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java new file mode 100644 index 0000000000..4200955624 --- /dev/null +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/ActiveMQWebLogger.java @@ -0,0 +1,55 @@ +/* + * 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. + */ +package org.apache.activemq.artemis; + +import org.jboss.logging.BasicLogger; +import org.jboss.logging.Logger; +import org.jboss.logging.annotations.LogMessage; +import org.jboss.logging.annotations.Message; +import org.jboss.logging.annotations.MessageLogger; + +/** + * Logger Code 24 + * + * each message id must be 6 digits long starting with 18, the 3rd digit donates the level so + * + * INF0 1 + * WARN 2 + * DEBUG 3 + * ERROR 4 + * TRACE 5 + * FATAL 6 + * + * so an INFO message would be 181000 to 181999 + */ +@MessageLogger(projectCode = "AMQ") +public interface ActiveMQWebLogger extends BasicLogger { + + /** + * The aerogear logger. + */ + ActiveMQWebLogger LOGGER = Logger.getMessageLogger(ActiveMQWebLogger.class, ActiveMQWebLogger.class.getPackage().getName()); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 241001, value = "HTTP Server started at {0}", format = Message.Format.MESSAGE_FORMAT) + void webserverStarted(String bind); + + @LogMessage(level = Logger.Level.INFO) + @Message(id = 241002, value = "Artemis Jolokia REST API available at {0}", format = Message.Format.MESSAGE_FORMAT) + void jolokiaAvailable(String bind); + +} \ No newline at end of file diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java index 23fa462b40..05bf7fd7f9 100644 --- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.component; import java.net.URI; +import org.apache.activemq.artemis.ActiveMQWebLogger; import org.apache.activemq.artemis.components.ExternalComponent; import org.apache.activemq.artemis.dto.AppDTO; import org.apache.activemq.artemis.dto.ComponentDTO; @@ -35,12 +36,14 @@ public class WebServerComponent implements ExternalComponent { private Server server; private HandlerList handlers; private WebServerDTO webServerConfig; + private URI uri; + private String jolokiaUrl; @Override public void configure(ComponentDTO config, String artemisInstance, String artemisHome) throws Exception { webServerConfig = (WebServerDTO) config; String path = webServerConfig.path.startsWith("/") ? webServerConfig.path : "/" + webServerConfig.path; - URI uri = new URI(webServerConfig.bind); + uri = new URI(webServerConfig.bind); server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setPort(uri.getPort()); @@ -53,6 +56,9 @@ public class WebServerComponent implements ExternalComponent { if (webServerConfig.apps != null) { for (AppDTO app : webServerConfig.apps) { deployWar(app.url, app.war, artemisHome, path); + if (app.war.startsWith("jolokia")) { + jolokiaUrl = webServerConfig.bind + "/" + app.url; + } } } @@ -77,8 +83,10 @@ public class WebServerComponent implements ExternalComponent { @Override public void start() throws Exception { server.start(); - - System.out.println("HTTP Server started at " + webServerConfig.bind); + ActiveMQWebLogger.LOGGER.webserverStarted(webServerConfig.bind); + if (jolokiaUrl != null) { + ActiveMQWebLogger.LOGGER.jolokiaAvailable(jolokiaUrl); + } } @Override From 24bf83a3ad4704c21b44efb961ecbf7bdadd4bfc Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Tue, 22 Dec 2015 15:02:04 +0000 Subject: [PATCH 6/6] added broker name to startup message --- .../activemq/artemis/core/server/ActiveMQServerLogger.java | 4 ++-- .../activemq/artemis/core/server/impl/ActiveMQServerImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index 8b31875d50..91d2ce80a5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -82,8 +82,8 @@ public interface ActiveMQServerLogger extends BasicLogger { void serverStarting(String type, Configuration configuration); @LogMessage(level = Logger.Level.INFO) - @Message(id = 221001, value = "Apache ActiveMQ Artemis Message Broker version {0} [nodeID={1}] {2}", format = Message.Format.MESSAGE_FORMAT) - void serverStarted(String fullVersion, SimpleString nodeId, String identity); + @Message(id = 221001, value = "Apache ActiveMQ Artemis Message Broker version {0} [{1}, nodeID={2}] {3}", format = Message.Format.MESSAGE_FORMAT) + void serverStarted(String fullVersion, String name, SimpleString nodeId, String identity); @LogMessage(level = Logger.Level.INFO) @Message(id = 221002, value = "Apache ActiveMQ Artemis Message Broker version {0} [{1}] stopped, uptime {2}", format = Message.Format.MESSAGE_FORMAT) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index cc2c73df23..b0a5a7e5fd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -415,7 +415,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { backupActivationThread.start(); } else { - ActiveMQServerLogger.LOGGER.serverStarted(getVersion().getFullVersion(), nodeManager.getNodeId(), identity != null ? identity : ""); + ActiveMQServerLogger.LOGGER.serverStarted(getVersion().getFullVersion(), configuration.getName(), nodeManager.getNodeId(), identity != null ? identity : "" ); } // start connector service connectorsService = new ConnectorsService(configuration, storageManager, scheduledPool, postOffice, serviceRegistry);