From 6e8a8a1ab3e0bf5525756711768ab7faa0d5b232 Mon Sep 17 00:00:00 2001 From: "cristopher.moccia" Date: Thu, 16 Nov 2023 18:23:33 +0100 Subject: [PATCH 1/4] added queue error policy --- .../interop/signalhub/persister/config/AwsBeanBuilder.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/it/pagopa/interop/signalhub/persister/config/AwsBeanBuilder.java b/src/main/java/it/pagopa/interop/signalhub/persister/config/AwsBeanBuilder.java index 46a7e92..cb20932 100644 --- a/src/main/java/it/pagopa/interop/signalhub/persister/config/AwsBeanBuilder.java +++ b/src/main/java/it/pagopa/interop/signalhub/persister/config/AwsBeanBuilder.java @@ -2,6 +2,7 @@ import io.awspring.cloud.sqs.config.SqsBootstrapConfiguration; import io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory; +import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.context.annotation.Bean; @@ -35,6 +36,7 @@ public SqsMessageListenerContainerFactory defaultSqsListenerContainerFac return SqsMessageListenerContainerFactory .builder() .configure(options -> options + .acknowledgementMode(AcknowledgementMode.ON_SUCCESS) .maxConcurrentMessages(10) .maxMessagesPerPoll(10)) .sqsAsyncClient(sqsAsyncClient()) From 44cfd4e0abff0064b125e6f2cafce3336570a97a Mon Sep 17 00:00:00 2001 From: "cristopher.moccia" Date: Mon, 20 Nov 2023 16:41:08 +0100 Subject: [PATCH 2/4] fixed column type and added type column into tracing batch --- .../changes/init_table/init_table.sql | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/main/resources/db/changelog/changes/init_table/init_table.sql b/src/main/resources/db/changelog/changes/init_table/init_table.sql index eda3250..b033211 100644 --- a/src/main/resources/db/changelog/changes/init_table/init_table.sql +++ b/src/main/resources/db/changelog/changes/init_table/init_table.sql @@ -1,9 +1,9 @@ CREATE TABLE IF NOT EXISTS ESERVICE ( - eservice_id VARCHAR (50) NOT NULL, - producer_id VARCHAR (50) NOT NULL, - descriptor_id VARCHAR (50) NOT NULL, + eservice_id VARCHAR (255) NOT NULL, + producer_id VARCHAR (255) NOT NULL, + descriptor_id VARCHAR (255) NOT NULL, event_id BIGINT, - state VARCHAR (50) NOT NULL, + state VARCHAR (255) NOT NULL, tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP, tmst_last_edit TIMESTAMP, UNIQUE (eservice_id, producer_id, descriptor_id), @@ -14,12 +14,12 @@ CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_PRODUCER_ID ON ESERVICE USING hash (pr CREATE TABLE IF NOT EXISTS CONSUMER_ESERVICE ( - agreement_id VARCHAR (50) NOT NULL, - eservice_id VARCHAR (50) NOT NULL, - consumer_id VARCHAR (50) NOT NULL, - descriptor_id VARCHAR (50) NOT NULL, + agreement_id VARCHAR (255) NOT NULL, + eservice_id VARCHAR (255) NOT NULL, + consumer_id VARCHAR (255) NOT NULL, + descriptor_id VARCHAR (255) NOT NULL, event_id BIGINT, - state VARCHAR (50) NOT NULL, + state VARCHAR (255) NOT NULL, tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP, tmst_last_edit TIMESTAMP, UNIQUE (eservice_id, consumer_id, descriptor_id), @@ -32,13 +32,13 @@ CREATE INDEX IF NOT EXISTS CONSUMER_ESERVICE_INDEX_DESCRIPTOR_ID ON CONSUMER_ESE CREATE TABLE IF NOT EXISTS SIGNAL ( id SERIAL PRIMARY KEY, - correlation_id VARCHAR(50) NOT NULL, + correlation_id VARCHAR(255) NOT NULL, signal_id BIGINT NOT NULL, - object_id VARCHAR (50) NOT NULL, - eservice_id VARCHAR (50) NOT NULL, - object_type VARCHAR (50) NOT NULL, - signal_type VARCHAR (50) NOT NULL, - tmst_insert TIMESTAMP NOT NULL, + object_id VARCHAR (255) NOT NULL, + eservice_id VARCHAR (255) NOT NULL, + object_type VARCHAR (255) NOT NULL, + signal_type VARCHAR (255) NOT NULL, + tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE (signal_id, eservice_id) ); CREATE INDEX IF NOT EXISTS SIGNAL_INDEX_SIGNAL_ID ON SIGNAL USING hash (signal_id); @@ -47,33 +47,34 @@ CREATE INDEX IF NOT EXISTS SIGNAL_INDEX_ESERVICE_ID ON SIGNAL USING hash (eservi CREATE TABLE IF NOT EXISTS DEAD_SIGNAL ( id SERIAL PRIMARY KEY, - correlation_id VARCHAR(50) NOT NULL, + correlation_id VARCHAR(255) NOT NULL, signal_id BIGINT NOT NULL, - object_id VARCHAR (50) NOT NULL, - eservice_id VARCHAR (50) NOT NULL, - object_type VARCHAR (50) NOT NULL, - signal_type VARCHAR (50) NOT NULL, - tmst_insert TIMESTAMP NOT NULL, + object_id VARCHAR (255) NOT NULL, + eservice_id VARCHAR (255) NOT NULL, + object_type VARCHAR (255) NOT NULL, + signal_type VARCHAR (255) NOT NULL, + tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP, error_reason VARCHAR(255) NOT NULL ); CREATE TABLE IF NOT EXISTS TRACING_BATCH ( batch_id SERIAL PRIMARY KEY, - state VARCHAR (50) NOT NULL, + state VARCHAR (255) NOT NULL, + type VARCHAR (50) NOT NULL, last_event_id BIGINT, - tmst_created TIMESTAMP NOT NULL + tmst_created TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE IF NOT EXISTS DEAD_EVENT ( event_tmp_id SERIAL PRIMARY KEY, - tmst_insert TIMESTAMP, + tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP, error_reason VARCHAR(255) NOT NULL, event_id BIGINT NOT NULL, - event_type VARCHAR (50) NOT NULL, - object_type VARCHAR (50) NOT NULL, - descriptor_id VARCHAR (50), - eservice_id VARCHAR (50), - agreement_id VARCHAR (50) + event_type VARCHAR (255) NOT NULL, + object_type VARCHAR (255) NOT NULL, + descriptor_id VARCHAR (255), + eservice_id VARCHAR (255), + agreement_id VARCHAR (255) ); \ No newline at end of file From eb1fb589c602b402030de6be718616f5a8d94758 Mon Sep 17 00:00:00 2001 From: "cristopher.moccia" Date: Wed, 22 Nov 2023 16:04:26 +0100 Subject: [PATCH 3/4] changed property indexSignal to signalId --- .../interop/signalhub/persister/queue/model/SignalEvent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/it/pagopa/interop/signalhub/persister/queue/model/SignalEvent.java b/src/main/java/it/pagopa/interop/signalhub/persister/queue/model/SignalEvent.java index 57886ed..0e384ae 100644 --- a/src/main/java/it/pagopa/interop/signalhub/persister/queue/model/SignalEvent.java +++ b/src/main/java/it/pagopa/interop/signalhub/persister/queue/model/SignalEvent.java @@ -19,5 +19,5 @@ public class SignalEvent { private String eserviceId; - private Long indexSignal; + private Long signalId; } \ No newline at end of file From 9fa187a52c40c60547615e61086fdaaa66c6b8c9 Mon Sep 17 00:00:00 2001 From: "cristopher.moccia" Date: Wed, 22 Nov 2023 16:08:18 +0100 Subject: [PATCH 4/4] removed mapping annotation --- .../interop/signalhub/persister/mapper/SignalMapper.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/it/pagopa/interop/signalhub/persister/mapper/SignalMapper.java b/src/main/java/it/pagopa/interop/signalhub/persister/mapper/SignalMapper.java index 758c720..3af4cb9 100644 --- a/src/main/java/it/pagopa/interop/signalhub/persister/mapper/SignalMapper.java +++ b/src/main/java/it/pagopa/interop/signalhub/persister/mapper/SignalMapper.java @@ -10,9 +10,8 @@ public interface SignalMapper { String CORRELATION_ID_HEADER_KEY = "correlationId"; - @Mapping(target = "indexSignal", source = "signal.signalId") SignalEvent signalToSignalEvent(Signal signal); - @Mapping(target = "signalId", source = "signalEvent.indexSignal") + @Mapping(target = "correlationId", source = "correlationId") Signal signalEventToSignal(SignalEvent signalEvent, String correlationId); }