This closes #206 on importing Apollo style of creating instances

I have tested this myself and it looks good, documentation good..
Great contributition!
This commit is contained in:
Clebert Suconic 2015-04-15 18:09:08 -05:00
commit a1bdb3c02a
41 changed files with 741 additions and 764 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ dependency-reduced-pom.xml
# compilation from native # compilation from native
*/*/bin */*/bin
*~ *~
.DS_Store
target target
tests/integration-tests/data/ tests/integration-tests/data/

View File

@ -20,6 +20,7 @@ import io.airlift.command.Cli;
import io.airlift.command.ParseArgumentsUnexpectedException; import io.airlift.command.ParseArgumentsUnexpectedException;
import org.apache.activemq.cli.commands.Action; import org.apache.activemq.cli.commands.Action;
import org.apache.activemq.cli.commands.ActionContext; import org.apache.activemq.cli.commands.ActionContext;
import org.apache.activemq.cli.commands.Create;
import org.apache.activemq.cli.commands.HelpAction; import org.apache.activemq.cli.commands.HelpAction;
import org.apache.activemq.cli.commands.Run; import org.apache.activemq.cli.commands.Run;
import org.apache.activemq.cli.commands.Stop; import org.apache.activemq.cli.commands.Stop;
@ -32,15 +33,27 @@ public class ActiveMQ
public static void main(String[] args) throws Exception public static void main(String[] args) throws Exception
{ {
String instance = System.getProperty("activemq.instance");
Cli.CliBuilder<Action> builder = Cli.<Action>builder("activemq") Cli.CliBuilder<Action> builder = Cli.<Action>builder("activemq")
.withDefaultCommand(HelpAction.class) .withDescription("ActiveMQ Command Line")
.withCommand(Run.class) .withCommand(HelpAction.class)
.withCommand(Stop.class) .withCommand(Create.class)
.withCommand(HelpAction.class) .withDefaultCommand(HelpAction.class);
.withDescription("ActiveMQ Command Line");
if (instance != null)
{
builder = builder
.withCommand(Run.class)
.withCommand(Stop.class);
}
else
{
builder = builder
.withCommand(Create.class);
}
Cli<Action> parser = builder.build(); Cli<Action> parser = builder.build();
try try
{ {
parser.parse(args).execute(ActionContext.system()); parser.parse(args).execute(ActionContext.system());
@ -55,7 +68,7 @@ public class ActiveMQ
{ {
System.err.println(configException.getMessage()); System.err.println(configException.getMessage());
System.out.println(); System.out.println();
System.out.println("Configuration should be specified as 'scheme:location'. Default configuration is 'xml:${ACTIVEMQ_HOME}/config/non-clustered/bootstrap.xml'"); System.out.println("Configuration should be specified as 'scheme:location'. Default configuration is 'xml:${ACTIVEMQ_INSTANCE}/etc/bootstrap.xml'");
} }
} }

View File

@ -0,0 +1,362 @@
package org.apache.activemq.cli.commands;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermission;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import io.airlift.command.Arguments;
import io.airlift.command.Command;
import io.airlift.command.Option;
import static java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE;
import static java.nio.file.attribute.PosixFilePermission.GROUP_READ;
import static java.nio.file.attribute.PosixFilePermission.GROUP_WRITE;
import static java.nio.file.attribute.PosixFilePermission.OTHERS_EXECUTE;
import static java.nio.file.attribute.PosixFilePermission.OTHERS_READ;
import static java.nio.file.attribute.PosixFilePermission.OWNER_EXECUTE;
import static java.nio.file.attribute.PosixFilePermission.OWNER_READ;
import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
/**
* CLI action that creates a broker instance directory.
*/
@Command(name = "create", description = "creates a new broker instance")
public class Create implements Action
{
@Arguments(description = "The instance directory to hold the broker's configuration and data", required = true)
File directory;
@Option(name = "--host", description = "The host name of the broker")
String host;
@Option(name = "--force", description = "Overwrite configuration at destination directory")
boolean force;
@Option(name = "--home", description = "Directory where ActiveMQ is installed")
File home;
@Option(name = "--with-ssl", description = "Generate an SSL enabled configuration")
boolean with_ssl = true;
@Option(name = "--clustered", description = "Enable clustering")
boolean clustered = false;
@Option(name = "--replicated", description = "Enable broker replication")
boolean replicated = false;
@Option(name = "--shared-store", description = "Enable broker shared store")
boolean sharedStore = false;
@Option(name = "--encoding", description = "The encoding that text files should use")
String encoding = "UTF-8";
ActionContext context;
boolean IS_WINDOWS;
boolean IS_CYGWIN;
@Override
public Object execute(ActionContext context) throws Exception
{
try
{
return run(context);
}
catch (Throwable e)
{
e.printStackTrace(context.err);
return e;
}
}
public Object run(ActionContext context) throws Exception
{
this.context = context;
IS_WINDOWS = System.getProperty("os.name").toLowerCase().trim().startsWith("win");
IS_CYGWIN = IS_WINDOWS && System.getenv("OSTYPE") == "cygwin";
if (clustered & sharedStore)
{
}
context.out.println(String.format("Creating ActiveMQ instance at: %s", directory.getCanonicalPath()));
if (host == null)
{
host = directory.getName();
}
new File(directory, "bin").mkdirs();
new File(directory, "etc").mkdirs();
new File(directory, "log").mkdirs();
new File(directory, "tmp").mkdirs();
new File(directory, "data").mkdirs();
write("bin/activemq", null, true);
makeExec("bin/activemq");
write("bin/activemq.cmd", null, false);
write("bin/activemq-service", null, true);
makeExec("bin/activemq-service");
write("bin/run.bat", null, false);
write("bin/run.sh", null, true);
makeExec("bin/run.sh");
write("bin/stop.bat", null, false);
write("bin/stop.sh", null, true);
makeExec("bin/stop.sh");
write("etc/logging.properties", null, false);
write("etc/bootstrap.xml", null, false);
HashMap<String, String> filters = new HashMap<String, String>();
String replicatedSettings = "";
if (replicated)
{
clustered = true;
replicatedSettings = readTextFile("etc/replicated-settings.txt");
}
filters.put("${replicated.settings}", replicatedSettings);
String sharedStoreSettings = "";
if (sharedStore)
{
clustered = true;
sharedStoreSettings = readTextFile("etc/shared-store-settings.txt");
}
filters.put("${hared-store.settings}", sharedStoreSettings);
String clusterSettings = "";
if (clustered)
{
clusterSettings = readTextFile("etc/cluster-settings.txt");
}
filters.put("${cluster.settings}", clusterSettings);
filters.put("${user}", System.getProperty("user.name", ""));
filters.put("${host}", host);
if (home != null)
{
filters.put("${home}", path(home, false));
}
filters.put("${activemq.home}", path(System.getProperty("activemq.home"), false));
filters.put("${activemq.instance}", path(directory, false));
filters.put("${java.home}", path(System.getProperty("java.home"), false));
write("etc/activemq.profile", filters, true);
makeExec("etc/activemq.profile");
write("etc/activemq.profile.cmd", filters, false);
write("etc/activemq-configuration.xml", filters, false);
write("etc/activemq-roles.properties", null, false);
write("etc/activemq-users.properties", null, false);
context.out.println("");
context.out.println("You can now start the broker by executing: ");
context.out.println("");
context.out.println(String.format(" \"%s\" run", path(new File(directory, "bin/activemq"), true)));
File service = new File(directory, "bin/activemq-service");
context.out.println("");
if (!IS_WINDOWS || IS_CYGWIN)
{
// Does it look like we are on a System V init system?
if (new File("/etc/init.d/").isDirectory())
{
context.out.println("Or you can setup the broker as system service and run it in the background:");
context.out.println("");
context.out.println(" sudo ln -s \"%s\" /etc/init.d/".format(service.getCanonicalPath()));
context.out.println(" /etc/init.d/activemq-service start");
context.out.println("");
}
else
{
context.out.println("Or you can run the broker in the background using:");
context.out.println("");
context.out.println(String.format(" \"%s\" start", path(service, true)));
context.out.println("");
}
}
// if ( IS_WINDOWS ) {
//
// context.out.println("Or you can setup the broker as Windows service and run it in the background:");
// context.out.println("");
// context.out.println(String.format(" \"%s\" install", path(service,true)));
// context.out.println(String.format(" \"%s\" start", path(service, true)));
// context.out.println("");
//
// }
return null;
}
private void makeExec(String path) throws IOException
{
File file = new File(directory, path);
Files.setPosixFilePermissions(file.toPath(), new HashSet<PosixFilePermission>(Arrays.asList(
OWNER_READ, OWNER_WRITE, OWNER_EXECUTE,
GROUP_READ, GROUP_WRITE, GROUP_EXECUTE,
OTHERS_READ, OTHERS_EXECUTE
)));
}
String path(String value, boolean unixPaths) throws IOException
{
return path(new File(value), unixPaths);
}
private String path(File value, boolean unixPaths) throws IOException
{
if (unixPaths && IS_CYGWIN)
{
// import scala.sys.process._
// Seq("cygpath", value.getCanonicalPath).!!.trim
return value.getCanonicalPath();
}
else
{
return value.getCanonicalPath();
}
}
private void write(String source, HashMap<String, String> filters, boolean unixTarget) throws IOException
{
write(source, new File(directory, source), filters, unixTarget);
}
private void write(String source, File target, HashMap<String, String> filters, boolean unixTarget) throws IOException
{
if (target.exists() && !force)
{
throw new RuntimeException(String.format("The file '%s' already exists. Use --force to overwrite.", target));
}
String content = readTextFile(source);
if (filters != null)
{
for (Map.Entry<String, String> entry : filters.entrySet())
{
content = replace(content, entry.getKey(), entry.getValue());
}
}
// and then writing out in the new target encoding.. Let's also replace \n with the values
// that is correct for the current platform.
String separator = unixTarget && IS_CYGWIN ? "\n" : System.getProperty("line.separator");
content = content.replaceAll("\\r?\\n", Matcher.quoteReplacement(separator));
ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes(encoding));
try (FileOutputStream fout = new FileOutputStream(target))
{
copy(in, fout);
}
}
private String readTextFile(String source) throws IOException
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
try (InputStream in = this.getClass().getResourceAsStream(source))
{
copy(in, out);
}
return new String(out.toByteArray(), "UTF-8");
}
private void write(String source, File target) throws IOException
{
if (target.exists() && !force)
{
throw new RuntimeException(String.format("The file '%s' already exists. Use --force to overwrite.", target));
}
try (FileOutputStream fout = new FileOutputStream(target))
{
try (InputStream in = this.getClass().getResourceAsStream(source))
{
copy(in, fout);
}
}
}
private boolean canLoad(String name)
{
try
{
this.getClass().getClassLoader().loadClass(name);
return true;
}
catch (Throwable e)
{
return false;
}
}
private String replace(String content, String key, String value)
{
return content.replaceAll(Pattern.quote(key), Matcher.quoteReplacement(value));
}
private int system(File wd, String... command) throws IOException, InterruptedException
{
Process process = Runtime.getRuntime().exec(command, null, wd);
process.getOutputStream().close();
drain(command[0], process.getInputStream(), context.out);
drain(command[0], process.getErrorStream(), context.err);
process.waitFor();
return process.exitValue();
}
private void drain(String threadName, final InputStream is, final OutputStream os)
{
new Thread(threadName)
{
{
setDaemon(true);
}
@Override
public void run()
{
try
{
copy(is, os);
}
catch (Throwable e)
{
}
}
}.start();
}
private void copy(InputStream is, OutputStream os) throws IOException
{
byte[] buffer = new byte[1024 * 4];
int c = is.read(buffer);
while (c >= 0)
{
os.write(buffer, 0, c);
c = is.read(buffer);
}
}
}

