Skip to content

Commit

Permalink
Merge pull request #101 from assimbly/develop
Browse files Browse the repository at this point in the history
Release 4.0.0
  • Loading branch information
skin27 committed May 10, 2023
2 parents 552651b + 3d3cd6e commit 7ede567
Show file tree
Hide file tree
Showing 269 changed files with 12,677 additions and 1,220 deletions.
9 changes: 3 additions & 6 deletions .github/issue-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ branches:
- label: [ documentation ]
prefix: documentation/

- label: '*'
prefix: issues/

- label: [ major ]
- label: 'major'
skip: true

- label: [ minor ]
- label: 'minor'
skip: true

- label: [ patch ]
- label: 'patch'
skip: true

- label: skip-release
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/manual-update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Manual Version Update

on:
workflow_dispatch:
inputs:
BRANCH:
required: true
default: 'develop'
type: choice
options:
- develop
- master
VERSION:
description: '4.0.0'
required: true
default: '4.0.0'

push:
branches:
- 'update-development-version'

jobs:
update_version:
runs-on: ubuntu-latest

steps:

- name: Checkout the code
uses: actions/checkout@v3
with:
ref: 'develop'

- name: Update POM Version
env:
VERSION: '4.0.0-SNAPSHOT'
run: |
echo "Updating to version: $VERSION"
mvn versions:set -DnewVersion=$VERSION
mvn versions:set-property -Dproperty=assimbly.version -DnewVersion=$VERSION
- name: Diff check
run: git diff

- name: Add & Commit
uses: EndBug/add-and-commit@v9.1.1
with:
add: '.'
default_author: github_actions
push: origin HEAD:develop --force
6 changes: 4 additions & 2 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
release:
types: [ released ]


jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -14,8 +15,9 @@ jobs:
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
distribution: 'temurin'

- name: Publish package
run: ./bin/mac/deploy.sh
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60 changes: 60 additions & 0 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish packages to GitHub Packages

on:
release:
types: [ released ]
push:
branches:
- 'release-publish'


jobs:
update_version:
runs-on: ubuntu-latest

steps:

- name: Checkout the code
uses: actions/checkout@v3

- name: Update POM Version
run: |
echo "Updating to version: $(jq -r '.pull_request.milestone.title' $GITHUB_EVENT_PATH)"
mvn versions:set -DnewVersion=$(jq -r '.pull_request.milestone.title' $GITHUB_EVENT_PATH)
mvn versions:set-property -Dproperty=assimbly.version -DnewVersion=$(jq -r '.pull_request.milestone.title' $GITHUB_EVENT_PATH)
- name: Diff check
run: git diff

- name: Add & Commit
uses: EndBug/add-and-commit@v9.1.1
with:
add: '.'
default_author: github_actions
push: origin HEAD:develop --force

publish_packages:
needs: [update_version]

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:

- name: Checkout the code
uses: actions/checkout@v3
with:
ref: 'master'

- name: Setup JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Publish package
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 5 additions & 3 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update POM files version
name: Automatic Version Update on Release

on:
pull_request:
Expand All @@ -12,13 +12,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Checkout the code
uses: actions/checkout@v3

- name: Update POM Version
run: |
echo "Updating to version: $(jq -r '.pull_request.milestone.title' $GITHUB_EVENT_PATH)"
mvn versions:set -DnewVersion=$(jq -r '.pull_request.milestone.title' $GITHUB_EVENT_PATH)
mvn pom.xml versions:set-property -Dproperty=assimbly.version -DnewVersion=$(jq -r '.pull_request.milestone.title' $GITHUB_EVENT_PATH)
mvn versions:set-property -Dproperty=assimbly.version -DnewVersion=$(jq -r '.pull_request.milestone.title' $GITHUB_EVENT_PATH)
- name: Diff check
run: git diff
Expand Down
4 changes: 2 additions & 2 deletions bin/win/build.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

