diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..53bef76 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: Build project +on: + push: + branches: + - master +jobs: + build: + name: Build and Publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: "corretto" + java-version: "17" + cache: "gradle" + + - name: Validate + uses: pre-commit/action@v3.0.0 + + - name: Build project + run: ./gradlew clean build diff --git a/.gitignore b/.gitignore index 74bb5d7..7905ff9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ .gradle/ out/ bin/ -build/ \ No newline at end of file +build/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..72fc5ff --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: check-merge-conflict + - id: check-case-conflict + + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.4 + hooks: + - id: remove-crlf + - id: remove-tabs diff --git a/README.md b/README.md index 3e74f49..e2dc552 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ $ docker compose up -d > Max Disk Usage > The System will perform scans on the disk to determine if the disk is beyond a configured limit. These are configured > through max-disk-usage in percentage. Once that limit is reached any message will be blocked. (unless the protocol -> doesn't support flow control on which case there will be an exception thrown and the connection for those clients dropped). +> doesn't support flow control on which case there will be an exception thrown and the connection for those clients +> dropped). ## Start Java application @@ -38,16 +39,16 @@ $ ./gradlew bootRun --args='--messaging.message="Hello, World!" --messaging.queu ``` Simple Java application for JMS messaging in Artemis ---broker-url set broker url (default [tcp://127.0.0.1:61616]) ---broker-username set broker url (default [admin]) ---broker-password set broker password (default [admin]) ---messaging.queue-name set queue name (default 'my-queue') ---messaging.message set message text (default 'hello, world + timestamp') +--broker-url set broker url (default [tcp://127.0.0.1:61616]) +--broker-username set broker url (default [admin]) +--broker-password set broker password (default [admin]) +--messaging.queue-name set queue name (default 'my-queue') +--messaging.message set message text (default 'hello, world + timestamp') --messaging.properties.= set properties ---help print help message +--help print help message ``` ## Consume from Artemis UI Для получения сообщений из очереди через [Artemis UI](http://localhost:8161/console) -> `Queue` -> `my-queue` --> `opeartions` -> `browse()`. \ No newline at end of file +-> `opeartions` -> `browse()`. diff --git a/build.gradle b/build.gradle index a98bf96..3e06b67 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ plugins { id "java" id "idea" - id "org.springframework.boot" version "2.6.0" - id "io.spring.dependency-management" version "1.0.11.RELEASE" + id "org.springframework.boot" version "3.2.1" + id "io.spring.dependency-management" version "1.1.0" } idea { @@ -13,7 +13,7 @@ idea { } ext { - mapstructVersion = "1.4.2.Final" + mapstructVersion = "1.5.9.Final" jetbrainsAnnotationsVersion = "22.0.0" } @@ -38,7 +38,3 @@ test { springBoot { buildInfo() } - -bootJar { - archiveFileName = "${project.name}.jar" -} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6ad9451..8407159 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,21 @@ version: "3" services: artemis: - image: vromero/activemq-artemis:2.16.0 + image: apache/activemq-artemis:2.35.0 environment: - ARTEMIS_MIN_MEMORY: 1024M - ARTEMIS_MAX_MEMORY: 2048M ARTEMIS_USERNAME: admin ARTEMIS_PASSWORD: admin ports: - "8161:8161" - "61616:61616" + healthcheck: + test: [ "CMD-SHELL", "/app/artemis/bin/artemis check queue --name TEST --produce 10 --browse 10 --consume 10 --url tcp://localhost:61616 --user $$ARTEMIS_USERNAME --password $$ARTEMIS_PASSWORD" ] + interval: 10s + timeout: 10s + retries: 5 volumes: - artemis:/var/lib/artemis - - ./artemis/:/var/lib/artemis/etc-override/ + - ./docker/:/var/lib/artemis/etc-override/ volumes: - artemis: \ No newline at end of file + artemis: diff --git a/artemis/broker-00.xml b/docker/broker-00.xml similarity index 95% rename from artemis/broker-00.xml rename to docker/broker-00.xml index d73f817..d4f3594 100644 --- a/artemis/broker-00.xml +++ b/docker/broker-00.xml @@ -4,4 +4,4 @@ 100 - \ No newline at end of file + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1acc777..f42e62f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 735fa21..1a0872b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = "artemis-jms" \ No newline at end of file +rootProject.name = "artemis-jms" diff --git a/src/main/java/ru/romanow/jpa/JmsApplication.java b/src/main/java/ru/romanow/jpa/JmsApplication.java index db948fd..c2c022f 100644 --- a/src/main/java/ru/romanow/jpa/JmsApplication.java +++ b/src/main/java/ru/romanow/jpa/JmsApplication.java @@ -1,5 +1,6 @@ package ru.romanow.jpa; +import jakarta.jms.TextMessage; import lombok.Data; import lombok.SneakyThrows; import org.apache.activemq.artemis.jms.client.ActiveMQQueue; @@ -12,10 +13,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.core.env.SimpleCommandLinePropertySource; -import org.springframework.jms.annotation.JmsListener; import org.springframework.jms.core.JmsTemplate; -import javax.jms.TextMessage; import java.util.Map; import static java.time.LocalDateTime.now; @@ -91,4 +90,3 @@ public static class MessagingProperties { private Map properties; } } - diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 68cd2f4..73b166f 100644 --- a/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -12,4 +12,4 @@ "description": "Message." } ] -} \ No newline at end of file +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 44e78b0..8355481 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -15,4 +15,4 @@ server: enabled: true messaging: - queue-name: my-queue \ No newline at end of file + queue-name: my-queue