From 729d7711d6581d9b430077eb4a222a337f7c0c81 Mon Sep 17 00:00:00 2001
From: Santiago Garcia <santitigaga@hotmail.com>
Date: Tue, 1 Sep 2020 11:12:05 -0500
Subject: [PATCH 1/3] Changed retryBackOff (deprecated) to retryWhen in
 RabbitMqConfig.java Move beans from MessageListenersConfig.java to
 QueryListenerConfig.java

---
 .../async/impl/config/RabbitMqConfig.java     |  6 +++--
 .../impl/config/MessageListenersConfig.java   | 25 -------------------
 .../impl/config/QueryListenerConfig.java      | 12 +++++++++
 3 files changed, 16 insertions(+), 27 deletions(-)

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<Connection> 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;
+    }
 }

From 147d7b6d4b9a1cf82760115bc6bbd7c4ba7d3045 Mon Sep 17 00:00:00 2001
From: Santiago Garcia <santitigaga@hotmail.com>
Date: Tue, 1 Sep 2020 11:20:11 -0500
Subject: [PATCH 2/3] Change the jdk in travis pipeline to java 8

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

From a816346b31844a7f2894dbb26411f410f33e48e4 Mon Sep 17 00:00:00 2001
From: Santiago Garcia <santitigaga@hotmail.com>
Date: Tue, 1 Sep 2020 11:52:12 -0500
Subject: [PATCH 3/3] Updated github action to disabled sonarqube analysis in
 pull request by forks

---
 .github/workflows/main.yml | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

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