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

build: Chaing publish repository jitpack to maven central #130

Merged
merged 6 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ bin/
.DS_Store

.idea/
target/

### Secret ###
publish.sh
58 changes: 35 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
# Netx <img src="https://avatars.githubusercontent.com/u/149151221?s=200&v=4" height = 100 align = left>

> Saga framework / Supports redis-stream and reactive

<img src = "https://github.com/rooftop-MSA/Netx/assets/62425964/08ed9050-1923-42b5-803f-5b7ea37a263f" width="360" align="right"/>
> Saga framework / Supports redis-stream and blocking, reactive paradigms.

<br>

![version 0.4.0](https://img.shields.io/badge/version-0.4.0-black?labelColor=black&style=flat-square) ![jdk 17](https://img.shields.io/badge/minimum_jdk-17-orange?labelColor=black&style=flat-square) ![load-test](https://img.shields.io/badge/load%20test%2010%2C000%2C000-success-brightgreen?labelColor=black&style=flat-square)
![redis--stream](https://img.shields.io/badge/-redis--stream-da2020?style=flat-square&logo=Redis&logoColor=white)

Netx is a Saga framework that supports Redis-Stream.
`Netx` provides the following features:
**TPS(6,000)** on my default Macbook air m2. _[link](#Test1-TPS)_

Netx is a Saga framework, that provides following features.

1. Supports redis-stream.
2. Supports synchronous API and asynchronous [Reactor](https://projectreactor.io/) API.
3. Supports both Orchestration and Choreograph.
4. Automatically reruns loss events.
5. Automatically applies **`Transactional messaging pattern`**.
6. Supports backpressure to control the number of events that can be processed per node.
7. Prevents multiple nodes in the same group from receiving duplicate events.
8. Ensures message delivery using the `At Least Once` approach.

You can see the test results [here](#Test).

1. Supports synchronous API and asynchronous [Reactor](https://projectreactor.io/) API.
2. Supports both Orchestration and Choreograph.
3. Automatically reruns lost events.
4. Supports backpressure to control the number of events that can be processed per node.
5. Prevents multiple nodes in the same group from receiving duplicate events.
6. Ensures message delivery using the `At Least Once` approach.
## Download

```groovy
dependencies {
implementation "org.rooftopmsa:netx:${version}"
}
```

## How to use

Expand All @@ -43,7 +54,7 @@ When configured automatically with the `@EnableSaga` annotation, netx uses the f

| KEY | EXAMPLE | DESCRIPTION | DEFAULT |
|-------------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| **netx.mode** | redis | Specifies the mode implementation used for Saga management. | |
| **netx.mode** | redis | Specifies the mode implementation used for Saga management. Currently, only redis is available as an option. | |
| **netx.host** | localhost | The host URL of the event stream used for Saga management. (e.g., redis host) | |
| **netx.password** | 0000 | The password used to connect to the event stream used for Saga management. If not set, 0000 is mapped as the password. | 0000 |
| **netx.port** | 6379 | The port of the message queue used for Saga management. | |
Expand Down Expand Up @@ -267,20 +278,21 @@ fun exists(param: Any): Mono<Any> {
}
```

## Test

## Download
### Test1-TPS

```groovy
repositories {
maven { url "https://jitpack.io" }
}
> **How to test?**
> For 333,333 tests, the sequence proceeds as follows: saga start -> saga join -> saga commit.
> For 444,444 tests, the sequence proceeds as follows: saga start -> saga join -> saga commit -> saga rollback.
> The combined test, consisting of both sequences, took a total of 2 minutes and 10 seconds.

<img width="700" alt="Netx load test 777,777" src="https://github.com/devxb/Netx/assets/62425964/2935f194-f246-40de-b9b3-be0505b19446">

dependencies {
implementation "com.github.devxb:netx:${version}"
}
```

### Test2-Rollback

#### Events-Scenario0. Handle saga event
> **How to test?**
> Pending order -> Pending payment -> Successful payment -> Successful order -> Inventory deduction failure -> Order failure -> Payment failure

When another distributed server (or itself) starts or changes the state of a saga through the sagaManager,
<img src = "https://github.com/rooftop-MSA/Netx/assets/62425964/08ed9050-1923-42b5-803f-5b7ea37a263f"/>
26 changes: 5 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,22 @@ import org.springframework.boot.gradle.plugin.SpringBootPlugin

plugins {
id "application"
id 'org.jetbrains.dokka' version "${dokkaVersion}"
id "org.jetbrains.dokka" version "${dokkaVersion}"
id "org.jetbrains.kotlin.jvm" version "${jetbrainKotlinVersion}"
id "org.jetbrains.kotlin.plugin.spring" version "${jetbrainKotlinVersion}"
id "org.springframework.boot" version "${springbootVersion}" apply false
id "io.spring.dependency-management" version "${springDependencyManagementVersion}"
id "org.sonarqube" version "${sonarcloudVersion}"
id "signing"
id "maven-publish"
}

group = "${group}"
version = "${version}"

archivesBaseName = "netx"
sourceCompatibility = "${compatibility}"
targetCompatibility = "${compatibility}"

jar {
enabled = true
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

repositories {
mavenCentral()
}
Expand All @@ -37,23 +28,16 @@ dependencyManagement {
}
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}

apply from: "gradle/streams.gradle"
apply from: "gradle/test.gradle"
apply from: "gradle/core.gradle"
apply from: "gradle/sonar.gradle"
apply from: "gradle/kotlin.gradle"
apply from: "gradle/spring.gradle"
apply from: "gradle/docs.gradle"
apply from: "gradle/publish.gradle"

wrapper {
gradleVersion = "7.6.1"
gradleVersion = "8.7"
distributionType = Wrapper.DistributionType.ALL
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
kotlin.code.style=official

### Project ###
group=org.rooftop.netx
version=0.3.9
group=org.rooftopmsa
version=0.4.0
compatibility=17

### Sonarcloud ###
Expand Down
67 changes: 67 additions & 0 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
java {
withJavadocJar()
withSourcesJar()
}

ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

publishing {
repositories {
maven {
def releaseRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

name = "OSSRH"
url = isReleaseVersion ? releaseRepo : snapshotRepo

credentials {
username = project.hasProperty("ossrhUsername") ? project.property("ossrhUsername") : ""
password = project.hasProperty("ossrhPassword") ? project.property("ossrhPassword") : ""
}
}
}

publications {
mavenJava(MavenPublication) {
from components.java

pom {
groupId = "org.rooftopmsa"
name = "netx"
description = "Saga framework / Supports redis stream and reactive"
url = 'https://github.com/devxb/netx'
packaging = 'jar'

licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://github.com/devxb/Netx/blob/main/LICENSE'
}
}

scm {
url = "https://github.com/devxb/netx"
connection = "scm:git://github.com:devxb/netx.git"
developerConnection = "scm:git://github.com:devxb/netx.git"
}

developers {
developer {
id = 'devxb'
name = 'Junyoung Lee'
email = 'develxb@gmail.com'
}
}
}
}
}
}

signing {
// Must be passed under properties
// signing.keyId
// signing.password
// signing.secretKeyRingFile
sign publishing.publications.mavenJava
}

4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
5 changes: 0 additions & 5 deletions jitpack.yml

This file was deleted.

12 changes: 6 additions & 6 deletions src/test/kotlin/org/rooftop/netx/client/NetxLoadTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.TestPropertySource
import kotlin.time.Duration.Companion.minutes

@DisplayName("Netx 부하테스트")
@DisplayName("Netx LoadTest")
@SpringBootTest(
classes = [
RedisContainer::class,
Expand All @@ -29,13 +29,13 @@ internal class NetxLoadTest(
private val sagaReceiveStorage: SagaReceiveStorage,
) : FunSpec({

test("Netx는 부하가 가중되어도, 결과적 일관성을 보장한다.") {
test("with 77,777 transactions.") {
forAll(
row(1, 1),
// row(10, 10),
// row(100, 100),
// row(1_000, 1_000),
// row(10_000, 10_000),
row(10, 10),
row(100, 100),
row(1_000, 1_000),
row(10_000, 10_000),
) { commitLoadCount, rollbackLoadCount ->
sagaReceiveStorage.clear()

Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/fast-recover-mode.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ netx.node-name=netx-node
netx.recovery-milli=100
netx.orphan-milli=100
netx.backpressure=40
netx.logging.level=info
netx.logging.level=warn
netx.pool-size=10
Loading