Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pn 11182 #500

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
31b74f4
PN-11182: implemented red phase, added properties and modified model&…
ElenaPagnacco May 27, 2024
4be90e2
PN-11182: implemented green phase
ElenaPagnacco May 27, 2024
17b2f90
PN-11182: added audit logs
ElenaPagnacco May 28, 2024
1430ffd
PN-11182: added DiscardedEvents entity and related services.
May 29, 2024
896c458
PN-11182: add new dynamo table scartiConsolidatore
May 31, 2024
4f812e2
PN-11182: refactored ConsolidatoreApiController.sendPaperProgressStat…
May 31, 2024
fa82c25
PN-11182: modified duplicatesCheck from a boolean to a String that re…
Jun 3, 2024
ccd73ba
PN-11182: fixed UoM of SpringCodecMaxInMemorySize
mottone-dgs Jun 4, 2024
9681828
Merge branch 'develop' into feature/PN-11182
Jun 6, 2024
824e7ca
PN-11182: merged develop into PN-11182
Jun 6, 2024
9d84127
PN-11182: in verificaduplicati; truncated timestamp and changed passt…
Jun 10, 2024
e5f3971
PN-11182: added logs to RicezioneEsitiCartaceoServiceImpl.verificaDup…
Jun 10, 2024
990dd13
PN-11182: removed check for status in CompareUtils.isSameEvent
Jun 10, 2024
d59ce94
PN-11182: modified CompareUtils.isSameAddress and CompareUtils.isSame…
Jun 10, 2024
608f8e2
PN-11182: restored CompareUtils.isSameAddress logic
Jun 10, 2024
b3f4660
PN-11182: fixed discarded-events endpoint
Jun 10, 2024
6cf82a5
PN-11182: Added missing templates for ScartiConsolidatore table.
michelescara Jun 10, 2024
41dd57d
PN-11182: fix deploy renaming dynamodb table
Jun 11, 2024
dc41729
PN-11182: fix deply renaming dynamodb table
Jun 11, 2024
8b5c700
PN-11182: restoring name dynamo table
Jun 11, 2024
ce6074f
PN-11182: increased log verbosity in RicezioneEsitiCartaceoServiceImp…
Jun 11, 2024
57df601
Merge branch 'develop' into feature/PN-11182
ElenaPagnacco Jun 25, 2024
e43a2f2
PN-11182: Changed requestPayload hashing algorithm.
michelescara Jun 26, 2024
4c8bbee
Merge branch 'develop' into feature/PN-11182
martiMattei Oct 8, 2024
6013e47
PN-11182 fix merge develop into PN-11182
martiMattei Oct 8, 2024
84ea203
PN-11182: Solved Sonar issues.
michelescara Oct 17, 2024
c2c86d4
PN-11182: Fixed MockWebServer issues.
michelescara Oct 21, 2024
4eb17d1
PN-11182: Reverted GestoreRepositoryCall test class for connection is…
michelescara Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/openapi/internal/externalchannel/gestore-repository-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,29 @@ tags:
description: Operazioni per la configurazione dei client
- name: GestoreRequest
description: Operazione per la gestione delle richieste
- name: DiscardedEvents
description: Operazioni per la gestione delle richieste scartate

paths:
/external-channel/gestoreRepository/discarded-events:
post:
tags:
- DiscardedEvents
operationId: insertDiscardedEvents
requestBody:
content:
application/json:
schema:
type: array
minItems: 1
items:
$ref : '#/components/schemas/DiscardedEventDto'
required: true
responses:
200:
$ref: '#/components/responses/discardedEventResponseOk'


/external-channel/gestoreRepository/clients/{xPagopaExtchCxId}:
parameters:
- name: xPagopaExtchCxId
Expand Down Expand Up @@ -208,6 +229,15 @@ components:

responses:

discardedEventResponseOk:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DiscardedEventDto'

clientResponseOk:
description: OK
content:
Expand Down Expand Up @@ -365,6 +395,31 @@ components:
come da specifiche di configurazione delle retry policy per la sola parte di interesse del canale
example: '"SMS":[5,10,20,40],"EMAIL":[5,10,20,40],"PEC":[5,10,20,40],"PAPER":[5,10,20,40]'

DiscardedEventDto:
type: object
required:
- requestId
- timestampRicezione
- dataRicezione
- codiceScarto
- jsonRicevuto
- payloadHash
properties:
requestId:
type: string
timestampRicezione:
type: string
dataRicezione:
type: string
codiceScarto:
type: string
jsonRicevuto:
type: string
payloadHash:
type: string
details:
type: string

