-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,838 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name-template: '$RESOLVED_VERSION' | ||
tag-template: '$RESOLVED_VERSION' | ||
prerelease: true | ||
template: | | ||
# What's Changed | ||
$CHANGES | ||
categories: | ||
- title: Breaking | ||
label: breaking | ||
- title: New | ||
label: enhancement | ||
- title: Bug Fixes | ||
label: bug | ||
- title: Maintenance | ||
label: maintenance | ||
- title: Documentation | ||
label: documentation | ||
- title: Dependency Updates | ||
label: dependencies | ||
|
||
version-resolver: | ||
major: | ||
labels: | ||
- breaking | ||
minor: | ||
labels: | ||
- enhancement | ||
patch: | ||
labels: | ||
- bug | ||
- maintenance | ||
- documentation | ||
- dependencies | ||
- security | ||
|
||
exclude-labels: | ||
- skip-changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '8' | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradlew- | ||
- run: | | ||
chmod +x gradlew | ||
./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Update Changelog | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
changelog: | ||
name: Update Changelog | ||
runs-on: ubuntu-latest | ||
if: ${{ !contains(github.event.head_commit.message, 'skip-snapshot') }} | ||
steps: | ||
- uses: release-drafter/release-drafter@master | ||
id: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Update Snapshot | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
snapshot: | ||
name: Update Snapshot | ||
runs-on: ubuntu-latest | ||
if: "${{ !contains(github.event.head_commit.message, 'skip-snapshot') }}" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '8' | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradlew- | ||
- uses: crazy-max/[email protected] | ||
with: | ||
gpg_private_key: "${{ secrets.GPG_PRIVATE_KEY }}" | ||
passphrase: "${{ secrets.GPG_PASSPHRASE }}" | ||
|
||
- run: | | ||
[[ "${{ steps.release.outputs.tag_name }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1 | ||
chmod +x gradlew | ||
./gradlew -Psign-required=true publishToSonatype closeAndReleaseSonatypeStagingRepository -Pversion="${{ steps.release.outputs.tag_name }}-SNAPSHOT" -PinfumiaSigningKey="${{ secrets.GPG_SECRET_KEY_ID }}" -PinfumiaSigningPassword="${{ secrets.GPG_PASSPHRASE }}" -PsonatypeUsername="${{ secrets.SONATYPE_USERNAME }}" -PsonatypePassword="${{ secrets.SONATYPE_PASSWORD }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,10 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
replay_pid* | ||
.idea/ | ||
target/ | ||
.gradle/ | ||
build/ | ||
*.iml | ||
*.project | ||
*.classpath | ||
.settings/ | ||
**/bin/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
# pubsub | ||
Simplified pubsub library for Redis and various databases. | ||
![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/tr.com.infumia/pubsub?label=maven-central&server=https%3A%2F%2Foss.sonatype.org%2F) | ||
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/tr.com.infumia/pubsub?label=maven-central&server=https%3A%2F%2Foss.sonatype.org) | ||
## How to Use (Developers) | ||
### Code | ||
```groovy | ||
repositories { | ||
maven("https://jitpack.io/") | ||
} | ||
dependencies { | ||
// Base module | ||
implementation "tr.com.infumia:pubsub:VERSION" | ||
// Required, https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine/ | ||
implementation "com.github.ben-manes.caffeine:caffeine:2.9.3" // for java-8+ | ||
implementation "com.github.ben-manes.caffeine:caffeine:3.1.8" // for java-11+ | ||
// Pub/Sub using Redis (Optional) | ||
implementation "tr.com.infumia:pubsub-redis:VERSION" | ||
// Required, https://mvnrepository.com/artifact/io.lettuce/lettuce-core/ | ||
implementation "io.lettuce:lettuce-core:6.3.2.RELEASE" | ||
// Kotlin extensions (Optional) | ||
implementation "tr.com.infumia:pubsub-kotlin:VERSION" | ||
// Kotlin protobuf serializer (Optional) | ||
implementation "tr.com.infumia:pubsub-kotlin-protobuf:VERSION" | ||
// Required, https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect/ | ||
implementation "org.jetbrains.kotlin:kotlin-reflect:2.0.0" | ||
// Required, https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-serialization-core/ | ||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.0" | ||
// Required, https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-serialization-protobuf/ | ||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.7.0" | ||
} | ||
``` | ||
```java | ||
void pubsub() {} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
plugins { | ||
java | ||
alias(libs.plugins.indra.publishing.sonatype) | ||
} | ||
|
||
repositories.mavenCentral() | ||
|
||
subprojects { | ||
apply<JavaPlugin>() | ||
|
||
repositories.mavenCentral() | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(8) | ||
} | ||
} | ||
|
||
tasks { | ||
compileJava { | ||
options.compilerArgs.add("-Xlint:-processing") | ||
options.compilerArgs.add("-Xlint:-options") | ||
} | ||
} | ||
} | ||
|
||
indraSonatype { | ||
useAlternateSonatypeOSSHost("s01") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
java | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation(libs.indra) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "buildSrc" |
33 changes: 33 additions & 0 deletions
33
buildSrc/src/main/kotlin/tr.com.infumia.pubsub.build.publishing.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
plugins { | ||
id("net.kyori.indra") | ||
id("net.kyori.indra.publishing") | ||
} | ||
|
||
val projectName = project.property("artifact-id") as String | ||
|
||
indra { | ||
mitLicense() | ||
github("infumia", "pubsub") | ||
configurePublications { | ||
artifactId = projectName | ||
|
||
pom { | ||
name = projectName | ||
inceptionYear = "2024" | ||
description = "Simplified pubsub library for Redis and various databases." | ||
developers { | ||
developer { | ||
name = "Hasan Demirtaş" | ||
url = "https://github.com/portlek/" | ||
} | ||
} | ||
organization { | ||
name = "Infumia" | ||
url = "https://github.com/infumia/" | ||
} | ||
} | ||
} | ||
if (project.hasProperty("sign-required")) { | ||
signWithKeyFromPrefixedProperties("infumia") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id("tr.com.infumia.pubsub.build.publishing") | ||
} | ||
|
||
dependencies { | ||
compileOnly(libs.caffeine) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
artifact-id=pubsub |
21 changes: 21 additions & 0 deletions
21
common/src/main/java/tr/com/infumia/pubsub/AwaitingResponder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package tr.com.infumia.pubsub; | ||
|
||
import java.time.Duration; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
final class AwaitingResponder<T> { | ||
private final CompletableFuture<T> future = new CompletableFuture<>(); | ||
final Class<T> responseType; | ||
|
||
AwaitingResponder(final Class<T> responseType) { | ||
this.responseType = responseType; | ||
} | ||
|
||
void complete(final T response) { | ||
this.future.complete(response); | ||
} | ||
|
||
CompletableFuture<T> await(final Duration timeout) { | ||
return Internal.delay(this.future, timeout); | ||
} | ||
} |
Oops, something went wrong.