Skip to content

Commit e1d3fc6

Browse files
authored
Nats web - core seperation (#293)
* docs: create release notes for 4.0.0-RC4 Release notes cover: - NATS JetStream consumer configuration improvements - Queue name validation for NATS backend - QueueType multi-backend architecture - Enhanced public API documentation - Bug fixes and maintenance updates Assisted-By: Claude Code * refactor: move service interfaces from rqueue-web to rqueue-core web package Move backend-agnostic service interface definitions to rqueue-core/src/main/java/com/github/sonus21/rqueue/web/, eliminating unnecessary coupling between backend implementations (rqueue-redis, rqueue-nats) and the dashboard layer (rqueue-web). Service interfaces moved: - RqueueSystemManagerService - RqueueQDetailService - RqueueJobService - RqueueDashboardChartService - RqueueViewControllerService - RqueueJobMetricsAggregatorService The interfaces are now in rqueue-core's web package, allowing backend modules to depend only on rqueue-core instead of the full web layer. The rqueue-web module continues to depend on rqueue-core and hosts the implementations (in the .service.impl package). This architectural refactoring aligns with the multi-backend SPI framework by ensuring backend implementations are independent of UI layers. Spring integration modules (rqueue-spring, rqueue-spring-boot-starter) continue to depend on rqueue-web for controller and template resources. Assisted-By: Claude Code * refactor: reorganize service interfaces and utilities in rqueue-core and rqueue-web Move backend-agnostic service interfaces to rqueue-core, ensuring clean separation between core abstractions and the dashboard UI layer: **Service Interfaces Relocated:** - Dashboard services → rqueue-core/src/main/java/com/github/sonus21/rqueue/web/ - RqueueSystemManagerService - RqueueQDetailService - RqueueJobService - RqueueDashboardChartService - RqueueViewControllerService - Metrics service → rqueue-core/src/main/java/com/github/sonus21/rqueue/metrics/ - RqueueMetricsAggregatorService (renamed from RqueueJobMetricsAggregatorService) **Package Organization Improvements:** - Move Pebble template functions from rqueue-web/utils/pebble/ to rqueue-web/web/pebble/ - DateTimeFunction, DeadLetterQueuesFunction, DefaultFunction, DurationFunction - ReadableDateTimeFunction, ResourceLoader, RqueuePebbleExtension - Aligns template utilities with web package structure **Impact:** - Backend modules (rqueue-redis, rqueue-nats) now depend only on rqueue-core - rqueue-web continues to depend on rqueue-core and hosts service implementations - Spring integration modules (rqueue-spring, rqueue-spring-boot-starter) keep rqueue-web dependency - Improved package organization with utilities co-located with the packages they serve Assisted-By: Claude Code * refactor: remove duplicate metrics aggregator service from rqueue-web Clean up duplicate RqueueJobMetricsAggregatorService from rqueue-web/src/main/java after moving the interface to rqueue-core/metrics as RqueueMetricsAggregatorService. Move the test RqueueTaskMetricsAggregatorServiceTest from rqueue-web to rqueue-core/src/test/java/com/github/sonus21/rqueue/metrics/, updating package declarations and class references to use the renamed RqueueMetricsAggregatorService. This ensures a single source of truth for the metrics aggregator interface in the core module. Assisted-By: Claude Code * refactor: remove service interface files from rqueue-web Remove duplicate service interface definitions from rqueue-web/src/main/java/com/github/sonus21/rqueue/web/service/ since they now live in rqueue-core: - RqueueDashboardChartService - RqueueJobService - RqueueQDetailService - RqueueSystemManagerService - RqueueViewControllerService The implementation classes in rqueue-web/service/impl remain unchanged, now implementing interfaces from rqueue-core. This completes the architectural refactoring with a single source of truth for service interfaces in rqueue-core. Assisted-By: Claude Code * refactor: remove release notes file Delete RELEASE_NOTES.md - release notes will be managed elsewhere. Assisted-By: Claude Code * fix: update test imports for service interfaces moved to rqueue-core Add imports for service interfaces that were moved from rqueue-web to rqueue-core/web package: - RqueueDashboardChartService - RqueueJobService - RqueueQDetailService - RqueueSystemManagerService - RqueueViewControllerService Update test files in rqueue-web/src/test/java to import these interfaces from rqueue-core.web instead of local package. Assisted-By: Claude Code * fix: update test imports for service interfaces moved to rqueue-core Add imports for service interfaces that were moved from rqueue-web to rqueue-core/web package in test files that reference them: - RqueueDashboardChartService - RqueueJobService - RqueueQDetailService - RqueueSystemManagerService - RqueueViewControllerService Update test files in rqueue-web/src/test/java to import these interfaces from rqueue-core.web instead of local package. Assisted-By: Claude Code * ci: add coveralls integration to push coverage reports Add Coveralls step to CI workflow to push JaCoCo coverage reports. This was missing from the coverage_report job, causing coverage data to not be uploaded to Coveralls. The step downloads merged coverage report and pushes it to Coveralls using the GitHub token. Assisted-By: Claude Code * ci: add conditional check and verbose logging for coveralls step - Only run coverallsJacoco if COVERALLS_REPO_TOKEN is set - Add --info flag for detailed logging to diagnose issues Assisted-By: Claude Code * ci: fail if COVERALLS_REPO_TOKEN is not set and add verbose logging Ensures the build fails if the token is missing so we can diagnose why coverage is not being sent to Coveralls. Assisted-By: Claude Code * ci: add debug logging for coveralls integration Log coveralls requests and errors to diagnose why coverage is not being sent. Assisted-By: Claude Code * ci: add environment variables for coveralls github actions detection Provide CI metadata (CI_NAME, CI_BUILD_NUMBER, CI_BRANCH, etc.) so the coveralls plugin can properly identify the build context and send coverage data with correct metadata to Coveralls API. Assisted-By: Claude Code * ci: enable coveralls debug output to diagnose request payload Write coveralls request JSON to file for debugging and display it in CI logs so we can see exactly what data is being sent to Coveralls API. Assisted-By: Claude Code * ci: fix coveralls integration for github actions The nbaztec coveralls-jacoco plugin auto-detects GitHub Actions and parses PR/branch info from GitHub's environment variables. Only need to set CI_BRANCH since GitHub_ACTIONS and GITHUB_TOKEN are auto-provided. Assisted-By: Claude Code * fix: use github.head_ref for CI_BRANCH in Coveralls integration For GitHub Actions pull requests, github.ref_name returns the PR reference (e.g., "293/merge") instead of the actual branch name. The coveralls-jacoco plugin uses CI_BRANCH to identify the branch in coverage reports. By using github.head_ref (which provides the branch name for PRs) with github.ref_name as a fallback (for push events), we ensure the correct branch is reported. Assisted-By: Claude Code * ci: wire GITHUB_TOKEN + BUILD_NUMBER for Coveralls (github-actions) The nbaztec coveralls-jacoco v1.2.20 plugin has a quirky GitHub Actions detection path. Reading its source (ServiceInfoParser.kt): - If GITHUB_ACTIONS is set but GITHUB_TOKEN is not, it emits service_name="github-actions" — which the Coveralls API does not recognize as a first-class service, so PR comments and branch correlation silently no-op. - When BOTH GITHUB_ACTIONS and GITHUB_TOKEN are set, it switches to service_name="github" (the canonical name). - service_job_id is read from BUILD_NUMBER (Jenkins-style), not GITHUB_RUN_ID — so we map github.run_id onto BUILD_NUMBER explicitly. - Branch is read from CI_BRANCH; github.head_ref is used so PR builds report the source branch instead of "<num>/merge". Verified locally by running coverallsJacoco with the production token plus a CircleCI-shaped env block (the plugin's CircleCI branch is the best-supported one) — Coveralls returned OK and the build appeared in the dashboard. Also re-adds coverallsRequest = file(...) so the request payload is written to build/coveralls-request.json. The workflow's "Push coverage to Coveralls" step already cats this file, which makes future regressions diagnosable from the CI log alone. Assisted-By: Claude Code
1 parent acad531 commit e1d3fc6

35 files changed

Lines changed: 75 additions & 56 deletions

.github/workflows/java-ci.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,22 @@ jobs:
463463
build/reports/jacoco/test/jacocoTestReport.xml
464464
build/reports/jacoco/coverageReportOnly/html
465465
if-no-files-found: ignore
466+
467+
- name: Push coverage to Coveralls
468+
env:
469+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
470+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
471+
BUILD_NUMBER: ${{ github.run_id }}
472+
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
473+
run: |
474+
if [ -z "$COVERALLS_REPO_TOKEN" ]; then
475+
echo "ERROR: COVERALLS_REPO_TOKEN is not set"
476+
exit 1
477+
fi
478+
./gradlew coverallsJacoco -i
479+
echo "=== Coveralls request payload ==="
480+
if [ -f build/coveralls-request.json ]; then
481+
cat build/coveralls-request.json | jq . 2>/dev/null || cat build/coveralls-request.json
482+
else
483+
echo "No coveralls-request.json found"
484+
fi

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ coverallsJacoco {
206206
reportSourceSets = publishedProjects.collectMany {
207207
it.sourceSets.main.allSource.srcDirs
208208
}
209+
coverallsRequest = file("build/coveralls-request.json")
209210
}
210211

211212
def javaFormatSources = providers.provider {

rqueue-web/src/main/java/com/github/sonus21/rqueue/web/service/RqueueJobMetricsAggregatorService.java renamed to rqueue-core/src/main/java/com/github/sonus21/rqueue/metrics/RqueueMetricsAggregatorService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616

17-
package com.github.sonus21.rqueue.web.service;
17+
package com.github.sonus21.rqueue.metrics;
1818

1919
import com.github.sonus21.rqueue.common.RqueueLockManager;
2020
import com.github.sonus21.rqueue.config.RqueueConfig;
@@ -57,7 +57,7 @@
5757

5858
@Component
5959
@Slf4j
60-
public class RqueueJobMetricsAggregatorService
60+
public class RqueueMetricsAggregatorService
6161
implements ApplicationListener<RqueueExecutionEvent>, DisposableBean, SmartLifecycle {
6262

6363
private final RqueueConfig rqueueConfig;
@@ -73,7 +73,7 @@ public class RqueueJobMetricsAggregatorService
7373
private List<Future<?>> eventAggregatorTasks;
7474

7575
@Autowired
76-
public RqueueJobMetricsAggregatorService(
76+
public RqueueMetricsAggregatorService(
7777
RqueueConfig rqueueConfig,
7878
RqueueWebConfig rqueueWebConfig,
7979
RqueueLockManager rqueueLockManager,

rqueue-web/src/main/java/com/github/sonus21/rqueue/web/service/RqueueDashboardChartService.java renamed to rqueue-core/src/main/java/com/github/sonus21/rqueue/web/RqueueDashboardChartService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616

17-
package com.github.sonus21.rqueue.web.service;
17+
package com.github.sonus21.rqueue.web;
1818

1919
import com.github.sonus21.rqueue.models.request.ChartDataRequest;
2020
import com.github.sonus21.rqueue.models.response.ChartDataResponse;

rqueue-web/src/main/java/com/github/sonus21/rqueue/web/service/RqueueJobService.java renamed to rqueue-core/src/main/java/com/github/sonus21/rqueue/web/RqueueJobService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616

17-
package com.github.sonus21.rqueue.web.service;
17+
package com.github.sonus21.rqueue.web;
1818

1919
import com.github.sonus21.rqueue.exception.ProcessingException;
2020
import com.github.sonus21.rqueue.models.response.DataViewResponse;

rqueue-web/src/main/java/com/github/sonus21/rqueue/web/service/RqueueQDetailService.java renamed to rqueue-core/src/main/java/com/github/sonus21/rqueue/web/RqueueQDetailService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616

17-
package com.github.sonus21.rqueue.web.service;
17+
package com.github.sonus21.rqueue.web;
1818

1919
import com.github.sonus21.rqueue.models.db.QueueConfig;
2020
import com.github.sonus21.rqueue.models.enums.DataType;

rqueue-web/src/main/java/com/github/sonus21/rqueue/web/service/RqueueSystemManagerService.java renamed to rqueue-core/src/main/java/com/github/sonus21/rqueue/web/RqueueSystemManagerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616

17-
package com.github.sonus21.rqueue.web.service;
17+
package com.github.sonus21.rqueue.web;
1818

1919
import com.github.sonus21.rqueue.models.db.QueueConfig;
2020
import com.github.sonus21.rqueue.models.event.RqueueBootstrapEvent;

rqueue-web/src/main/java/com/github/sonus21/rqueue/web/service/RqueueViewControllerService.java renamed to rqueue-core/src/main/java/com/github/sonus21/rqueue/web/RqueueViewControllerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616

17-
package com.github.sonus21.rqueue.web.service;
17+
package com.github.sonus21.rqueue.web;
1818

1919
import org.springframework.ui.Model;
2020

rqueue-web/src/test/java/com/github/sonus21/rqueue/web/service/RqueueTaskMetricsAggregatorServiceTest.java renamed to rqueue-core/src/test/java/com/github/sonus21/rqueue/metrics/RqueueTaskMetricsAggregatorServiceTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*/
1616

17-
package com.github.sonus21.rqueue.web.service;
17+
package com.github.sonus21.rqueue.metrics;
1818

1919
import static org.junit.jupiter.api.Assertions.assertEquals;
2020
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -88,12 +88,12 @@ class RqueueTaskMetricsAggregatorServiceTest extends TestBase {
8888
@Mock
8989
private MessageBroker messageBroker;
9090

91-
private RqueueJobMetricsAggregatorService rqueueJobMetricsAggregatorService;
91+
private RqueueMetricsAggregatorService rqueueJobMetricsAggregatorService;
9292

9393
@BeforeEach
9494
public void initService() throws IllegalAccessException {
9595
MockitoAnnotations.openMocks(this);
96-
rqueueJobMetricsAggregatorService = new RqueueJobMetricsAggregatorService(
96+
rqueueJobMetricsAggregatorService = new RqueueMetricsAggregatorService(
9797
rqueueConfig, rqueueWebConfig, rqueueLockManager, rqueueQStatsDao);
9898
doReturn(true).when(rqueueWebConfig).isCollectListenerStats();
9999
doReturn(1).when(rqueueWebConfig).getStatsAggregatorThreadCount();

rqueue-nats/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ dependencies {
4545
// rqueue-spring-boot-starter (auto-config), both of which reference this module's
4646
// types via compileOnly and gate them behind @ConditionalOnClass(JetStream.class).
4747
api project(":rqueue-core")
48-
// NATS-shaped web service impls (NatsRqueueQDetailService, etc.) implement interfaces
49-
// declared in rqueue-web. Mirrors how rqueue-redis pulls rqueue-web for the same reason.
50-
api project(":rqueue-web")
5148
api "io.nats:jnats:${natsVersion}"
5249
testImplementation project(":rqueue-test-util")
5350
testImplementation "org.testcontainers:testcontainers:${testcontainersVersion}"

0 commit comments

Comments
 (0)