diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9b9664b..7850efde 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,16 +24,16 @@ jobs: java-version: 1.8 - name: Grant execute permission for gradlew run: chmod +x gradlew - - name: Execute jacocoTestReport and Sonar + - name: Execute jacocoTestReport + run: ./gradlew test jacocoTestReport + - name: Run sonarqube + if: github.event.pull_request.head.repo.fork == false env: SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew test jacocoTestReport sonarqube -# run: ./gradlew test jacocoTestReport && cp build/reports/jacoco/report.xml jacoco.xml || echo "Code coverage failed" + run: ./gradlew sonarqube - name: Build with Gradle run: ./gradlew build --refresh-dependencies --no-daemon --continue -# - name: Push codeCoverage to Codecov -# run: bash <(curl -s https://codecov.io/bash) release: if: github.event_name == 'release' @@ -46,12 +46,8 @@ jobs: java-version: 1.8 - name: Grant execute permission for gradlew run: chmod +x gradlew -# - name: Execute jacocoTestReport -# run: ./gradlew test jacocoTestReport && cp build/reports/jacoco/report.xml jacoco.xml || echo "Code coverage failed" - name: Build with Gradle run: ./gradlew build --refresh-dependencies --no-daemon --continue -# - name: Push codeCoverage to Codecov -# run: bash <(curl -s https://codecov.io/bash) - name: Echo credentials run: echo "bintrayUser=${{secrets.BINTRAY_USER}}" >> gradle.properties - name: Echo credentials Key diff --git a/.travis.yml b/.travis.yml index 5ca7986c..572b77a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ git: services: - rabbitmq -jdk: openjdk11 +jdk: openjdk8 before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock diff --git a/async/async-commons-standalone/src/main/java/org/reactivecommons/async/impl/config/RabbitMqConfig.java b/async/async-commons-standalone/src/main/java/org/reactivecommons/async/impl/config/RabbitMqConfig.java index 0ec6125d..eb459171 100644 --- a/async/async-commons-standalone/src/main/java/org/reactivecommons/async/impl/config/RabbitMqConfig.java +++ b/async/async-commons-standalone/src/main/java/org/reactivecommons/async/impl/config/RabbitMqConfig.java @@ -5,13 +5,14 @@ import lombok.extern.java.Log; import org.reactivecommons.async.impl.communications.ReactiveMessageSender; import org.reactivecommons.async.impl.communications.TopologyCreator; -import org.reactivecommons.async.impl.converters.json.JacksonMessageConverter; import org.reactivecommons.async.impl.converters.MessageConverter; +import org.reactivecommons.async.impl.converters.json.JacksonMessageConverter; import org.reactivecommons.async.impl.converters.json.ObjectMapperSupplier; import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; import reactor.rabbitmq.*; +import reactor.util.retry.Retry; import java.time.Duration; import java.util.logging.Level; @@ -68,7 +69,8 @@ Mono createSenderConnectionMono(ConnectionFactory factory, String na .doOnError(err -> log.log(Level.SEVERE, "Error creating connection to RabbitMq Broker. Starting retry process...", err) ) - .retryBackoff(Long.MAX_VALUE, Duration.ofMillis(300), Duration.ofMillis(3000)) + .retryWhen(Retry.backoff(Long.MAX_VALUE, Duration.ofMillis(300)) + .maxBackoff(Duration.ofMillis(3000))) .subscribeOn(senderScheduler) .cache(); } diff --git a/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/MessageListenersConfig.java b/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/MessageListenersConfig.java index 9b6dcf0e..fb713f01 100644 --- a/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/MessageListenersConfig.java +++ b/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/MessageListenersConfig.java @@ -12,13 +12,10 @@ import org.reactivecommons.async.impl.DynamicRegistryImp; import org.reactivecommons.async.impl.HandlerResolver; import org.reactivecommons.async.impl.communications.ReactiveMessageListener; -import org.reactivecommons.async.impl.communications.ReactiveMessageSender; import org.reactivecommons.async.impl.config.props.AsyncProps; import org.reactivecommons.async.impl.converters.MessageConverter; import org.reactivecommons.async.impl.listeners.ApplicationCommandListener; -import org.reactivecommons.async.impl.listeners.ApplicationEventListener; import org.reactivecommons.async.impl.listeners.ApplicationNotificationListener; -import org.reactivecommons.async.impl.listeners.ApplicationQueryListener; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.ApplicationContext; @@ -43,17 +40,6 @@ public class MessageListenersConfig { private final AsyncProps asyncProps; - @Bean //TODO: move to own config (QueryListenerConfig) - public ApplicationEventListener eventListener(HandlerResolver resolver, MessageConverter messageConverter, - ReactiveMessageListener receiver, DiscardNotifier discardNotifier) { - final ApplicationEventListener listener = new ApplicationEventListener(receiver, - appName + ".subsEvents", resolver, asyncProps.getDomain().getEvents().getExchange(), - messageConverter, asyncProps.getWithDLQRetry(), asyncProps.getMaxRetries(), asyncProps.getRetryDelay(), - asyncProps.getDomain().getEvents().getMaxLengthBytes(), discardNotifier); - listener.startListener(); - return listener; - } - @Bean public ApplicationNotificationListener eventNotificationListener(HandlerResolver resolver, MessageConverter messageConverter, ReactiveMessageListener receiver, DiscardNotifier discardNotifier) { @@ -68,17 +54,6 @@ public ApplicationNotificationListener eventNotificationListener(HandlerResolver return listener; } - @Bean //TODO: move to own config (QueryListenerConfig) - public ApplicationQueryListener queryListener(MessageConverter converter, HandlerResolver resolver, - ReactiveMessageSender sender, ReactiveMessageListener rlistener, - DiscardNotifier discardNotifier) { - final ApplicationQueryListener listener = new ApplicationQueryListener(rlistener, - appName + ".query", resolver, sender, asyncProps.getDirect().getExchange(), converter, - asyncProps.getGlobal().getExchange(), asyncProps.getWithDLQRetry(), asyncProps.getMaxRetries(), - asyncProps.getRetryDelay(), asyncProps.getGlobal().getMaxLengthBytes(), discardNotifier); - listener.startListener(); - return listener; - } @Bean public ApplicationCommandListener applicationCommandListener(ReactiveMessageListener listener, diff --git a/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/QueryListenerConfig.java b/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/QueryListenerConfig.java index 5113ba45..b4a9a9da 100644 --- a/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/QueryListenerConfig.java +++ b/async/async-commons-starter/src/main/java/org/reactivecommons/async/impl/config/QueryListenerConfig.java @@ -7,6 +7,7 @@ import org.reactivecommons.async.impl.communications.ReactiveMessageSender; import org.reactivecommons.async.impl.config.props.AsyncProps; import org.reactivecommons.async.impl.converters.MessageConverter; +import org.reactivecommons.async.impl.listeners.ApplicationEventListener; import org.reactivecommons.async.impl.listeners.ApplicationQueryListener; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -36,4 +37,15 @@ public ApplicationQueryListener queryListener(MessageConverter converter, Handle return listener; } + + @Bean + public ApplicationEventListener eventListener(HandlerResolver resolver, MessageConverter messageConverter, + ReactiveMessageListener receiver, DiscardNotifier discardNotifier) { + final ApplicationEventListener listener = new ApplicationEventListener(receiver, + appName + ".subsEvents", resolver, asyncProps.getDomain().getEvents().getExchange(), + messageConverter, asyncProps.getWithDLQRetry(), asyncProps.getMaxRetries(), asyncProps.getRetryDelay(), + asyncProps.getDomain().getEvents().getMaxLengthBytes(), discardNotifier); + listener.startListener(); + return listener; + } }