Commit 6e33f711 authored by Kristel Meikas's avatar Kristel Meikas
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Kristel Meikas

See merge request teis/payments-service!56
parents 722f2ac3 910b53ea
......@@ -2,6 +2,7 @@ stages:
- test
- build
- deploy
- cve-test
variables:
USE_POSTGRES: "true"
......@@ -16,3 +17,5 @@ include:
file: "/gitlab/java/microservice/.gitlab-ci-microservice-build.yml"
- project: "teis/dev-ops"
file: "/gitlab/java/microservice/.gitlab-ci-microservice-deploy.yml"
- project: "teis/dev-ops"
file: "/gitlab/java/microservice/.gitlab-ci-microservice-cve-scan.yaml"
# Changelog
## [1.15.0] - 2022-03-28
* TEIS-2791: implemented functionality for updating classifier item, individual and legal person caches in batches
* TEIS-2782: add docker CVE test step into CI/CD pipeline
## [1.14.0] - 2021-12-16
* TEIS-2535: fixed DomainCacheConfigs according to changes in commons library
* TEIS-2535: fixed DomainCacheConfigs according to changes in commons library
* TEIS-2599: security and metrics update
## [1.13.0] - 2021-02-07
......
theGroup=ee.sm.ti.teis
theVersion=1.14.0
pluginVersion=1.4.1
commonsVersion=1.28.0
officeApiGatewayVersion=1.28.0
theVersion=1.15.0
pluginVersion=1.5.0
commonsVersion=1.33.0
officeApiGatewayVersion=1.33.0
......@@ -14,3 +14,6 @@ spring:
rabbitmq:
template:
reply-timeout: 500 # Timeout for `sendAndReceive()` operations.
teis:
cache:
reinitialize-enabled: false
package ee.sm.ti.teis.payments.cache;
import ee.sm.ti.teis.cache.SnapshotBatchListener;
import ee.sm.ti.teis.cache.classifier.ClassifierItemCacheUpdateService;
import ee.sm.ti.teis.cache.classifier.ClassifierItemCacheUpdateService.*;
import ee.sm.ti.teis.domain.ClassifierItem;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
public class ClassifierItemBatchListener extends SnapshotBatchListener<ClassifierItemCacheUpdateService, ClassifierItem, String> {
private final ClassifierItemCacheUpdateService classifierItemCacheUpdateService;
public ClassifierItemBatchListener(ClassifierItemCacheUpdateService classifierItemCacheUpdateService) {
super(classifierItemCacheUpdateService);
this.classifierItemCacheUpdateService = classifierItemCacheUpdateService;
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.cacheBatchResponseQueueName}", concurrency = "1")
public void processCacheBatchSnapshot(ClassifierItemCacheBatchResponseDTO response) {
batchProcess(response);
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.cacheReinitializeQueueName}")
public void classifierItemReinitializeEvent() {
classifierItemCacheUpdateService.reinitialize();
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.cacheResponseQueueName}", concurrency = "1")
public void classifierItemCacheResponseEvent(ClassifierItemCacheResponseDTO cacheResponseDTO) {
classifierItemCacheUpdateService.processSnapshot(cacheResponseDTO.getPayload(), cacheResponseDTO.getRequestMetaDTO().getUserId());
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.createdEventsQueueName}")
public void classifierItemCreatedEvent(ClassifierItemCreatedDTO createdDTO) {
classifierItemCacheUpdateService.created(createdDTO.getPayload());
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.updatedEventsQueueName}")
public void classifierItemUpdatedEvent(ClassifierItemUpdatedDTO updatedDTO) {
classifierItemCacheUpdateService.updated(updatedDTO.getPayload().getId(), updatedDTO.getPayload());
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.deletedEventsQueueName}")
public void classifierItemDeletedEvent(ClassifierItemDeletedDTO deletedDTO) {
classifierItemCacheUpdateService.updated(deletedDTO.getPayload().getId(), deletedDTO.getPayload());
}
}
package ee.sm.ti.teis.payments.config;
package ee.sm.ti.teis.payments.cache;
import ee.sm.ti.teis.cache.BaseCacheUpdateService;
import ee.sm.ti.teis.cache.classifier.ClassifierDefinitionCacheUpdateService;
......@@ -14,9 +14,6 @@ import java.util.Set;
import static ee.sm.ti.teis.cache.classifier.ClassifierDefinitionCacheUpdateService.ClassifierDefinitionCacheResponseDTO;
import static ee.sm.ti.teis.cache.classifier.ClassifierDefinitionCacheUpdateService.ClassifierDefinitionReinitializeDTO;
import static ee.sm.ti.teis.cache.classifier.ClassifierItemCacheUpdateService.*;
import static ee.sm.ti.teis.cache.person.IndividualPersonCacheUpdateService.*;
import static ee.sm.ti.teis.cache.person.LegalPersonCacheUpdateService.*;
@Component
@RequiredArgsConstructor
......@@ -35,88 +32,14 @@ public class DomainCacheConfig implements DomainCacheList {
individualPersonCacheUpdateService);
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.createdEventsQueueName}")
public void legalPersonCreatedEvent(LegalPersonCreatedDTO createdDTO) {
legalPersonCacheUpdateService.created(createdDTO.getPayload());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.updatedEventsQueueName}")
public void legalPersonUpdatedEvent(LegalPersonUpdatedDTO updatedDTO) {
legalPersonCacheUpdateService.updated(updatedDTO.getPayload().getId(), updatedDTO.getPayload());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.deletedEventsQueueName}")
public void legalPersonDeletedEvent(LegalPersonDeletedDTO deletedDTO) {
legalPersonCacheUpdateService.deleted(deletedDTO.getPayload().getId(), deletedDTO.getPayload());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.createdEventsQueueName}")
public void individualPersonCreatedEvent(IndividualPersonCreatedDTO createdDTO) {
individualPersonCacheUpdateService.created(createdDTO.getPayload());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.updatedEventsQueueName}")
public void individualPersonUpdatedEvent(IndividualPersonUpdatedDTO updatedDTO) {
individualPersonCacheUpdateService.updated(updatedDTO.getPayload().getId(), updatedDTO.getPayload());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.deletedEventsQueueName}")
public void individualPersonDeletedEvent(IndividualPersonDeletedDTO deletedDTO) {
individualPersonCacheUpdateService.deleted(deletedDTO.getPayload().getId(), deletedDTO.getPayload());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.cacheResponseQueueName}", concurrency = "1")
public void legalPersonCacheResponseEvent(LegalPersonCacheResponseDTO cacheResponseDTO) {
legalPersonCacheUpdateService.processSnapshot(cacheResponseDTO.getPayload(), cacheResponseDTO.getRequestMetaDTO().getUserId());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.cacheResponseQueueName}", concurrency = "1")
public void individualPersonCacheResponseEvent(IndividualPersonCacheResponseDTO cacheResponseDTO) {
individualPersonCacheUpdateService.processSnapshot(cacheResponseDTO.getPayload(), cacheResponseDTO.getRequestMetaDTO().getUserId());
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.cacheResponseQueueName}", concurrency = "1")
public void classifierItemCacheResponseEvent(ClassifierItemCacheResponseDTO cacheResponseDTO) {
classifierItemCacheUpdateService.processSnapshot(cacheResponseDTO.getPayload(), cacheResponseDTO.getRequestMetaDTO().getUserId());
}
@RabbitListener(queues = "#{@classifierDefinitionCacheUpdateService.cacheResponseQueueName}", concurrency = "1")
public void classifierDefinitionCacheResponseEvent(ClassifierDefinitionCacheResponseDTO cacheResponseDTO) {
classifierDefinitionCacheUpdateService.processSnapshot(cacheResponseDTO.getPayload(), cacheResponseDTO.getRequestMetaDTO().getUserId());
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.createdEventsQueueName}")
public void classifierItemCreatedEvent(ClassifierItemCreatedDTO createdDTO) {
classifierItemCacheUpdateService.created(createdDTO.getPayload());
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.updatedEventsQueueName}")
public void classifierItemCreatedEvent(ClassifierItemUpdatedDTO updatedDTO) {
classifierItemCacheUpdateService.updated(updatedDTO.getPayload().getId(), updatedDTO.getPayload());
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.deletedEventsQueueName}")
public void classifierItemDeletedEvent(ClassifierItemCacheUpdateService.ClassifierItemDeletedDTO updatedDTO) {
classifierItemCacheUpdateService.updated(updatedDTO.getPayload().getId(), updatedDTO.getPayload());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.cacheReinitializeQueueName}")
public void legalPersonReinitializeEvent(LegalPersonReinitializeDTO reinitializeDTO) {
legalPersonCacheUpdateService.reinitialize();
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.cacheReinitializeQueueName}")
public void individualPersonReinitializeEvent(IndividualPersonReinitializeDTO reinitializeDTO) {
individualPersonCacheUpdateService.reinitialize();
}
@RabbitListener(queues = "#{@classifierItemCacheUpdateService.cacheReinitializeQueueName}")
public void classifierItemReinitializeEvent(ClassifierItemReinitializeDTO reinitializeDTO) {
classifierItemCacheUpdateService.reinitialize();
}
@RabbitListener(queues = "#{@classifierDefinitionCacheUpdateService.cacheReinitializeQueueName}")
public void classifierDefinitionReinitializeEvent(ClassifierDefinitionReinitializeDTO reinitializeDTO) {
classifierDefinitionCacheUpdateService.reinitialize();
}
}
package ee.sm.ti.teis.payments.cache;
import ee.sm.ti.teis.cache.SnapshotBatchListener;
import ee.sm.ti.teis.cache.person.IndividualPersonCacheUpdateService;
import ee.sm.ti.teis.cache.person.IndividualPersonCacheUpdateService.*;
import ee.sm.ti.teis.domain.person.IndividualPerson;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component
public class IndividualPersonBatchListener extends SnapshotBatchListener<IndividualPersonCacheUpdateService, IndividualPerson, UUID> {
private final IndividualPersonCacheUpdateService individualPersonCacheUpdateService;
public IndividualPersonBatchListener(IndividualPersonCacheUpdateService individualPersonCacheUpdateService) {
super(individualPersonCacheUpdateService);
this.individualPersonCacheUpdateService = individualPersonCacheUpdateService;
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.cacheBatchResponseQueueName}", concurrency = "1")
public void processCacheBatchSnapshot(IndividualPersonCacheBatchResponseDTO response) {
batchProcess(response);
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.createdEventsQueueName}")
public void individualPersonCreatedEvent(IndividualPersonCreatedDTO createdDTO) {
individualPersonCacheUpdateService.created(createdDTO.getPayload());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.updatedEventsQueueName}")
public void individualPersonUpdatedEvent(IndividualPersonUpdatedDTO updatedDTO) {
individualPersonCacheUpdateService.updated(updatedDTO.getPayload().getId(), updatedDTO.getPayload());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.deletedEventsQueueName}")
public void individualPersonDeletedEvent(IndividualPersonDeletedDTO deletedDTO) {
individualPersonCacheUpdateService.deleted(deletedDTO.getPayload().getId(), deletedDTO.getPayload());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.cacheResponseQueueName}", concurrency = "1")
public void individualPersonCacheResponseEvent(IndividualPersonCacheResponseDTO cacheResponseDTO) {
individualPersonCacheUpdateService.processSnapshot(cacheResponseDTO.getPayload(), cacheResponseDTO.getRequestMetaDTO().getUserId());
}
@RabbitListener(queues = "#{@individualPersonCacheUpdateService.cacheReinitializeQueueName}")
public void individualPersonReinitializeEvent() {
individualPersonCacheUpdateService.reinitialize();
}
}
package ee.sm.ti.teis.payments.cache;
import ee.sm.ti.teis.cache.SnapshotBatchListener;
import ee.sm.ti.teis.cache.person.LegalPersonCacheUpdateService;
import ee.sm.ti.teis.cache.person.LegalPersonCacheUpdateService.*;
import ee.sm.ti.teis.domain.person.LegalPerson;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component
public class LegalPersonBatchListener extends SnapshotBatchListener<LegalPersonCacheUpdateService, LegalPerson, UUID> {
private final LegalPersonCacheUpdateService legalPersonCacheUpdateService;
public LegalPersonBatchListener(LegalPersonCacheUpdateService legalPersonCacheUpdateService) {
super(legalPersonCacheUpdateService);
this.legalPersonCacheUpdateService = legalPersonCacheUpdateService;
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.cacheBatchResponseQueueName}", concurrency = "1")
public void processCacheBatchSnapshot(LegalPersonCacheBatchResponseDTO response) {
batchProcess(response);
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.createdEventsQueueName}")
public void legalPersonCreatedEvent(LegalPersonCreatedDTO createdDTO) {
legalPersonCacheUpdateService.created(createdDTO.getPayload());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.updatedEventsQueueName}")
public void legalPersonUpdatedEvent(LegalPersonUpdatedDTO updatedDTO) {
legalPersonCacheUpdateService.updated(updatedDTO.getPayload().getId(), updatedDTO.getPayload());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.deletedEventsQueueName}")
public void legalPersonDeletedEvent(LegalPersonDeletedDTO deletedDTO) {
legalPersonCacheUpdateService.deleted(deletedDTO.getPayload().getId(), deletedDTO.getPayload());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.cacheResponseQueueName}", concurrency = "1")
public void legalPersonCacheResponseEvent(LegalPersonCacheResponseDTO cacheResponseDTO) {
legalPersonCacheUpdateService.processSnapshot(cacheResponseDTO.getPayload(), cacheResponseDTO.getRequestMetaDTO().getUserId());
}
@RabbitListener(queues = "#{@legalPersonCacheUpdateService.cacheReinitializeQueueName}")
public void legalPersonReinitializeEvent() {
legalPersonCacheUpdateService.reinitialize();
}
}
......@@ -55,6 +55,7 @@ teis:
resetmagic: ${TEST_DATA_RESET_MAGIC:}
cache:
queues: legalPersons, individualPersons, classifierItems, classifierDefinitions
batch-caching-services: legalPersons, individualPersons, classifierItems
rabbit:
gw-exchange-name: gw_exchange
gw-exchange-reply-timeout: ${RABBIT_TEMPLATE_GW_EXCHANGE_REPLY_TIMEOUT:6000}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment