Skip to content
Snippets Groups Projects
Commit bb096dd7 authored by Solomon Ayalew's avatar Solomon Ayalew
Browse files

Address sonar warnings

parent a7446a3b
No related branches found
No related tags found
1 merge request!484Address sonar warnings
......@@ -284,7 +284,6 @@ The following software have components provided under the terms of this license:
- io.grpc:grpc-services (from https://github.com/grpc/grpc-java)
- io.grpc:grpc-stub (from https://github.com/grpc/grpc-java)
- io.grpc:grpc-xds (from https://github.com/grpc/grpc-java)
- ion-java (from https://github.com/amzn/ion-java/, https://github.com/amznlabs/ion-java/)
- jackson-databind (from http://github.com/FasterXML/jackson, http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson)
- java-cloudant (from https://cloudant.com)
- javatuples (from http://www.javatuples.org)
......@@ -306,6 +305,7 @@ The following software have components provided under the terms of this license:
- proto-google-common-protos (from https://github.com/googleapis/api-client-staging, https://github.com/googleapis/googleapis, https://github.com/googleapis/java-iam/proto-google-common-protos, https://github.com/googleapis/sdk-platform-java)
- proto-google-iam-v1 (from https://github.com/googleapis/googleapis, https://github.com/googleapis/java-iam/proto-google-iam-v1, https://github.com/googleapis/sdk-platform-java)
- resilience4j (from https://github.com/resilience4j/resilience4j, https://resilience4j.readme.io, ttps://resilience4j.readme.io)
- software.amazon.ion:ion-java (from https://github.com/amzn/ion-java/)
- spring-boot-starter-undertow (from <https://spring.io/projects/spring-boot>, https://spring.io/projects/spring-boot)
- springdoc-openapi-common (from <https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-common>, https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-common)
- springdoc-openapi-ui (from https://github.com/springdoc/springdoc-openapi, https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-ui)
......@@ -463,14 +463,10 @@ EPL-1.0
The following software have components provided under the terms of this license:
- AspectJ Weaver (from http://www.aspectj.org, https://www.eclipse.org/aspectj/)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- JUnit Jupiter API (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Jupiter Engine (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Jupiter Params (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Platform Engine API (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Vintage Engine (from http://junit.org/junit5/, https://junit.org/junit5/)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta Validation API (from https://beanvalidation.org)
- Jakarta WebSocket - Server API (from https://projects.eclipse.org/projects/ee4j.websocket, https://repo1.maven.org/maven2/org/jboss/spec/javax/websocket/jboss-websocket-api_1.1_spec)
- Java Servlet 4.0 API
- Logback Contrib :: JSON :: Classic (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-classic)
......@@ -512,7 +508,6 @@ GPL-2.0-only
The following software have components provided under the terms of this license:
- JBoss Jakarta Annotations API (from <https://github.com/jboss/jboss-jakarta-annotations-api_spec>, https://github.com/jboss/jboss-jakarta-annotations-api_spec)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta WebSocket - Server API (from https://projects.eclipse.org/projects/ee4j.websocket, https://repo1.maven.org/maven2/org/jboss/spec/javax/websocket/jboss-websocket-api_1.1_spec)
========================================================================
......@@ -539,7 +534,6 @@ GPL-3.0-only
========================================================================
The following software have components provided under the terms of this license:
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Java Servlet 4.0 API
========================================================================
......@@ -680,6 +674,14 @@ The following software have components provided under the terms of this license:
- Netty/Codec (from https://repo1.maven.org/maven2/io/netty/netty-codec)
========================================================================
gpl-2.0-classpath
========================================================================
The following software have components provided under the terms of this license:
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta Validation API (from https://beanvalidation.org)
========================================================================
public-domain
========================================================================
......@@ -692,10 +694,3 @@ The following software have components provided under the terms of this license:
- Undertow Core (from <https://repo1.maven.org/maven2/io/undertow/undertow-core>, https://repo1.maven.org/maven2/io/undertow/undertow-core)
- Undertow WebSockets JSR356 implementations (from <https://repo1.maven.org/maven2/io/undertow/undertow-websockets-jsr>, https://repo1.maven.org/maven2/io/undertow/undertow-websockets-jsr)
- XNIO API (from <http://www.jboss.org/xnio>, http://www.jboss.org/xnio)
========================================================================
unknown
========================================================================
The following software have components provided under the terms of this license:
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
......@@ -70,7 +70,8 @@ public class NotificationRetrySQSHandler {
private void processNotifications() throws InterruptedException {
List<Message> messages;
logger.info("Running notification Retry SQS processor");
while (true) {
boolean loopVariable = true;
while (loopVariable) {
try {
AmazonSQSConfig sqsConfig = new AmazonSQSConfig(region);
AmazonSQS sqsClient = sqsConfig.AmazonSQS();
......
......@@ -70,7 +70,8 @@ public class NotificationSQSHandler {
private void processNotifications() throws InterruptedException {
List<Message> messages;
logger.info("Running notification SQS processor");
while (true) {
boolean loopVariable = true;
while (loopVariable) {
try {
AmazonSQSConfig sqsConfig = new AmazonSQSConfig(region);
AmazonSQS sqsClient = sqsConfig.AmazonSQS();
......
......@@ -42,6 +42,7 @@ import javax.annotation.PostConstruct;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -96,7 +97,7 @@ public class NotificationQueueServiceImpl implements NotificationQueueService {
return messagesByDataPartition.entrySet().parallelStream()
.map(entry -> processMessagesByDataPartition(entry.getKey(), entry.getValue()))
.filter(Objects::nonNull).flatMap(list -> list.stream()).collect(Collectors.toList());
.filter(Objects::nonNull).flatMap(Collection::stream).collect(Collectors.toList());
} catch (Exception e) {
logger.error("Exception processing messages :", e);
return new ArrayList<>();
......
......@@ -75,18 +75,22 @@ public class NotificationRetryQueueServiceImpl implements NotificationRetryQueue
@Override
public List<RetryProcessResult> processNotificationMessages(List<Message> messages) {
final String dataPartitionId = "data-partition-id";
final String subscriptionId = "subscriptionId";
Map<String, List<Message>> messagesBySubscription = messages.stream().collect(Collectors.groupingBy(
msg -> String.join(":", msg.getMessageAttributes().get("data-partition-id").getStringValue(), msg.getMessageAttributes().get("subscriptionId").getStringValue()),
msg -> String.join(":", msg.getMessageAttributes().get(dataPartitionId).getStringValue(), msg.getMessageAttributes().get(subscriptionId).getStringValue()),
HashMap::new, Collectors.toCollection(ArrayList::new)));
return messagesBySubscription.entrySet().parallelStream().map(entry -> {
try {
Optional<Subscription> subscription = subscriptionRepository.getSubscriptionById(entry.getValue().get(0).getMessageAttributes().get("subscriptionId").getStringValue(),
entry.getValue().get(0).getMessageAttributes().get("data-partition-id").getStringValue());
Optional<Subscription> subscription = subscriptionRepository.getSubscriptionById(entry.getValue().get(0).getMessageAttributes().get(subscriptionId).getStringValue(),
entry.getValue().get(0).getMessageAttributes().get(dataPartitionId).getStringValue());
if (!subscription.isPresent()) {
logger.info("Subscription with id {} not found for dataPartitionId {}",
entry.getValue().get(0).getMessageAttributes().get("subscriptionId").getStringValue(),
entry.getValue().get(0).getMessageAttributes().get("data-partition-id").getStringValue());
entry.getValue().get(0).getMessageAttributes().get(subscriptionId).getStringValue(),
entry.getValue().get(0).getMessageAttributes().get(dataPartitionId).getStringValue());
deleteDbRecords(entry.getValue());
return entry.getValue().stream().map(msg -> new RetryProcessResult(msg, NotificationResult.ACK)).collect(Collectors.toList());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment