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-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:

- -

Where we are still improving.

-

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

- - - -

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 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..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,15 +82,15 @@ 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", 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) + @Message(id = 221003, value = "Trying to deploy queue {0}", format = Message.Format.MESSAGE_FORMAT) void deployQueue(SimpleString queueName); @LogMessage(level = Logger.Level.INFO) 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..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 @@ -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) { @@ -410,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); @@ -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; + } + +} 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 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