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

Chk 3279 change stream #6

Merged
merged 30 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7e4a945
feat(change-stream): add first implementation of change stream
CianoDanilo Oct 2, 2024
ff08b79
feat(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
6395492
Merge branch 'refs/heads/main' into CHK-3279-change-stream
CianoDanilo Oct 3, 2024
35afda2
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
4149e18
Merge branch 'refs/heads/main' into CHK-3279-change-stream
CianoDanilo Oct 3, 2024
a56c7b7
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
31637b1
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
7b124a5
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
b2d4238
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
ac32328
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
ed79ef4
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 3, 2024
4045313
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 4, 2024
3e39f08
wip(change-stream): add first implementation of change stream
CianoDanilo Oct 4, 2024
ff88ae7
wip(change-stream): add tests
CianoDanilo Oct 4, 2024
e9a91a4
Rename .java to .kt
CianoDanilo Oct 4, 2024
d5d3606
wip(change-stream): add tests
CianoDanilo Oct 4, 2024
21b6a69
wip(change-stream): update README.md
CianoDanilo Oct 7, 2024
239d5cb
wip(change-stream): update UAT deployment file
CianoDanilo Oct 7, 2024
3127c26
wip(change-stream): add jacoco report
CianoDanilo Oct 7, 2024
da58114
wip(change-stream): update code review pipeline
CianoDanilo Oct 7, 2024
3626d0d
wip(change-stream): update code review pipeline
CianoDanilo Oct 7, 2024
22a3f5a
wip(change-stream): update code review pipeline
CianoDanilo Oct 7, 2024
cac9001
wip(change-stream): update code review pipeline
CianoDanilo Oct 7, 2024
33af64c
wip(change-stream): add tests
CianoDanilo Oct 7, 2024
6db5a5b
wip(change-stream): refactor of on error resume policy, add retry mec…
CianoDanilo Oct 7, 2024
fbb18b0
wip(change-stream): add gradle.lockfile, rename retry policy properti…
CianoDanilo Oct 7, 2024
8735dad
wip(change-stream): update envConfig
CianoDanilo Oct 7, 2024
bdfc3b7
wip(change-stream): update verification-metadata.xml
CianoDanilo Oct 7, 2024
6b82e9c
wip(change-stream): update tests
CianoDanilo Oct 7, 2024
79dc179
wip(change-stream): update helm Chart.yaml
CianoDanilo Oct 7, 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
2 changes: 1 addition & 1 deletion .devops/code-review-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ stages:
codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'. Alias: codeCoverageTool. Code coverage tool. Default: None.
codeCoverageClassFilesDirectories: 'build/classes/main/' # string. Alias: classFilesDirectories. Required when codeCoverageTool != None. Class files directories. Default: build/classes/main/.
javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias: javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
jdkVersionOption: '1.17' # 'default' | '1.11' | '1.10' | '1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion. JDK version. Default: default.
jdkVersionOption: '1.21' # 'default' | '1.11' | '1.10' | '1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion. JDK version. Default: default.
sonarQubeRunAnalysis: true

- task: SonarCloudPublish@1
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ COPY --from=build --chown=user ${EXTRACTED}/application/ ./
RUN true


ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar", "--enable-preview","org.springframework.boot.loader.JarLauncher"]
ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar", "--enable-preview","org.springframework.boot.loader.launch.JarLauncher"]

54 changes: 25 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,30 @@ to get a good default configuration.

If you want to customize the application environment, reference this table:

| Variable name | Description | type | default |
|----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------|---------|
| MONGO_HOST | Host where MongoDB instance used to persist wallet data | hostname (string) | |
| MONGO_PORT | Port where MongoDB is bound to in MongoDB host | number | |
| MONGO_USERNAME | MongoDB username used to connect to the database | string | |
| MONGO_PASSWORD | MongoDB password used to connect to the database | string | |
| MONGO_SSL_ENABLED | Whether SSL is enabled while connecting to MongoDB | string | |
| MONGO_DB_NAME | Mongo database name | string | |
| MONGO_MIN_POOL_SIZE | Min amount of connections to be retained into connection pool. See docs * | string | |
| MONGO_MAX_POOL_SIZE | Max amount of connections to be retained into connection pool.See docs * | string | |
| MONGO_MAX_IDLE_TIMEOUT_MS | Max timeout after which an idle connection is killed in milliseconds. See docs * | string | |
| MONGO_CONNECTION_TIMEOUT_MS | Max time to wait for a connection to be opened. See docs * | string | |
| MONGO_SOCKET_TIMEOUT_MS | Max time to wait for a command send or receive before timing out. See docs * | string | |
| MONGO_SERVER_SELECTION_TIMEOUT_MS | Max time to wait for a server to be selected while performing a communication with Mongo in milliseconds. See docs * | string | |
| MONGO_WAITING_QUEUE_MS | Max time a thread has to wait for a connection to be available in milliseconds. See docs * | string | |
| MONGO_HEARTBEAT_FREQUENCY_MS | Hearth beat frequency in milliseconds. This is an hello command that is sent periodically on each active connection to perform an health check. See docs * | string | |
| ROOT_LOGGING_LEVEL | Application root logger level | string | INFO |
| APP_LOGGING_LEVEL | it.pagopa logger level | string | INFO |
| WEB_LOGGING_LEVEL | Web logger level | string | DEBUG |
| REDIS_HOST | Redis host name | string | |
| REDIS_PASSWORD | Redis password | string | |
| REDIS_PORT | Redis port | string | |
| REDIS_SSL_ENABLED | Whether SSL is enabled while connecting to Redis | string | |
| WALLET_SESSION_TTL_SECONDS | Wallet session TTL in seconds | int | |
| EXPIRATION_QUEUE_NAME | Name of expiration queue | string | |
| EXPIRATION_QUEUE_TTL_SECONDS | TTL in seconds for published message | string | |
| EXPIRATION_QUEUE_CONNECTION_STRING | Connection string to storage queue | string | |
| EXPIRATION_QUEUE_VISIBILITY_TIMEOUT_SEC | Visibility timeout in seconds for expired event | | |
| Variable name | Description | type | default |
|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|---------|
| MONGO_HOST | Host where MongoDB instance used to persist wallet data | hostname (string) | |
| MONGO_PORT | Port where MongoDB is bound to in MongoDB host | number | |
| MONGO_USERNAME | MongoDB username used to connect to the database | string | |
| MONGO_PASSWORD | MongoDB password used to connect to the database | string | |
| MONGO_SSL_ENABLED | Whether SSL is enabled while connecting to MongoDB | string | |
| MONGO_DB_NAME | Mongo database name | string | |
| MONGO_MIN_POOL_SIZE | Min amount of connections to be retained into connection pool. See docs * | string | |
| MONGO_MAX_POOL_SIZE | Max amount of connections to be retained into connection pool.See docs * | string | |
| MONGO_MAX_IDLE_TIMEOUT_MS | Max timeout after which an idle connection is killed in milliseconds. See docs * | string | |
| MONGO_CONNECTION_TIMEOUT_MS | Max time to wait for a connection to be opened. See docs * | string | |
| MONGO_SOCKET_TIMEOUT_MS | Max time to wait for a command send or receive before timing out. See docs * | string | |
| MONGO_SERVER_SELECTION_TIMEOUT_MS | Max time to wait for a server to be selected while performing a communication with Mongo in milliseconds. See docs * | string | |
| MONGO_WAITING_QUEUE_MS | Max time a thread has to wait for a connection to be available in milliseconds. See docs * | string | |
| MONGO_HEARTBEAT_FREQUENCY_MS | Hearth beat frequency in milliseconds. This is an hello command that is sent periodically on each active connection to perform an health check. See docs * | string | |
| ROOT_LOGGING_LEVEL | Application root logger level | string | INFO |
| APP_LOGGING_LEVEL | it.pagopa logger level | string | INFO |
| WEB_LOGGING_LEVEL | Web logger level | string | DEBUG |
| CDC_LOG_EVENTS_COLLECTION_NAME | The name of the collection the CDC will listen to | string | |
| CDC_LOG_EVENTS_OPERATION_TYPE | List of operation type the CDC will handle | list of strings | |
| CDC_LOG_EVENTS_PROJECT | The field provided by the change stream event | string | |
| CDC_SEND_RETRY_MAX_ATTEMPTS | Max configurable attempts for performing the logic business related to a change event | long | |
| CDC_SEND_RETRY_INTERVAL_IN_MS | Configurable interval in milliseconds between retries attempts | long | |

(*): for Mongo connection string options
see [docs](https://www.mongodb.com/docs/drivers/java/sync/v4.3/fundamentals/connection/connection-options/#connection-options)
Expand All @@ -106,7 +102,7 @@ $ docker compose up --build

- git
- gradle
- jdk-17
- jdk-21

### Run the project

Expand Down
29 changes: 29 additions & 0 deletions build.gradle.kts
CianoDanilo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ plugins {
id("org.springframework.boot") version "3.3.4"
id("io.spring.dependency-management") version "1.1.6"
id("com.diffplug.spotless") version "6.18.0"
id("org.sonarqube") version "4.0.0.2929"
id("com.dipien.semantic-version") version "2.0.0" apply false
jacoco
application
Expand All @@ -32,6 +33,8 @@ dependencyLocking { lockAllConfigurations() }

dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive")
implementation("org.springframework.boot:spring-boot-starter-actuator")
infantesimone marked this conversation as resolved.
Show resolved Hide resolved
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
Expand All @@ -41,6 +44,7 @@ dependencies {
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

Expand Down Expand Up @@ -80,3 +84,28 @@ configure<com.diffplug.gradle.spotless.SpotlessExtension> {
endWithNewline()
}
}

tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}

tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report

classDirectories.setFrom(
files(
classDirectories.files.map {
fileTree(it).matching { exclude("it/pagopa/wallet/WalletApplicationKt.class") }
}
)
)

reports { xml.required.set(true) }
}

/**
* Task used to expand application properties with build specific properties such as artifact name
* and version
*/
tasks.processResources { filesMatching("application.properties") { expand(project.properties) } }
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ services:
- pagopa-cdc-wallet-net

redis-insight:
container_name: wallet-redis-insight
container_name: wallet-cdc-redis-insight
image: redislabs/redisinsight@sha256:bbfe06e00282fc051bbfadd49286865e75b359baea62f0d56af0cb0d5684b942
ports:
- "8001:8001"
Expand Down Expand Up @@ -83,7 +83,7 @@ networks:
driver: bridge
ipam:
config:
- subnet: 10.20.0.0/16
gateway: 10.20.0.1
- subnet: 10.21.0.0/16
gateway: 10.21.0.1


Loading
Loading