StreamPulse is a multi-module, configurable, Java-compatible library written in Kotlin that enables real-time updates for your application with ease. Designed for modularity, it provides a core module that delivers essential functionality for managing long-lived server-client connections, ideal for applications needing live updates, notifications, or continuous data streams. This lightweight, framework-agnostic library simplifies the setup and management of these connections, allowing for easy integration with any Java-based application.
- Seamless Connections: Easily initialize and manage long-lived connections for real-time data streaming.
- Heartbeat Mechanism: Ensures stable connections with configurable heartbeats, automatically managing reconnections when needed.
- Flexible Configuration: Customize ping intervals, connection timeouts, and more for optimal performance.
- Error Handling & Reconnect Logic: Includes built-in mechanisms to handle connection errors and automated reconnections.
- Lightweight & Fast: Minimal overhead, designed for efficient and responsive real-time applications.
- Modular Architecture: Built as a multi-module project for flexibility and future extensibility.
Add StreamPulse to your project, configure your connection settings, and let it handle the rest. StreamPulse is built to work smoothly with Java-based web servers like Tomcat and others that support HTTP streaming.
- Java 11+
- Compatible with Java-based web servers (Tomcat, Jetty, etc.)
The project is hosted at jitpack.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.PaloMiklo</groupId>
<artifactId>stream-pulse</artifactId>
<version>1.0.0</version>
</dependency> dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
} dependencies {
implementation 'com.github.PaloMiklo:stream-pulse:1.0.0'
}In your application.yml file, add the necessary configuration properties to connect to your database.
streampulse:
url: jdbc:postgresql://localhost:5432/db
username: postgres
password: postgres
driver-class-name: org.postgresql.Driverjava
ConnectionHolder streamPulse = createConnection(streamPulseBuilder().build(), request, response);
streamPulse.connection().sendEvent("Welcome to StreamPulse!");
This documentation provides details on various scripts used for version management, building, testing, running, and deployment in the project.
version
Updates the project version across relevant files.
- Usage:
version.sh <new_version> - Description: Updates
<new_version>inpom.xml,pack.sh,run.sh, andbuild.gradle.ktsfiles. - Details:
- XML files: Replaces
<version>tags within the group IDcom.palomiklo. - Shell files: Updates any
VERSIONvariables. build.gradle.kts: Updates the version field.
- XML files: Replaces
test
Runs tests for the specified module.
- Usage:
test.sh [core|spring] - Description:
- Runs tests for either core or spring module.
- If no module is specified, tests are run for both core and spring.
run-spring
Compiles and runs the spring module.
- Description:
- Compiles the spring module.
- Starts the Spring Boot application if compilation succeeds.
- Environment Variable:
PROFILES: Used to specify active Spring profiles when running.
run-core
Builds and runs the core module.
- Description:
- Runs
pack.shto build the module. - Starts the core application. If
dependenciesis passed as an argument, it includes all JAR dependencies; otherwise, it creates a shadow JAR and runs it.
- Runs
rip-build
Removes build directories for the specified modules.
- Usage:
rip-build.sh [core|spring] - Description:
- Deletes the
builddirectory for eithercoreorspring. - If no module is specified, deletes the
builddirectories for both.
- Deletes the
pack
Builds and packages both core and spring modules.
- Description:
- Compiles and packages both modules.
- Displays success or failure messages for each module.
install-local
Installs the project into the local Maven repository.
- Usage:
install-local.sh [tests|test|t]- Description:
- Installs the project to the local Maven repository.
- If
testsis specified, it runs tests; otherwise, it skips tests.
ex-server
Deploys and runs the server.
- Description:
- Loads paths from
paths.envandscripts.env. - Navigates to
STREAM_PULSE_PATHto install dependencies usinginstall-local.sh. - Checks if the database is running for
CONSUMER_API_PATH. If not, it starts the database and runs the consumer.
- Loads paths from
ex-client
Executes the client application.
- Description:
- Loads paths from paths.env and
scripts.env. - Navigates to
CLIENT_PATHand executesCLIENT_EXE.
- Loads paths from paths.env and
Ensure environment files (paths.env, scripts.env) are correctly set up with required paths and executable
commands.
paths.env: Defines key directory paths for the project, including:STREAM_PULSE_PATH: Path to the StreamPulse library.CONSUMER_API_PATH: Path to the API consumer.CLIENT_PATH: Path to the client application.
scripts.env: Contains reusable functions for managing common tasks:CLIENT_EXE: Starts the client application.DB_EXE: Brings up the database.DB_VALIDATION: Checks if the database is running.
These files are not part of the core library but are used in scripts to streamline project setup and execution.
settings.json
{
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 150,
"editor.formatOnSave": true,
"java.project.sourcePaths": [
"src/main/java",
"src/test/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic",
"java.dependency.packagePresentation": "hierarchical",
"java.jdt.ls.vmargs": "--enable-preview",
"jdk.runConfig.vmOptions": "--enable-preview",
"java.configuration.runtimes": [
{
"name": "JavaSE-21",
"path": ".../jdk-21.0.1",
"default": true
}
],
"jdk.runConfig.arguments": "--enable-preview"
}