#Non usati internamente ma ref necessaria per la loro generazione.
RequestConversionDto:
$ref: './schemas/internal-schemas-paper-v1.yaml#/components/schemas/RequestConversionDto'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ components:
additionalProperties:
type: string
description: >-
Servizi a valore aggiunto
Servizi a valore aggiunto
duplicateCheckPassthrough:
type: boolean
description: >-
Indica se il controllo sui duplicati deve essere bypassato per quella specifica richiesta

PaperProgressStatusDto:
title: Avanzamento di stato di una richiesta cartacea
Expand Down
1 change: 1 addition & 0 deletions scripts/aws/cfn/microservice-dev-cfg.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"PnEcConsAllowedFutureOffsetDuration": "1m",
"CpuValue": "1024",
"MemoryAmount": "4GB",
"PnEcDuplicatesCheck": "|TEST | AR|890",
"PnECPaperDocumentTypeToRaster": "PN_NOTIFICATION_ATTACHMENTS",
"PnECPaperDocumentTypeForRasterized": "PN_PAPER_ATTACHMENT",
"PnECPaperPAIdToRaster": "NOTHING",
Expand Down
47 changes: 32 additions & 15 deletions scripts/aws/cfn/microservice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ Parameters:
Type: String
Description: 'ARN della Tabella DynamoDB di upporto per la tabella RichiesteConversione'

PnEcTableNameScartiConsolidatore:
Type: String
Description: 'Nome della Tabella DynamoDB relativa agli scarti consolidatore'

PnEcTableArnScartiConsolidatore:
Type: String
Description: 'ARN della Tabella DynamoDB relativa agli scarti consolidatore'

### QUEUES ###
### TRACKER : SMS ###

Expand Down Expand Up @@ -694,7 +702,7 @@ Parameters:
PnEcAlarmArnDLQueueTrackerErroriSERCQ:
Type: String
Description: "[Alarm DLQ - Tracker] ARN dell'allarme per presenza di messaggi nella DLQ PnEcQueueTrackerErroriSERCQ"

###### pn-core Event Bus #######

# PnEcQueueNameEventsDLQueuePnCoreTargetEventBus:
Expand Down Expand Up @@ -909,6 +917,9 @@ Parameters:
PnEcNamirialServerCacheEndpoint:
Type: String

PnEcDuplicatesCheck:
Type: String