View File

@ -40,7 +40,7 @@ import java.util.TimerTask;
public class Run implements Action public class Run implements Action
{ {
@Arguments(description = "Broker Configuration URI, default 'xml:${ACTIVEMQ_HOME}/config/non-clustered/bootstrap.xml'") @Arguments(description = "Broker Configuration URI, default 'xml:${ACTIVEMQ_INSTANCE}/etc/bootstrap.xml'")
String configuration; String configuration;
private ArrayList<ActiveMQComponent> components = new ArrayList<>(); private ArrayList<ActiveMQComponent> components = new ArrayList<>();
@ -55,12 +55,12 @@ public class Run implements Action
/* We use File URI for locating files. The ACTIVEMQ_HOME variable is used to determine file paths. For Windows /* We use File URI for locating files. The ACTIVEMQ_HOME variable is used to determine file paths. For Windows
the ACTIVEMQ_HOME variable will include back slashes (An invalid file URI character path separator). For this the ACTIVEMQ_HOME variable will include back slashes (An invalid file URI character path separator). For this
reason we overwrite the ACTIVEMQ_HOME variable with backslashes replaced with forward slashes. */ reason we overwrite the ACTIVEMQ_HOME variable with backslashes replaced with forward slashes. */
String activemqHome = System.getProperty("activemq.home").replace("\\", "/"); String activemqInstance = System.getProperty("activemq.instance").replace("\\", "/");
System.setProperty("activemq.home", activemqHome); System.setProperty("activemq.instance", activemqInstance);
if (configuration == null) if (configuration == null)
{ {
configuration = "xml:" + activemqHome + "/config/non-clustered/bootstrap.xml"; configuration = "xml:" + activemqInstance + "/etc/bootstrap.xml";
} }
// To support Windows paths as explained above. // To support Windows paths as explained above.
@ -89,7 +89,7 @@ public class Run implements Action
{ {
Class clazz = this.getClass().getClassLoader().loadClass(componentDTO.componentClassName); Class clazz = this.getClass().getClassLoader().loadClass(componentDTO.componentClassName);
ExternalComponent component = (ExternalComponent)clazz.newInstance(); ExternalComponent component = (ExternalComponent)clazz.newInstance();
component.configure(componentDTO, activemqHome); component.configure(componentDTO, activemqInstance);
component.start(); component.start();
components.add(component); components.add(component);
} }

View File

@ -27,7 +27,7 @@ import java.net.URI;
@Command(name = "stop", description = "stops the broker instance") @Command(name = "stop", description = "stops the broker instance")
public class Stop implements Action public class Stop implements Action
{ {
@Arguments(description = "Broker Configuration URI, default 'xml:${ACTIVEMQ_HOME}/config/non-clustered/bootstrap.xml'") @Arguments(description = "Broker Configuration URI, default 'xml:${ACTIVEMQ_INSTANCE}/etc/bootstrap.xml'")
String configuration; String configuration;
@Override @Override
@ -36,12 +36,12 @@ public class Stop implements Action
/* We use File URI for locating files. The ACTIVEMQ_HOME variable is used to determine file paths. For Windows /* We use File URI for locating files. The ACTIVEMQ_HOME variable is used to determine file paths. For Windows
the ACTIVEMQ_HOME variable will include back slashes (An invalid file URI character path separator). For this the ACTIVEMQ_HOME variable will include back slashes (An invalid file URI character path separator). For this
reason we overwrite the ACTIVEMQ_HOME variable with backslashes replaced with forward slashes. */ reason we overwrite the ACTIVEMQ_HOME variable with backslashes replaced with forward slashes. */
String activemqHome = System.getProperty("activemq.home").replace("\\", "/"); String activemqHome = System.getProperty("activemq.instance").replace("\\", "/");
System.setProperty("activemq.home", activemqHome); System.setProperty("activemq.instance", activemqHome);
if (configuration == null) if (configuration == null)
{ {
configuration = "xml:" + activemqHome + "/config/non-clustered/bootstrap.xml"; configuration = "xml:" + activemqHome + "/etc/bootstrap.xml";
} }
// To support Windows paths as explained above. // To support Windows paths as explained above.

View File

@ -0,0 +1,125 @@
#!/bin/sh
# 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.
if [ -z "$ACTIVEMQ_INSTANCE" ] ; then
## resolve links - $0 may be a link to ActiveMQ's home
PRG="$0"
progname=`basename "$0"`
saveddir=`pwd`
# need this for relative symlinks
dirname_prg=`dirname "$PRG"`
cd "$dirname_prg"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
ACTIVEMQ_INSTANCE=`dirname "$PRG"`
cd "$saveddir"
# make it fully qualified
ACTIVEMQ_INSTANCE=`cd "$ACTIVEMQ_INSTANCE/.." && pwd`
fi
# Set Defaults Properties
ACTIVEMQ_LOGGING_CONF="file:$ACTIVEMQ_INSTANCE/etc/logging.properties"
ACTIVEMQ_DATA_DIR=$ACTIVEMQ_INSTANCE/data
ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager
JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M"
CLASSPATH=""
# Load Profile Data
. "$ACTIVEMQ_INSTANCE/etc/activemq.profile"
# Optionally load jars installed in the instance directory.
if [ -d $ACTIVEMQ_INSTANCE/lib ] ; then
for i in `ls $ACTIVEMQ_INSTANCE/lib/*.jar`; do
CLASSPATH=$CLASSPATH:$i
done
fi
for i in `ls $ACTIVEMQ_HOME/lib/*.jar`; do
CLASSPATH=$CLASSPATH:$i
done
# OS specific support.
cygwin=false;
darwin=false;
case "`uname`" in
CYGWIN*) cygwin=true
OSTYPE=cygwin
export OSTYPE
;;
Darwin*) darwin=true
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
fi
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$ACTIVEMQ_INSTANCE" ] &&
ACTIVEMQ_INSTANCE=`cygpath --unix "$ACTIVEMQ_INSTANCE"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=`which java 2> /dev/null `
if [ -z "$JAVACMD" ] ; then
JAVACMD=java
fi
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " We cannot execute $JAVACMD"
exit 1
fi
JAVA_ARGS="$JAVA_ARGS $ACTIVEMQ_CLUSTER_PROPS
-Dactivemq.home="$ACTIVEMQ_HOME"
-Dactivemq.instance="$ACTIVEMQ_INSTANCE"
-Djava.library.path="$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_INSTANCE/bin/lib/linux-x86_64"
-Djava.io.tmpdir="$ACTIVEMQ_INSTANCE/tmp"
-Ddata.dir="$ACTIVEMQ_DATA_DIR"
-Djava.util.logging.manager="$ACTIVEMQ_LOG_MANAGER"
-Dlogging.configuration="$ACTIVEMQ_LOGGING_CONF"
$DEBUG_ARGS"
exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@

View File

@ -19,9 +19,9 @@
service=`basename "$0"` service=`basename "$0"`
# #
# Discover the ACTIVEMQ_BASE from the location of this script. # Discover the ACTIVEMQ_INSTANCE from the location of this script.
# #
if [ -z "$ACTIVEMQ_BASE" ] ; then if [ -z "$ACTIVEMQ_INSTANCE" ] ; then
## resolve links - $0 may be a link to ActiveMQ's home ## resolve links - $0 may be a link to ActiveMQ's home
PRG="$0" PRG="$0"
@ -41,19 +41,19 @@ if [ -z "$ACTIVEMQ_BASE" ] ; then
fi fi
done done
ACTIVEMQ_BASE=`dirname "$PRG"` ACTIVEMQ_INSTANCE=`dirname "$PRG"`
cd "$saveddir" cd "$saveddir"
# make it fully qualified # make it fully qualified
ACTIVEMQ_BASE=`cd "$ACTIVEMQ_BASE/.." && pwd` ACTIVEMQ_INSTANCE=`cd "$ACTIVEMQ_INSTANCE/.." && pwd`
export ACTIVEMQ_BASE export ACTIVEMQ_INSTANCE
fi fi
PID_FILE="${ACTIVEMQ_BASE}/data/activemq.pid" PID_FILE="${ACTIVEMQ_INSTANCE}/data/activemq.pid"
if [ ! -d "${ACTIVEMQ_BASE}/data/" ]; then if [ ! -d "${ACTIVEMQ_INSTANCE}/data/" ]; then
mkdir "${ACTIVEMQ_BASE}/data/" mkdir "${ACTIVEMQ_INSTANCE}/data/"
fi fi
status() { status() {
@ -95,7 +95,7 @@ start() {
return 1 return 1
fi fi
nohup ${ACTIVEMQ_BASE}/bin/activemq run > /dev/null 2> /dev/null & nohup ${ACTIVEMQ_INSTANCE}/bin/activemq run > /dev/null 2> /dev/null &
echo $! > "${PID_FILE}" echo $! > "${PID_FILE}"

View File

@ -0,0 +1,72 @@
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one
rem or more contributor license agreements. See the NOTICE file
rem distributed with this work for additional information
rem regarding copyright ownership. The ASF licenses this file
rem to you under the Apache License, Version 2.0 (the
rem "License"); you may not use this file except in compliance
rem with the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing,
rem software distributed under the License is distributed on an
rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
rem KIND, either express or implied. See the License for the
rem specific language governing permissions and limitations
rem under the License.
setlocal
if NOT "%ACTIVEMQ_INSTANCE%"=="" goto CHECK_ACTIVEMQ_INSTANCE
PUSHD .
CD %~dp0..
set ACTIVEMQ_INSTANCE=%CD%
POPD
:CHECK_ACTIVEMQ_INSTANCE
if exist "%ACTIVEMQ_INSTANCE%\bin\activemq.cmd" goto CHECK_JAVA
:NO_HOME
echo ACTIVEMQ_INSTANCE environment variable is set incorrectly. Please set ACTIVEMQ_INSTANCE.
goto END
:CHECK_JAVA
set _JAVACMD=%JAVACMD%
if "%JAVA_HOME%" == "" goto NO_JAVA_HOME
if not exist "%JAVA_HOME%\bin\java.exe" goto NO_JAVA_HOME
if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
goto RUN_JAVA
:NO_JAVA_HOME
if "%_JAVACMD%" == "" set _JAVACMD=java.exe
echo.
echo Warning: JAVA_HOME environment variable is not set.
echo.
:RUN_JAVA
rem "Set Defaults."
set JAVA_ARGS=-Xmx1024M
set ACTIVEMQ_LOGGING_CONF="file:%ACTIVEMQ_INSTANCE%\config\logging.properties"
set ACTIVEMQ_DATA_DIR="%ACTIVEMQ_INSTANCE%\data"
set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager
rem "Load Profile Config"
call "%ACTIVEMQ_INSTANCE%\etc\activemq.profile.cmd" %*
rem "Create full JVM Args"
set JVM_ARGS=%JAVA_ARGS% -classpath %ACTIVEMQ_INSTANCE%\lib\* -Dactivemq.home=%ACTIVEMQ_HOME% -Dactivemq.instance=%ACTIVEMQ_INSTANCE% -Djava.io.tmpdir=%ACTIVEMQ_INSTANCE%/tmp -Ddata.dir=%ACTIVEMQ_DATA_DIR% -Djava.util.logging.manager=%ACTIVEMQ_LOG_MANAGER% -Dlogging.configuration=%ACTIVEMQ_LOGGING_CONF% -Djava.library.path=%ACTIVEMQ_INSTANCE%\lib\
rem "Set Debug & Cluster props"
if not "%DEBUG_ARGS%"=="" set JVM_ARGS=%JVM_ARGS% %DEBUG_ARGS%
if not "%ACTIVEMQ_CLUSTER_PROPS%"=="" set JVM_ARGS=%JVM_ARGS% %ACTIVEMQ_CLUSTER_PROPS%
"%_JAVACMD%" %JVM_ARGS% org.apache.activemq.cli.ActiveMQ %*
:END
endlocal
GOTO :EOF
:EOF

View File

@ -16,4 +16,4 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
./activemq run $@ `dirname "$0"`/activemq run $@

View File

@ -16,4 +16,4 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
./activemq stop $@ `dirname "$0"`/activemq stop $@

View File

@ -18,7 +18,9 @@ specific language governing permissions and limitations
under the License. under the License.
--> -->
<configuration xmlns="urn:activemq"> <configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<jms xmlns="urn:activemq:jms"> <jms xmlns="urn:activemq:jms">
<queue name="DLQ"/> <queue name="DLQ"/>
<queue name="ExpiryQueue"/> <queue name="ExpiryQueue"/>
@ -53,6 +55,8 @@ under the License.
<acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor> <acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
</acceptors> </acceptors>
${cluster.settings}${replicated.settings}${shared-store.settings}
<security-settings> <security-settings>
<security-setting match="#"> <security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/> <permission type="createNonDurableQueue" roles="guest"/>

View File

@ -15,20 +15,13 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# Path to logging configuration file ACTIVEMQ_HOME='${activemq.home}'
ACTIVEMQ_LOGGING_CONF="file:$ACTIVEMQ_HOME/config/logging.properties"
# Path to data directory
ACTIVEMQ_DATA_DIR=$ACTIVEMQ_HOME/data
# Log manager class
ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager
# Cluster Properties: Used to pass arguments to ActiveMQ which can be referenced in activemq-configuration.xml # Cluster Properties: Used to pass arguments to ActiveMQ which can be referenced in activemq-configuration.xml
#ACTIVEMQ_CLUSTER_PROPS="-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446" #ACTIVEMQ_CLUSTER_PROPS="-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446"
# Java Opts # Java Opts
JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M" #JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M"
# Debug args: Uncomment to enable debug # Debug args: Uncomment to enable debug
#DEBUG_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" #DEBUG_ARGS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"

View File

@ -15,11 +15,14 @@ rem KIND, either express or implied. See the License for the
rem specific language governing permissions and limitations rem specific language governing permissions and limitations
rem under the License. rem under the License.
set ACTIVEMQ_HOME='${activemq.home}'
set ACTIVEMQ_BASE='${activemq.base}'
rem Path to logging configuration file rem Path to logging configuration file
set ACTIVEMQ_LOGGING_CONF=file:%ACTIVEMQ_HOME%\config\logging.properties set ACTIVEMQ_LOGGING_CONF=file:%ACTIVEMQ_BASE%\etc\logging.properties
rem Path to data directory rem Path to data directory
set ACTIVEMQ_DATA_DIR=%ACTIVEMQ_HOME%\data set ACTIVEMQ_DATA_DIR=%ACTIVEMQ_BASE%\data
rem Log manager class rem Log manager class
set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager set ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager

View File

@ -18,13 +18,13 @@
<broker xmlns="http://activemq.org/schema"> <broker xmlns="http://activemq.org/schema">
<basic-security> <basic-security
<users>file:${activemq.home}/config/non-clustered/activemq-users.properties</users> users="file:${activemq.instance}/etc/activemq-users.properties"
<roles>file:${activemq.home}/config/non-clustered/activemq-roles.properties</roles> roles="file:${activemq.instance}/etc/activemq-roles.properties"
<default-user>guest</default-user> default-user="guest"
</basic-security> />
<server configuration="file:${activemq.home}/config/clustered/activemq-configuration.xml"/> <server configuration="file:${activemq.instance}/etc/activemq-configuration.xml"/>
<web bind="http://localhost:8161" path="web"> <web bind="http://localhost:8161" path="web">
<app url="jolokia" war="jolokia-war-1.2.3.war"/> <app url="jolokia" war="jolokia-war-1.2.3.war"/>

View File

@ -0,0 +1,25 @@
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>activemq</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>activemq</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>

View File

@ -42,7 +42,7 @@ handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=DEBUG handler.FILE.level=DEBUG
handler.FILE.properties=autoFlush,fileName handler.FILE.properties=autoFlush,fileName
handler.FILE.autoFlush=true handler.FILE.autoFlush=true
handler.FILE.fileName=${activemq.home}/logs/activemq.log handler.FILE.fileName=${activemq.instance}/log/activemq.log
handler.FILE.formatter=PATTERN handler.FILE.formatter=PATTERN
# Formatter pattern configuration # Formatter pattern configuration

View File

@ -0,0 +1,6 @@
<ha-policy>
<replication>
<master/>
</replication>
</ha-policy>

View File

@ -0,0 +1,6 @@
<ha-policy>
<shared-store>
<master/>
</shared-store>
</ha-policy>

View File

@ -18,25 +18,25 @@ package org.apache.activemq.dto;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "basic-security") @XmlRootElement(name = "basic-security")
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public class BasicSecurityDTO extends SecurityDTO public class BasicSecurityDTO extends SecurityDTO
{ {
@XmlElement(required = true) @XmlAttribute(required = true)
public String users; public String users;
@XmlElement(required = true) @XmlAttribute(required = true)
public String roles; public String roles;
@XmlElement(name = "default-user") @XmlAttribute(name = "default-user")
public String defaultUser; public String defaultUser;
@XmlElement(name = "mask-password") @XmlAttribute(name = "mask-password")
public Boolean maskPassword = false; public Boolean maskPassword = false;
@XmlElement @XmlAttribute
public String passwordCodec; public String passwordCodec;
} }

View File

@ -50,6 +50,7 @@ public class XmlUtil
this.props = props; this.props = props;
} }
@Override
public String getAttributeValue(int index) public String getAttributeValue(int index)
{ {
return filter(super.getAttributeValue(index)); return filter(super.getAttributeValue(index));

View File

@ -96,19 +96,7 @@ for i in `ls $ACTIVEMQ_HOME/lib/*.jar`; do
done done
# Set Defaults Properties # Set Defaults Properties
ACTIVEMQ_LOGGING_CONF="file:$ACTIVEMQ_HOME/config/logging.properties"
ACTIVEMQ_DATA_DIR=$ACTIVEMQ_HOME/data
ACTIVEMQ_LOG_MANAGER=org.jboss.logmanager.LogManager
JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M" JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M"
# Load Runtime Config JAVA_ARGS="$JAVA_ARGS -Dactivemq.home=$ACTIVEMQ_HOME"
if [ -z "$ACTIVEMQ_CONF" ] ; then
ACTIVEMQ_CONF=$ACTIVEMQ_HOME/bin/activemq.conf
else
ACTIVEMQ_CONF="$ACTIVEMQ_CONF"
fi
. $ACTIVEMQ_CONF
JAVA_ARGS="$JAVA_ARGS $ACTIVEMQ_CLUSTER_PROPS -Dactivemq.home=$ACTIVEMQ_HOME -Djava.library.path=$ACTIVEMQ_HOME/bin/lib/linux-i686:$ACTIVEMQ_HOME/bin/lib/linux-x86_64 -Ddata.dir=$ACTIVEMQ_DATA_DIR -Djava.util.logging.manager=$ACTIVEMQ_LOG_MANAGER -Dlogging.configuration=$ACTIVEMQ_LOGGING_CONF $DEBUG_ARGS"
exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@ exec "$JAVACMD" $JAVA_ARGS -classpath $CLASSPATH org.apache.activemq.cli.ActiveMQ $@

View File

@ -1,104 +0,0 @@
<?xml version='1.0'?>
<!--
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.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<jms xmlns="urn:activemq:jms">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</jms>
<core xmlns="urn:activemq:core">
<paging-directory>${data.dir:../data}/paging</paging-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<connectors>
<!-- Default Connector. Returned to clients during broadcast and distributed around cluster. See broadcast and discovery-groups -->
<connector name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</connector>
</connectors>
<acceptors>
<!-- Default ActiveMQ Acceptor. Multi-protocol adapter. Currently supports Core, OpenWire, Stomp and AMQP. -->
<acceptor name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</acceptor>
<!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
<acceptor name="amqp">tcp://${activemq.remoting.amqp.host:localhost}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
<!-- STOMP Acceptor. -->
<acceptor name="stomp">tcp://${activemq.remoting.stomp.host:localhost}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
<!-- HornetQ Compatibility Acceptor. Enables ActiveMQ Core and STOMP for legacy HornetQ clients. -->
<acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>activemq</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>activemq</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ 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.
-->
<broker xmlns="http://activemq.org/schema">
<basic-security>
<users>file:${activemq.home}/examples/jms/queue/src/main/resources/activemq/server0/activemq-users.properties</users>
<roles>file:${activemq.home}/examples/jms/queue/src/main/resources/activemq/server0/activemq-roles.properties</roles>
<default-user>guest</default-user>
</basic-security>
<server configuration="file:${activemq.home}/examples/jms/queue/src/main/resources/activemq/server0/activemq-configuration.xml"/>
<web bind="http://localhost:8161" path="web">
<app url="jolokia" war="jolokia-war-1.2.3.war"/>
</web>
</broker>

View File

@ -1,17 +0,0 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,17 +0,0 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ 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.
-->
<broker xmlns="http://activemq.org/schema">
<basic-security>
<users>file:${activemq.home}/config/non-clustered/activemq-users.properties</users>
<roles>file:${activemq.home}/config/non-clustered/activemq-roles.properties</roles>
<default-user>guest</default-user>
</basic-security>
<server configuration="file:${activemq.home}/config/non-clustered/activemq-configuration.xml"/>
<web bind="http://localhost:8161" path="web">
<app url="jolokia" war="jolokia-war-1.2.3.war"/>
</web>
</broker>

View File

@ -1,115 +0,0 @@
<?xml version='1.0'?>
<!--
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.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<jms xmlns="urn:activemq:jms">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</jms>
<core xmlns="urn:activemq:core">
<!--
if you want to run this as a backup on different ports you would need to set the following variable
export CLUSTER_PROPS="-Dactivemq.remoting.netty.host=localhost -Dactivemq.remoting.netty.port=5545 -Dactivemq.remoting.netty.batch.port=5555 -Dactivemq.backup=true"
-->
<paging-directory>${data.dir:../data}/paging</paging-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<connectors>
<!-- Default Connector. Returned to clients during broadcast and distributed around cluster. See broadcast and discovery-groups -->
<connector name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</connector>
</connectors>
<acceptors>
<!-- Default ActiveMQ Acceptor. Multi-protocol adapter. Currently supports Core, OpenWire, Stomp and AMQP. -->
<acceptor name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</acceptor>
<!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
<acceptor name="amqp">tcp://${activemq.remoting.amqp.host:localhost}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
<!-- STOMP Acceptor. -->
<acceptor name="stomp">tcp://${activemq.remoting.stomp.host:localhost}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
<!-- HornetQ Compatibility Acceptor. Enables ActiveMQ Core and STOMP for legacy HornetQ clients. -->
<acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>activemq</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>activemq</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
<ha-policy>
<replication>
<master/>
</replication>
</ha-policy>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -1,17 +0,0 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,17 +0,0 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ 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.
-->
<broker xmlns="http://activemq.org/schema">
<basic-security>
<users>file:${activemq.home}/config/non-clustered/activemq-users.properties</users>
<roles>file:${activemq.home}/config/non-clustered/activemq-roles.properties</roles>
<default-user>guest</default-user>
</basic-security>
<server configuration="file:${activemq.home}/config/replicated/activemq-configuration.xml"/>
<web bind="http://localhost:8161" path="web">
<app url="jolokia" war="jolokia-war-1.2.3.war"/>
</web>
</broker>

View File

@ -1,115 +0,0 @@
<?xml version='1.0'?>
<!--
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.
-->
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
<jms xmlns="urn:activemq:jms">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</jms>
<core xmlns="urn:activemq:core">
<!--
if you want to run this as a backup on different ports you would need to set the following variable
export CLUSTER_PROPS="-Dactivemq.remoting.netty.host=localhost -Dactivemq.remoting.netty.port=5545 -Dactivemq.remoting.netty.batch.port=5555 -Dactivemq.backup=true"
-->
<paging-directory>${data.dir:../data}/paging</paging-directory>
<bindings-directory>${data.dir:../data}/bindings</bindings-directory>
<journal-directory>${data.dir:../data}/journal</journal-directory>
<journal-min-files>10</journal-min-files>
<large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
<connectors>
<!-- Default Connector. Returned to clients during broadcast and distributed around cluster. See broadcast and discovery-groups -->
<connector name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</connector>
</connectors>
<acceptors>
<!-- Default ActiveMQ Acceptor. Multi-protocol adapter. Currently supports Core, OpenWire, Stomp and AMQP. -->
<acceptor name="activemq">tcp://${activemq.remoting.default.host:localhost}:${activemq.remoting.default.port:61616}</acceptor>
<!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
<acceptor name="amqp">tcp://${activemq.remoting.amqp.host:localhost}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
<!-- STOMP Acceptor. -->
<acceptor name="stomp">tcp://${activemq.remoting.stomp.host:localhost}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
<!-- HornetQ Compatibility Acceptor. Enables ActiveMQ Core and STOMP for legacy HornetQ clients. -->
<acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:localhost}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
</acceptors>
<broadcast-groups>
<broadcast-group name="bg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<broadcast-period>5000</broadcast-period>
<connector-ref>activemq</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="dg-group1">
<group-address>231.7.7.7</group-address>
<group-port>9876</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="my-cluster">
<address>jms</address>
<connector-ref>activemq</connector-ref>
<discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection>
</cluster-connections>
<ha-policy>
<shared-store>
<master/>
</shared-store>
</ha-policy>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="guest"/>
<permission type="deleteNonDurableQueue" roles="guest"/>
<permission type="consume" roles="guest"/>
<permission type="send" roles="guest"/>
</security-setting>
</security-settings>
<address-settings>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>jms.queue.DLQ</dead-letter-address>
<expiry-address>jms.queue.ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<max-size-bytes>10485760</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>BLOCK</address-full-policy>
</address-setting>
</address-settings>
</core>
</configuration>

View File

@ -1,17 +0,0 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,17 +0,0 @@
## ---------------------------------------------------------------------------
## 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.
## ---------------------------------------------------------------------------
guest=guest

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ 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.
-->
<broker xmlns="http://activemq.org/schema">
<basic-security>
<users>file:${activemq.home}/config/non-clustered/activemq-users.properties</users>
<roles>file:${activemq.home}/config/non-clustered/activemq-roles.properties</roles>
<default-user>guest</default-user>
</basic-security>
<server configuration="file:${activemq.home}/config/shared-store/activemq-configuration.xml"/>
<web bind="http://localhost:8161" path="web">
<app url="jolokia" war="jolokia-war-1.2.3.war"/>
</web>
</broker>

View File

@ -31,8 +31,8 @@ Using aptitude, (e.g. on Ubuntu or Debian system):
apt-get install libaio apt-get install libaio
Stand-alone ActiveMQ Server Installing the Standalone Distribution
=========================== ======================================
After downloading the distribution, unzip it into your chosen directory. After downloading the distribution, unzip it into your chosen directory.
At this point it should be possible to [run straight out of the At this point it should be possible to [run straight out of the
@ -41,11 +41,6 @@ structure:
|___ bin |___ bin
| |
|___ config
| |___ jboss-as-4
| |___ jboss-as-5
| |___ stand-alone
|
|___ docs |___ docs
| |___ api | |___ api
| |___ quickstart-guide | |___ quickstart-guide
@ -65,11 +60,6 @@ structure:
- `bin` -- binaries and scripts needed to run ActiveMQ. - `bin` -- binaries and scripts needed to run ActiveMQ.
- `config` -- configuration files needed to configure ActiveMQ. This
contains configurations to run ActiveMQ either in stand-alone or
inside JBoss AS 4 and 5. Please refer to the reference guide for
details on configuration.
- `docs` -- guides and javadocs for ActiveMQ - `docs` -- guides and javadocs for ActiveMQ
- `examples` -- JMS and Java EE examples. Please refer to the 'running - `examples` -- JMS and Java EE examples. Please refer to the 'running
@ -81,5 +71,3 @@ structure:
- `schemas` -- XML Schemas used to validate ActiveMQ configuration - `schemas` -- XML Schemas used to validate ActiveMQ configuration
files files

View File

@ -1,106 +1,53 @@
Starting The Server Creating a Broker Instance
=================== ==========================
Standalone ActiveMQ
===================
To run a stand-alone server, open up a shell or command prompt and A broker instance is the directory containing all the configuration and runtime
navigate into the `bin` directory. Then execute `./activemq run` (or data, such as logs and data files, associated with a broker process. It is recommended that
`./activemq.cmd run` on Windows) and you should see the following output you do *not* create the instance directory under `${ACTIVEMQ_HOME}`. This separation is
encouraged so that you can more easily upgrade when the next version of ActiveMQ is released.
bin$ ./activemq run On Unix systems, it is a common convention to store this kind of runtime data under
the `/var/lib` directory. For example, to create an instance at '/var/lib/mybroker', run
the following commands in your command line shell:
11:05:06,589 INFO [org.apache.activemq.integration.bootstrap] HQ101000: Starting ActiveMQ Server cd /var/lib
... ${ACTIVEMQ_HOME}/bin/activemq create mybroker
11:05:10,848 INFO [org.apache.activemq.core.server] HQ221001: ActiveMQ Server version 2.5.0.SNAPSHOT (Wild Hornet, 125) [e32ae252-52ee-11e4-a716-7785dc3013a3]
ActiveMQ is now running. A broker instance directory will contain the following sub directories:
Both the run and the stop scripts use the config under * `bin`: holds execution scripts associated with this instance.
`config/non-clustered` by default. The configuration can be changed by * `etc`: hold the instance configuration files
running `./activemq run xml:../config/non-clustered/bootstrap.xml` or * `data`: holds the data files used for storing persistent messages
another config of your choosing. * `log`: holds rotating log files
* `tmp`: holds temporary files that are safe to delete between broker runs
The server can be stopped by running `./activemq stop` At this point you may want to adjust the default configuration located in
the `etc` directory.
ActiveMQ In Wildfly Environment variables are used to provide ease of changing ports, hosts and
=================== data directories used and can be found in `etc/activemq.profile` on linux and
`etc\activemq.profile.cmd` on Windows.
ActiveMQ is the Default Messaging Provider in the [Wildfly Application Starting and Stopping a Broker Instance
Server](http://www.wildfly.org/) To run the server you need to run the =======================================
standalone-full.xml configuration by running the command
'./standalone.sh -c standalone-full.xml'. You will see something like:/
bin$ ./standalone.sh -c standalone-full.xml Assuming you created the broker instance under `/var/lib/mybroker` all you need
========================================================================= to do start running the broker instance is execute:
JBoss Bootstrap Environment /var/lib/mybroker/bin/activemq run
JBOSS_HOME: /home/andy/projects/wildfly/build/target/wildfly-8.0.0.Beta1-SNAPSHOT Now that the broker is running, you can optionally run some of the included
examples to verify the the broker is running properly.
JAVA: java To stop the Apache ActiveMQ instance you will use the same `activemq` script, but with
the `stop argument`. Example:
JAVA_OPTS: -server -XX:+UseCompressedOops -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true /var/lib/mybroker/bin/activemq stop
========================================================================= By default the `etc/bootstrap.xml` configuration is
used. The configuration can be changed e.g. by running
`./activemq run -- xml:path/to/bootstrap.xml` or another
config of your choosing.
14:47:33,642 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final
14:47:34,780 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.0.Beta2
14:47:34,875 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.0.0.Beta1-SNAPSHOT "WildFly" starting
14:47:40,382 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
14:47:40,383 INFO [org.xnio] (MSC service thread 1-15) XNIO version 3.1.0.CR7
14:47:40,402 INFO [org.xnio.nio] (MSC service thread 1-15) XNIO NIO Implementation Version 3.1.0.CR7
14:47:40,488 INFO [org.jboss.remoting] (MSC service thread 1-15) JBoss Remoting version 4.0.0.Beta1
14:47:40,547 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 36) JBAS010280: Activating Infinispan subsystem.
14:47:40,560 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 47) JBAS011800: Activating Naming Subsystem
14:47:40,560 INFO [org.jboss.as.security] (ServerService Thread Pool -- 52) JBAS013171: Activating Security Subsystem
14:47:40,567 INFO [org.jboss.as.jacorb] (ServerService Thread Pool -- 37) JBAS016300: Activating JacORB Subsystem
14:47:40,571 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 43) JBAS012605: Activated the following JSF Implementations: [main]
14:47:40,574 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) JBAS015537: Activating WebServices Extension
14:47:40,721 INFO [org.jboss.as.connector.logging] (MSC service thread 1-6) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.0.Final)
14:47:41,321 INFO [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service
14:47:41,323 INFO [org.jboss.as.mail.extension] (MSC service thread 1-11) JBAS015400: Bound mail session [java:jboss/mail/Default]
14:47:41,552 INFO [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017502: Undertow 1.0.0.Beta16 starting
14:47:41,552 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) JBAS017502: Undertow 1.0.0.Beta16 starting
14:47:41,573 INFO [org.jboss.as.security] (MSC service thread 1-6) JBAS013170: Current PicketBox version=4.0.17.SP1
14:47:41,775 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 31) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
14:47:41,777 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-16) JBAS010417: Started Driver service with driver-name = h2
14:47:42,085 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) JBAS017527: Creating file handler for path /home/andy/projects/wildfly/build/target/wildfly-8.0.0.Beta1-SNAPSHOT/welcome-content
14:47:42,086 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017525: Started server default-server.
14:47:42,088 INFO [org.wildfly.extension.undertow] (MSC service thread 1-13) JBAS017531: Host default-host starting
14:47:42,471 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080
14:47:42,823 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-10) JBAS015012: Started FileSystemDeploymentService for directory /home/andy/projects/wildfly/build/target/wildfly-8.0.0.Beta1-SNAPSHOT/standalone/deployments
14:47:42,882 INFO [org.jboss.as.remoting] (MSC service thread 1-16) JBAS017100: Listening on 127.0.0.1:9999
14:47:43,037 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221000: live server is starting with configuration ActiveMQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=/home/andy/projects/wildfly/build/target/wildfly-8.0.0.Beta1-SNAPSHOT/standalone/data/messagingjournal,bindingsDirectory=/home/andy/projects/wildfly/build/target/wildfly-8.0.0.Beta1-SNAPSHOT/standalone/data/messagingbindings,largeMessagesDirectory=/home/andy/projects/wildfly/build/target/wildfly-8.0.0.Beta1-SNAPSHOT/standalone/data/messaginglargemessages,pagingDirectory=/home/andy/projects/wildfly/build/target/wildfly-8.0.0.Beta1-SNAPSHOT/standalone/data/messagingpaging)
14:47:43,062 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221006: Waiting to obtain live lock
14:47:43,103 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221012: Using AIO Journal
14:47:43,313 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ224067: Adding protocol support CORE
14:47:43,426 INFO [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.1.Final
14:47:43,448 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ224067: Adding protocol support AMQP
14:47:43,451 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ224067: Adding protocol support STOMP
14:47:43,453 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ224067: Adding protocol support STOMP_WS
14:47:43,567 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221034: Waiting to obtain live lock
14:47:43,567 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221035: Live Server Obtained live lock
14:47:43,777 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
14:47:43,781 INFO [org.jboss.as.jacorb] (MSC service thread 1-1) JBAS016330: CORBA ORB Service started
14:47:44,115 INFO [org.jboss.as.jacorb] (MSC service thread 1-13) JBAS016328: CORBA Naming Service started
14:47:44,345 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS018210: Register web context: /activemq-server
14:47:44,361 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221020: Started Netty Acceptor version 3.6.6.Final-90e1eb2 127.0.0.1:5455 for CORE protocol
14:47:44,362 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221020: Started Netty Acceptor version 3.6.6.Final-90e1eb2 127.0.0.1:61616 for CORE protocol
14:47:44,364 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221020: Started Netty Acceptor version 3.6.6.Final-90e1eb2 org.apache.activemq.default.servlet:61616 for CORE protocol
14:47:44,366 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221007: Server is now live
14:47:44,366 INFO [org.apache.activemq.core.server] (ServerService Thread Pool -- 58) HQ221001: ActiveMQ Server version 2.4.0.Beta2 (Andromedian Flyer, 123) [bcc1cd10-2bfb-11e3-ad5f-9f88840f9e1a]
14:47:44,435 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 58) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
14:47:44,437 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 59) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/ServletConnectionFactory
14:47:44,439 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 60) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
14:47:44,462 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) JBAS010406: Registered connection factory java:/JmsXA
14:47:44,531 INFO [org.apache.activemq.ra] (MSC service thread 1-3) ActiveMQ resource adaptor started
14:47:44,532 INFO [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-3) IJ020002: Deployed: file://RaActivatoractivemq-ra
14:47:44,535 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-12) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]
14:47:44,536 INFO [org.jboss.as.messaging] (MSC service thread 1-15) JBAS011601: Bound messaging object to jndi name java:jboss/DefaultJMSConnectionFactory
14:47:44,719 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
14:47:44,720 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
14:47:44,721 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.0.0.Beta1-SNAPSHOT "WildFly" started in 12184ms - Started 213 of 249 services (73 services are lazy, passive or on-demand)

View File

@ -9,45 +9,59 @@ For the remainder of this chapter when we talk about the Apache ActiveMQ server
we mean the Apache ActiveMQ standalone server, in its default configuration we mean the Apache ActiveMQ standalone server, in its default configuration
with a JMS Service enabled. with a JMS Service enabled.
## Starting and Stopping the standalone server This document will refer to the full path of the directory where the ActiveMQ
distribution has been extracted to as `${ACTIVEMQ_HOME}` directory.
In the distribution you will find a directory called `bin`. ## Creating a Broker Instance
`cd` into that directory and you will find a Unix/Linux script called A broker instance is the directory containing all the configuration and runtime
`activemq` and a Windows script called `activemq.cmd`. data, such as logs and data files, associated with a broker process. It is recommended that
you do *not* create the instance directory under `${ACTIVEMQ_HOME}`. This separation is
encouraged so that you can more easily upgrade when the next version of ActiveMQ is released.
To start the Apache ActiveMQ instance on Unix/Linux type `./activemq run` On Unix systems, it is a common convention to store this kind of runtime data under
the `/var/lib` directory. For example, to create an instance at '/var/lib/mybroker', run
the following commands in your command line shell:
To start the Apache ActiveMQ instance on Windows type `activemq.cmd run` cd /var/lib
${ACTIVEMQ_HOME}/bin/activemq create mybroker
These scripts are very simple and basically just set-up the classpath A broker instance directory will contain the following sub directories:
and some JVM parameters and bootstrap the server using
[Airline](https://github.com/airlift/airline).
To stop the Apache ActiveMQ instance you will use the same `activemq` script. * `bin`: holds execution scripts associated with this instance.
* `etc`: hold the instance configuration files
* `data`: holds the data files used for storing persistent messages
* `log`: holds rotating log files
* `tmp`: holds temporary files that are safe to delete between broker runs
To run on Unix/Linux type `./activemq stop` At this point you may want to adjust the default configuration located in
the `etc` directory.
To run on Windows type `activemq.cmd stop` ### Starting and Stopping a Broker Instance
Please note that Apache ActiveMQ requires a Java 6 or later runtime to run. Assuming you created the broker instance under `/var/lib/mybroker` all you need
to do start running the broker instance is execute:
By default the `config/non-clustered/bootstrap.xml` configuration is /var/lib/mybroker/bin/activemq run
Now that the broker is running, you can optionally run some of the included
examples to verify the the broker is running properly.
To stop the Apache ActiveMQ instance you will use the same `activemq` script, but with
the `stop argument`. Example:
/var/lib/mybroker/bin/activemq stop
Please note that Apache ActiveMQ requires a Java 7 or later runtime to run.
By default the `etc/bootstrap.xml` configuration is
used. The configuration can be changed e.g. by running used. The configuration can be changed e.g. by running
`./activemq run -- xml:../config/clustered/bootstrap.xml` or another `./activemq run -- xml:path/to/bootstrap.xml` or another
config of your choosing. config of your choosing.
Environment variables are used to provide ease of changing ports, hosts and Environment variables are used to provide ease of changing ports, hosts and
data directories used and can be found in `activemq.conf` on linux and data directories used and can be found in `etc/activemq.profile` on linux and
`activemq.conf.bat` on Windows. A different properties file can be used by `etc\activemq.profile.cmd` on Windows.
setting the property `ACTIVEMQ_CONF`, on linux this would be:
export ACTIVEMQ_CONF=myenv.env
or on Windows
set ACTIVEMQ_CONF=myenv.env
## Server JVM settings ## Server JVM settings