From c5a88336fa1cf2d21c4ee4a5b6b36f58d23750c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 15 Jun 2023 15:49:39 +0200 Subject: [PATCH 01/12] [AMQ-9280] Upgrade to commons-io 2.13.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cc748786482..1f010bec0d7 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ 3.2.2 1.3.4 2.9.0 - 2.12.0 + 2.13.0 3.12.0 1.2 2.11.1 From 90f96a02992b64ba330c6e6b62e6a8fc3d4d8120 Mon Sep 17 00:00:00 2001 From: u8675309 <58795251+u8675309@users.noreply.github.com> Date: Mon, 12 Jun 2023 12:10:54 -0600 Subject: [PATCH 02/12] [AMQ-9283] Fix memory leak with STOMP unsubscribe --- .../org/apache/activemq/transport/stomp/ProtocolConverter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java index 1f6f9069d5c..9981452e635 100644 --- a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java +++ b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java @@ -718,6 +718,7 @@ protected void onStompUnsubscribe(StompFrame command) throws ProtocolException { if (subscriptionId != null) { StompSubscription sub = this.subscriptions.remove(subscriptionId); if (sub != null) { + subscriptionsByConsumerId.remove(sub.getConsumerInfo().getConsumerId()); sendToActiveMQ(sub.getConsumerInfo().createRemoveCommand(), createResponseHandler(command)); return; } From 95e3c2a1aa0d4962ad6a22a4422a9314875f824b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20Onofr=C3=A9?= Date: Wed, 21 Jun 2023 07:38:36 +0200 Subject: [PATCH 03/12] [AMQ-9233] Prevent NPE in SubQueueSelectorCacheBroker --- .../org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java b/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java index 322e1e71260..50cdaf35500 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java +++ b/activemq-broker/src/main/java/org/apache/activemq/plugin/SubQueueSelectorCacheBroker.java @@ -180,7 +180,7 @@ public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws if (singleSelectorPerDestination) { String destinationName = info.getDestination().getQualifiedName(); Set selectors = subSelectorCache.get(destinationName); - if (info.getSelector() == null && selectors.size() > 1) { + if (info.getSelector() == null && (selectors != null && selectors.size() > 1)) { boolean removed = selectors.remove(MATCH_EVERYTHING); LOG.debug("A non-selector consumer has dropped. Removing the catchall matching pattern 'TRUE'. Successful? " + removed); } From 85276d347688611672b797561de303e609ae9519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Wed, 21 Jun 2023 11:47:55 +0200 Subject: [PATCH 04/12] [AMQ-8149] Add tooling to create activemq docker image (including multi-platform support) --- assembly/src/docker/Dockerfile | 38 ++++++ assembly/src/docker/README.md | 154 +++++++++++++++++++++++++ assembly/src/docker/build.sh | 133 +++++++++++++++++++++ assembly/src/docker/docker-compose.yml | 39 +++++++ 4 files changed, 364 insertions(+) create mode 100644 assembly/src/docker/Dockerfile create mode 100644 assembly/src/docker/README.md create mode 100755 assembly/src/docker/build.sh create mode 100644 assembly/src/docker/docker-compose.yml diff --git a/assembly/src/docker/Dockerfile b/assembly/src/docker/Dockerfile new file mode 100644 index 00000000000..95338a2032c --- /dev/null +++ b/assembly/src/docker/Dockerfile @@ -0,0 +1,38 @@ +################################################################################ +# 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. +################################################################################ + +FROM eclipse-temurin:11-jre + +# ActiveMQ environment variables +ENV ACTIVEMQ_INSTALL_PATH /opt +ENV ACTIVEMQ_HOME $ACTIVEMQ_INSTALL_PATH/apache-activemq +ENV ACTIVEMQ_EXEC exec +ENV PATH $PATH:$ACTIVEMQ_HOME/bin +#WORKDIR $ACTIVEMQ_HOME + +# activemq_dist can point to a directory or a tarball on the local system +ARG activemq_dist=NOT_SET + +# Install build dependencies and activemq +ADD $activemq_dist $ACTIVEMQ_INSTALL_PATH +RUN set -x && \ + cp -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-* $ACTIVEMQ_HOME && \ + rm -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-* + +EXPOSE 8161 61616 5672 61613 1883 61614 +CMD ["activemq", "console"] diff --git a/assembly/src/docker/README.md b/assembly/src/docker/README.md new file mode 100644 index 00000000000..f945c91b5ad --- /dev/null +++ b/assembly/src/docker/README.md @@ -0,0 +1,154 @@ + +# Apache ActiveMQ docker + +## Installation + +Install the most recent stable version of docker +https://docs.docker.com/installation/ + +Install the most recent stable version of docker-compose +https://docs.docker.com/compose/install/ + +If you want to build multi-platform (OS/Arch) Docker images, then you must install +[`buildx`](https://docs.docker.com/buildx/working-with-buildx/). +On macOS, an easy way to install `buildx` is to install [Docker Desktop Edge](https://docs.docker.com/docker-for-mac/edge-release-notes/). + +## Build + +Images are based on the Docker official [Eclipse Temurin 11 JRE](https://hub.docker.com/_/eclipse-temurin/tags?page=1&name=11-jre) image. If you want to +build the ActiveMQ image you have the following choices: + +1. Create the docker image from a local distribution package +2. Create the docker image from an Apache ActiveMQ archive, for example (apache-activemq-5.18.1.tar.gz) +3. Create the docker image from a specific version of Apache ActiveMQ +4. Create the docker image from remote or local custom Apache ActiveMQ distribution + +If you run `build.sh` without arguments then you could see how to usage this command. + +```bash +Usage: + build.sh --from-local-dist [--archive ] [--image-name ] [--build-multi-platform ] + build.sh --from-release --activemq-version [--image-name ] [--build-multi-platform ] + build.sh --help + + If the --image-name flag is not used the built image name will be 'activemq'. + Check the supported build platforms; you can verify with this command: docker buildx ls + The supported platforms (OS/Arch) depend on the build's base image, in this case [eclipse-temurin:11-jre](https://hub.docker.com/_/eclipse-temurin). +``` + +To create the docker image from local distribution) you can execute the command +below. Remember that before you can successfully run this command, you must build +the project (for example with the command `mvn clean install -DskipTests`). + +```bash +./build.sh --from-local-dist +``` + +For create the docker image from the local dist version but with the archive, +you can execute the below command. Remember that before you can successfully run +this command. + +```bash +./build.sh --from-local-dist --archive ~/path/to/apache-activemq-5.18.1.tar.gz +``` + +You can also specify the image name with the `--image-name` flag, for example +(replacing the version, image name, and targets as appropriate): + +```bash +./build.sh --from-local-dist --archive ~/Downloads/apache-activemq-5.18.1.tar.gz --image-name myrepo/myamq:x.x.x +``` + +If you want to build the docker image for a specific version of ActiveMQ +you can run `build.sh` command in this way (replacing the version, image name, +and targets as appropriate): + +```bash +./build.sh --from-release --activemq-version 5.18.1 --image-name myrepo/myamq:x.x.x +``` + +If you want to build the container for a specific version of ActiveMQ and +specific version of the platform, and push the image to the Docker Hub repository, +you can use this command (replacing the version, image name, and targets as appropriate): + +```bash +./build.sh --from-release --activemq-version 5.18.1 --image-name myrepo/myamq:x.x.x \ + --build-multi-platform linux/arm64,linux/arm/v7,linux/amd64 +``` + +Below is the output you should get from running the previous command. + +``` +Downloading apache-activemq-5.18.1.tar.gz from https://downloads.apache.org/activemq/5.18.1/ +Checking if buildx installed... +Found buildx {github.com/docker/buildx v0.3.1-tp-docker 6db68d029599c6710a32aa7adcba8e5a344795a7} on your docker system +Starting build of the docker image for the platform linux/arm64,linux/arm/v7,linux/amd64 +[+] Building 15.8s (16/16) FINISHED +... +``` + +## Run + +* Run ActiveMQ + +``` +docker-compose run activemq activemq +``` + +or + +``` +docker run --name activemq activemq activemq +``` + +* Run ActiveMQ as a daemon + +``` +docker-compose up +``` + +or + +``` +docker run --name activemq +``` + +* Kill ActiveMQ + +``` +docker-compose kill +``` + +or + +``` +docker kill activemq +``` + +### Ports + +* ActiveMQ web console on `8161` +* ActiveMQ tcp connector on `61616` +* ActiveMQ AMQP connector on `5672` +* ActiveMQ STOMP connector on `61613` +* ActiveMQ MQTT connector on `1883` +* ActiveMQ WS connector on `61614` + +Edit the `docker-compose.yml` file to edit port settings. diff --git a/assembly/src/docker/build.sh b/assembly/src/docker/build.sh new file mode 100755 index 00000000000..7411ec0831c --- /dev/null +++ b/assembly/src/docker/build.sh @@ -0,0 +1,133 @@ +#!/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. +################################################################################ + +usage() { + cat <] [--image-name ] [--build-multi-platform ] + build.sh --from-release --activemq-version [--image-name ] [--build-multi-platform ] + build.sh --help + + If the --image-name flag is not used the built image name will be 'activemq'. + Check the supported build platforms; you can verify with this command: docker buildx ls + The supported platforms (OS/Arch) depend on the build's base image, in this case [eclipse-temurin:11-jre](https://hub.docker.com/_/eclipse-temurin). + +HERE + exit 1 +} + +while [ $# -ge 1 ] +do +key="$1" + case $key in + --from-local-dist) + FROM_LOCAL="true" + ;; + --from-release) + FROM_RELEASE="true" + ;; + --image-name) + IMAGE_NAME="$2" + shift + ;; + --archive) + ARCHIVE="$2" + shift + ;; + --activemq-version) + ACTIVEMQ_VERSION="$2" + shift + ;; + --build-multi-platform) + BUILD_MULTI_PLATFORM="$2" + shift + ;; + --help) + usage + ;; + *) + # unknown option + ;; + esac + shift +done + +IMAGE_NAME=${IMAGE_NAME:-activemq} + +# TMPDIR must be contained within the working directory so it is part of the +# Docker context. (i.e. it can't be mktemp'd in /tmp) +TMPDIR=_TMP_ + +cleanup() { + rm -rf "${TMPDIR}" +} +trap cleanup EXIT + +mkdir -p "${TMPDIR}" + +if [ -n "${FROM_RELEASE}" ]; then + + [ -n "${ACTIVEMQ_VERSION}" ] || usage + + ACTIVEMQ_BASE_URL="https://dlcdn.apache.org/activemq/${ACTIVEMQ_VERSION}/" + ACTIVEMQ_DIST_FILE_NAME="apache-activemq-${ACTIVEMQ_VERSION}-bin.tar.gz" + CURL_OUTPUT="${TMPDIR}/${ACTIVEMQ_DIST_FILE_NAME}" + + echo "Downloading ${ACTIVEMQ_DIST_FILE_NAME} from ${ACTIVEMQ_BASE_URL}" + curl -s "${ACTIVEMQ_BASE_URL}${ACTIVEMQ_DIST_FILE_NAME}" --output "${CURL_OUTPUT}" + + ACTIVEMQ_DIST="${CURL_OUTPUT}" + +elif [ -n "${FROM_LOCAL}" ]; then + + if [ -n "${ARCHIVE}" ]; then + DIST_DIR=${ARCHIVE} + else + DIST_DIR="target/apache-activemq-*.tar.gz" + fi + ACTIVEMQ_DIST=${TMPDIR}/apache-activemq.tar.gz + echo "Using ActiveMQ dist: ${DIST_DIR}" + cp ${DIST_DIR} ${ACTIVEMQ_DIST} + +else + + usage + +fi + +if [ -n "${BUILD_MULTI_PLATFORM}" ]; then + echo "Checking if buildx installed..." + VERSION_BUILD_X=$(docker buildx version) > /dev/null 2>&1 + + if [ $? -eq 0 ]; then + echo "Found buildx {${VERSION_BUILD_X}} on your docker system" + echo "Starting build of the docker image for the platform ${BUILD_MULTI_PLATFORM}" + + BUILD_X="buildx" + BUILD_X_FLAG="--push" + BUILD_X_PLATFORM="--platform ${BUILD_MULTI_PLATFORM}" + else + echo "Error: buildx not installed with your docker system" + exit 2 + fi + +fi + +docker ${BUILD_X} build ${BUILD_X_PLATFORM} --build-arg activemq_dist="${ACTIVEMQ_DIST}" ${BUILD_X_FLAG} -t "${IMAGE_NAME}" . diff --git a/assembly/src/docker/docker-compose.yml b/assembly/src/docker/docker-compose.yml new file mode 100644 index 00000000000..232ec86996a --- /dev/null +++ b/assembly/src/docker/docker-compose.yml @@ -0,0 +1,39 @@ +################################################################################ +# 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. +################################################################################ + +version: "2.1" +services: + activemq: + image: ${ACTIVEMQ_DOCKER_IMAGE_NAME:-qctivemq} + expose: + - "61616" + - "5672" + - "61613" + - "1883" + - "61614" + - "8161" + ports: + - "8161:8161" + - "61616:61616" + - "5672:5672" + - "61613:61613" + - "1883:1883" + - "61614:61614" + command: activemq console + stdin_open: true + tty: true From d4b16aef04f58bb8ccd412e922911219603547d4 Mon Sep 17 00:00:00 2001 From: Robbie Gemmell Date: Fri, 23 Jun 2023 11:16:50 +0100 Subject: [PATCH 05/12] AMQ-9284: Update to Proton-J 0.34.1 and Qpid JMS 1.9.0 (and netty 4.1.94) --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 1f010bec0d7..ffa97e06a8f 100644 --- a/pom.xml +++ b/pom.xml @@ -90,9 +90,9 @@ 1.16 10.15.2.0 6.0.0 - 0.33.10 - 1.6.0 - 4.1.75.Final + 0.34.1 + 1.9.0 + 4.1.94.Final 1.4 2.1.0 1.11.0 From f73e3bb195575a181c42331d3e74c52299f670d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20Onofr=C3=A9?= Date: Sat, 24 Jun 2023 07:01:13 +0200 Subject: [PATCH 06/12] Use jar-no-fork goal for maven-source-plugin to avoid potential duplicate artifacts attached --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ffa97e06a8f..eefc40e1089 100644 --- a/pom.xml +++ b/pom.xml @@ -1404,7 +1404,7 @@ attach-sources - jar + jar-no-fork From 688b6dc50f3bed333641c3461462070a7423a17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20Onofr=C3=A9?= Date: Sun, 25 Jun 2023 18:14:07 +0200 Subject: [PATCH 07/12] Revert "Use jar-no-fork goal for maven-source-plugin to avoid potential duplicate artifacts attached" This reverts commit f73e3bb195575a181c42331d3e74c52299f670d1. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index eefc40e1089..ffa97e06a8f 100644 --- a/pom.xml +++ b/pom.xml @@ -1404,7 +1404,7 @@ attach-sources - jar-no-fork + jar From ab87b4ced91998cae8c9fbc38b7347289a2fc1b5 Mon Sep 17 00:00:00 2001 From: Alexej Timonin Date: Sun, 25 Jun 2023 18:24:11 +0200 Subject: [PATCH 08/12] On startup inform to inpsect log4j2.properties When ActiveMQ is started the following is printed out: "INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details" No log4j.properties file exists, there is however, log4j2.properties. --- assembly/src/release/bin/activemq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assembly/src/release/bin/activemq b/assembly/src/release/bin/activemq index 1b339856cf3..d1b32c287f2 100755 --- a/assembly/src/release/bin/activemq +++ b/assembly/src/release/bin/activemq @@ -546,7 +546,7 @@ invoke_start(){ ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $ACTIVEMQ_SUNJMX_START $ACTIVEMQ_SSL_OPTS -Djava.awt.headless=true -Djava.io.tmpdir=\"${ACTIVEMQ_TMP}\"" - echo "INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details" + echo "INFO: Starting - inspect logfiles specified in logging.properties and log4j2.properties to get details" invokeJar "$ACTIVEMQ_PIDFILE" start exit "$?" } From a4b502f634447208df8b17e40e5105d3a55bf407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20Onofr=C3=A9?= Date: Sun, 25 Jun 2023 20:57:06 +0200 Subject: [PATCH 09/12] Revert "[AMQ-9268] Upgrade to maven-source-plugin 3.3.0" This reverts commit b6fc3898382a6200ddc49bcab746cc200cb6a995. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ffa97e06a8f..c26baecfc93 100644 --- a/pom.xml +++ b/pom.xml @@ -131,7 +131,7 @@ 3.11.0 3.0.0 3.3.0 - 3.3.0 + 3.2.1 3.5.0 2.5.2 3.4.1 From d4011bc16431ef890a475ee876950c97d7cadb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20Onofr=C3=A9?= Date: Sun, 25 Jun 2023 21:00:04 +0200 Subject: [PATCH 10/12] [AMQ-9286] Upgrade to Apache POM 30 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c26baecfc93..7c473ccf791 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.apache apache - 29 + 30 4.0.0 From 2205677143968a9a2cf36842141777f4c95e42ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 26 Jun 2023 13:44:38 +0200 Subject: [PATCH 11/12] Revert "[AMQ-9273] Upgrade to maven-shade-plugin 3.4.1" This reverts commit b2176cbf73782a975101a3e6dd09c51ad2772c5f. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7c473ccf791..c7161eb69fe 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,7 @@ 3.2.1 3.5.0 2.5.2 - 3.4.1 + 3.3.0 3.0.5 3.0.1 2.7 From 4d81ef595f767e5a9ce992a0584a71ed48c6e2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 26 Jun 2023 13:50:29 +0200 Subject: [PATCH 12/12] Revert "[AMQ-9260] Upgrade to maven-assembly-plugin 3.6.0" This reverts commit 6dacd4875d88f05f433abd8cc024e53ab1f495e0. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c7161eb69fe..5dc84dbca3e 100644 --- a/pom.xml +++ b/pom.xml @@ -123,7 +123,7 @@ 5.1.9 3.1.2 3.1.0 - 3.6.0 + 3.4.2 3.0.1 2.10 3.3.0