CpuValue:
Type: Number
Default: 1024
Expand Down Expand Up @@ -1029,18 +1040,21 @@ Resources:
ContainerEnvEntry67: !Sub 'PnEcNamirialServerCache=${PnEcNamirialServerCache}'
ContainerEnvEntry68: !Sub 'PnEcNamirialServerCacheEndpoint=${PnEcNamirialServerCacheEndpoint}'
ContainerEnvEntry69: !Sub 'SpringCodecMaxInMemorySize=${SpringCodecMaxInMemorySize}'
ContainerEnvEntry70: !Sub 'PnEcConsAllowedFutureOffsetDuration=${PnEcConsAllowedFutureOffsetDuration}'
ContainerEnvEntry71: !Sub 'PnECPaperPAIdToRaster=${PnECPaperPAIdToRaster}'
ContainerEnvEntry72: !Sub 'PnECPaperDocumentTypeToRaster=${PnECPaperDocumentTypeToRaster}'
ContainerEnvEntry73: !Sub 'PnECPaperDocumentTypeForRasterized=${PnECPaperDocumentTypeForRasterized}'
ContainerEnvEntry74: !Sub 'PnECPaperPAIdOverride=${PnECPaperPAIdOverride}'
ContainerEnvEntry75: !Sub 'PnEcQueueNameAvailabilityManager=${PnEcQueueNameAvailabilityManager}'
ContainerEnvEntry76: !Sub 'PnEcDLQueueNameErroriCARTACEO=${PnEcDLQueueNameErroriCARTACEO}'
ContainerEnvEntry77: !Sub 'PnEcTableNameRichiesteConversione=${PnEcTableNameRichiesteConversione}'
ContainerEnvEntry78: !Sub 'PnEcTableNameConversionePdf=${PnEcTableNameConversionePdf}'
ContainerEnvEntry79: !Sub 'PnEcQueueNameTrackerStatoSERCQ=${PnEcQueueNameTrackerStatoSERCQ}'
ContainerEnvEntry80: !Sub 'PnEcQueueNameTrackerErroriSERCQ=${PnEcQueueNameTrackerErroriSERCQ}'
ContainerEnvEntry81: !Sub 'SQSMaxBatchSubscribedMsgs=${SQSMaxBatchSubscribedMsgs}'
ContainerEnvEntry70: !Sub 'PnEcDuplicatesCheck=${PnEcDuplicatesCheck}'
ContainerEnvEntry71: !Sub 'PnEcTableNameScartiConsolidatore=${PnEcTableNameScartiConsolidatore}'
ContainerEnvEntry72: !Sub 'PnEcConsAllowedFutureOffsetDuration=${PnEcConsAllowedFutureOffsetDuration}'
ContainerEnvEntry73: !Sub 'PnEcConsAllowedFutureOffsetDuration=${PnEcConsAllowedFutureOffsetDuration}'
ContainerEnvEntry74: !Sub 'PnECPaperPAIdToRaster=${PnECPaperPAIdToRaster}'
ContainerEnvEntry75: !Sub 'PnECPaperDocumentTypeToRaster=${PnECPaperDocumentTypeToRaster}'
ContainerEnvEntry76: !Sub 'PnECPaperDocumentTypeForRasterized=${PnECPaperDocumentTypeForRasterized}'
ContainerEnvEntry77: !Sub 'PnECPaperPAIdOverride=${PnECPaperPAIdOverride}'
ContainerEnvEntry78: !Sub 'PnEcQueueNameAvailabilityManager=${PnEcQueueNameAvailabilityManager}'
ContainerEnvEntry79: !Sub 'PnEcDLQueueNameErroriCARTACEO=${PnEcDLQueueNameErroriCARTACEO}'
ContainerEnvEntry80: !Sub 'PnEcTableNameRichiesteConversione=${PnEcTableNameRichiesteConversione}'
ContainerEnvEntry81: !Sub 'PnEcTableNameConversionePdf=${PnEcTableNameConversionePdf}'
ContainerEnvEntry82: !Sub 'PnEcQueueNameTrackerStatoSERCQ=${PnEcQueueNameTrackerStatoSERCQ}'
ContainerEnvEntry83: !Sub 'PnEcQueueNameTrackerErroriSERCQ=${PnEcQueueNameTrackerErroriSERCQ}'
ContainerEnvEntry84: !Sub 'SQSMaxBatchSubscribedMsgs=${SQSMaxBatchSubscribedMsgs}'
ContainerSecret1: !Sub 'ConsolidatoreClientApiKey=arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pn-EC-Secrets:ConsolidatoreClientApiKey:AWSCURRENT:'
MicroServiceSecretPrefix: pn-EC-Secrets
MappedPaths: '/external-channels/*,/external-channel/*,/consolidatore-ingress/*'
Expand Down Expand Up @@ -1084,6 +1098,7 @@ Resources:
- !Ref PnEcTableArnAnagrafica
- !Ref PnEcTableArnRichieste
- !Ref PnEcTableArnRichiesteMetadati
- !Ref PnEcTableArnScartiConsolidatore
- !Ref PnEcTableArnRichiesteConversione
- !Ref PnEcTableArnConversionePdf
- Effect: Allow
Expand Down Expand Up @@ -1262,7 +1277,7 @@ Resources:
Resource: !Ref PnEcQueueArnTrackerStatoCARTACEO
Principal:
AWS: !Ref AWS::AccountId

PnEcQueuePolicyTrackerStatoSERCQ:
Type: AWS::SQS::QueuePolicy
Properties:
Expand Down Expand Up @@ -1456,6 +1471,7 @@ Resources:
- - !Ref PnEcTableNameAnagrafica
- !Ref PnEcTableNameRichieste
- !Ref PnEcTableNameRichiesteMetadati
- !Ref PnEcTableNameScartiConsolidatore
QueueArns:
!Join
- ','
Expand Down Expand Up @@ -1502,13 +1518,14 @@ Resources:
- !Ref PnEcAlarmArnDLQueueTrackerStatoSERCQ
- !Ref PnEcAlarmArnQueueTrackerErroriSERCQ
- !Ref PnEcAlarmArnDLQueueTrackerErroriSERCQ
- !Ref PnEcAlarmArnEventsDLQueuePnCoreTargetEventBus
- !Ref PnEcAlarmArnEventsDLQueuePnCoreTargetEventBus
DynamoDBTableNames:
!Join
- ','
- - !Ref PnEcTableNameAnagrafica
- !Ref PnEcTableNameRichieste
- !Ref PnEcTableNameRichiesteMetadati
- !Ref PnEcTableNameScartiConsolidatore
QueueArns:
!Join
- ','
Expand Down
39 changes: 36 additions & 3 deletions scripts/aws/cfn/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Resources:
PointInTimeRecoveryEnabled: true
DeletionPolicy: Retain
UpdateReplacePolicy: Retain

PnEcTableRichiesteConversione:
Type: AWS::DynamoDB::Table
Properties:
Expand All @@ -154,6 +154,31 @@ Resources:
DeletionPolicy: Retain
UpdateReplacePolicy: Retain