IF "%~1"=="" GOTO :BUILDALL
mvn -f ..\..\%~1\pom.xml clean install
mvn -f ..\..\%~1\pom.xml clean install -DskipTests
:BUILDALL
mvn -f ..\..\pom.xml clean install
mvn -f ..\..\pom.xml clean install -DskipTests
2 changes: 1 addition & 1 deletion broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>runtime</artifactId>
<groupId>org.assimbly</groupId>
<version>3.9.0</version>
<version>4.0.0</version>
</parent>

<name>broker</name>
Expand Down
2 changes: 1 addition & 1 deletion broker/pom.xml.versionsBackup
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>runtime</artifactId>
<groupId>org.assimbly</groupId>
<version>3.8.1</version>
<version>4.0.0</version>
</parent>

<name>broker</name>
Expand Down
26 changes: 16 additions & 10 deletions broker/src/main/java/org/assimbly/broker/impl/ActiveMQArtemis.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.management.ManagementFactory;
import java.lang.reflect.Field;
import java.net.URL;
import java.nio.charset.StandardCharsets;
Expand All @@ -16,6 +17,7 @@

import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
Expand All @@ -34,15 +36,17 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.management.JMX;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.openmbean.CompositeData;

public class ActiveMQArtemis implements Broker {

final static Logger log = LoggerFactory.getLogger(ActiveMQArtemis.class);

private EmbeddedActiveMQ broker;
private final String baseDir = BaseDirectory.getInstance().getBaseDirectory();

private File brokerFile = new File(baseDir + "/broker/broker.xml");
private File aioFile = new File(baseDir + "/broker/linux-x86_64/libartemis-native-64.so");
private ActiveMQServerControlImpl manageBroker;
Expand All @@ -62,7 +66,6 @@ public String start() {

broker = new EmbeddedActiveMQ();


//
if (brokerFile.exists()) {
String fileConfig = "file:///" + brokerFile.getAbsolutePath();
Expand All @@ -87,8 +90,9 @@ public String start() {

return status();

} catch (Exception e) {
log.error("Failed to start broker. Reason:", e);
} catch (Throwable e) {
log.error("Failed to start broker. Reason:", e.getMessage());
e.printStackTrace();
return "Failed to start broker. Reason: " + e.getMessage();
}

Expand All @@ -110,6 +114,7 @@ public String startEmbedded() throws Exception {
broker.start();

return status();

}


Expand Down Expand Up @@ -155,6 +160,7 @@ public String status() throws Exception {

if(activeBroker!=null) {
log.debug("State=" + activeBroker.getState().name());

if(activeBroker.isActive()) {
status = "started";
}else if(activeBroker.getState().name().equals("STARTED")){
Expand Down Expand Up @@ -241,9 +247,9 @@ public void setAIO() throws IOException, NoSuchFieldException, IllegalAccessExce
//Copy file from resources into empty file
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
InputStream is = classloader.getResourceAsStream("libartemis-native-64.so");
Files.copy(is, aioFile.toPath(), StandardCopyOption.REPLACE_EXISTING);

if(is==null) {
if(is!=null) {
Files.copy(is, aioFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
is.close();
log.info("AIO Directory is set to " + aioFile.getParent());
}else{
Expand Down Expand Up @@ -575,14 +581,14 @@ public String countMessages(String endpointName) throws Exception {

public String browseMessage(String endpointName, String messageId, boolean excludeBody) throws Exception {

if (!endpointExist) {
throw new EndpointNotFoundException("Endpoint " + endpointName + " not found");
}
checkIfEndpointExist(endpointName);

ActiveMQServer activeBroker = broker.getActiveMQServer();

QueueControl queueControl = (QueueControl) activeBroker.getManagementService().getResource(org.apache.activemq.artemis.api.core.management.ResourceNames.QUEUE + endpointName);

queueControl.getFirstMessageAsJSON();

CompositeData[] messages = queueControl.browse();

messages = stream(messages).filter(compositeData -> compositeData.get("messageID").equals(messageId)).toArray(CompositeData[]::new);
Expand Down

0 comments on commit 7ede567

Please sign in to comment.