PnEcTableScartiConsolidatore:
Type: AWS::DynamoDB::Table
Properties:
TableName: 'pn-EcScartiConsolidatore'
AttributeDefinitions:
- AttributeName: 'requestId'
AttributeType: 'S'
- AttributeName: 'timestampRicezione'
AttributeType: 'S'
KeySchema:
- AttributeName: 'requestId'
KeyType: 'HASH'
- AttributeName: 'timestampRicezione'
KeyType: 'RANGE'
BillingMode: 'PAY_PER_REQUEST'
SSESpecification:
SSEEnabled: true
SSEType: 'KMS'
KMSMasterKeyId: !Ref PCKmsEncDecDynamoDataKey
TableClass: 'STANDARD'
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
DeletionPolicy: Retain
UpdateReplacePolicy: Retain

PnEcTableConversionePdf:
Type: AWS::DynamoDB::Table
Properties:
Expand All @@ -173,7 +198,7 @@ Resources:
PointInTimeRecoveryEnabled: true
DeletionPolicy: Retain
UpdateReplacePolicy: Retain

######### S3 BUCKET FOR OVERSIZE SQS MESSAGES #########

PnEcSqsMessagesStagingBucket:
Expand Down Expand Up @@ -1063,6 +1088,14 @@ Outputs:
Description: 'ARN della Tabella DynamoDB relativa alle richieste'
Value: !GetAtt PnEcTableRichiesteMetadati.Arn

PnEcTableNameScartiConsolidatore:
Description: 'Nome della Tabella DynamoDB relativa agli scarti consolidatore'
Value: !Ref PnEcTableScartiConsolidatore

PnEcTableArnScartiConsolidatore:
Description: 'ARN della Tabella DynamoDB relativa agli scarti consolidatore'
Value: !GetAtt PnEcTableScartiConsolidatore.Arn

PnEcTableNameRichiesteConversione:
Description: 'Nome della Tabella DynamoDB relativa alle richieste di conversione dei PDF'
Value: !Ref PnEcTableRichiesteConversione
Expand Down Expand Up @@ -1299,7 +1332,7 @@ Outputs:
PnEcAlarmArnDLQueueTrackerErroriSERCQ:
Description: "[Alarm DLQ - Tracker] ARN dell'allarme per presenza di messaggi nella DLQ PnEcQueueTrackerErroriSERCQ"
Value: !GetAtt PnEcQueueTrackerErroriSERCQStack.Outputs.SqsDLQAlarmArn

###### BATCH : SMS #######

PnEcQueueNameBatchSMS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public record GestoreRepositoryEndpointProperties(
String getClientConfiguration, String postClientConfiguration, String putClientConfiguration, String deleteClientConfiguration,

// <-- REQUEST -->
String getRequest, String postRequest, String patchRequest, String deleteRequest, String getRequestByMessageId,
String getRequest, String postRequest, String patchRequest, String deleteRequest, String getRequestByMessageId, String postDiscardedEvents,
String setMessageIdInRequestMetadata) {}

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import it.pagopa.pn.ec.commons.rest.call.RestCallException;
import it.pagopa.pn.ec.rest.v1.dto.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@SuppressWarnings("unused")
Expand All @@ -22,4 +23,9 @@ public interface GestoreRepositoryCall {
Mono<Void> deleteRichiesta(String clientId, String requestIdx);
Mono<RequestDto> getRequestByMessageId(String messageId);
Mono<RequestDto> setMessageIdInRequestMetadata(String clientId, String requestIdx);

// <-- DISCARDED EVENTS -->
Flux<DiscardedEventDto> insertDiscardedEvents(Flux<DiscardedEventDto> discardedEventsDto);


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.CustomLog;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import static it.pagopa.pn.ec.commons.utils.LogUtils.*;
Expand Down Expand Up @@ -149,6 +150,18 @@ public Mono<RequestDto> setMessageIdInRequestMetadata(String clientId, String re
.bodyToMono(RequestDto.class);
}

@Override
public Flux<DiscardedEventDto> insertDiscardedEvents(Flux<DiscardedEventDto> discardedEventsDto) {
return ecWebClient.post()
.uri(gestoreRepositoryEndpointProperties.postDiscardedEvents())
.body(discardedEventsDto, DiscardedEventDto.class)
.retrieve()
.onStatus(BAD_REQUEST::equals,
clientResponse -> Mono.error(new RepositoryManagerException.RequestMalformedException()))
.bodyToFlux(DiscardedEventDto.class);

}

private static class ISEForMessageIdCreationException extends RestCallException {

public ISEForMessageIdCreationException() {
Expand Down
Loading
Loading