Skip to content
Open
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
46 changes: 23 additions & 23 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
schedule:
- cron: '43 18 * * 0'
- cron: '30 1 * * 0'

jobs:
analyze:
name: Analyze
CodeQL-Build:
runs-on: ubuntu-latest

permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 17

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: java

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Build with Maven
run: mvn -B test
- name: Upload coverage to Codecov
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
<version>3.0.1</version>
<relativePath/>
</parent>
<groupId>io.github.majusko</groupId>
Expand All @@ -15,7 +15,7 @@
<description>Example project for Spring boot starter for Apache Pulsar</description>

<properties>
<java.version>11</java.version>
<java.version>17</java.version>

<!-- TESTS -->
<testcontainers.version>1.17.6</testcontainers.version>
Expand All @@ -27,7 +27,7 @@
<dependency>
<groupId>io.github.majusko</groupId>
<artifactId>pulsar-java-spring-boot-starter</artifactId>
<version>1.1.2</version>
<version>1.2.0</version>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

import io.github.majusko.pulsar.consumer.ConsumerAggregator;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

@Service
@DependsOn({"consumerAggregator"})
public class PulsarErrorHandler {

private final ConsumerAggregator aggregator;
private final ConsumerAggregator consumerAggregator;

public PulsarErrorHandler(ConsumerAggregator aggregator) {
this.aggregator = aggregator;
public PulsarErrorHandler(ConsumerAggregator consumerAggregator) {
this.consumerAggregator = consumerAggregator;
}

@EventListener(ApplicationReadyEvent.class)
public void pulsarErrorHandler() {
aggregator.onError(failedMessage -> failedMessage.getException().printStackTrace());
consumerAggregator.onError(failedMessage -> failedMessage.getException().printStackTrace());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import io.github.majusko.java.pulsar.example.consumer.ConsumerService;
import io.github.majusko.java.pulsar.example.producer.ProducerService;
import io.github.majusko.pulsar.consumer.ConsumerAggregator;
import org.apache.pulsar.client.api.PulsarClientException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.testcontainers.containers.PulsarContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
Expand All @@ -19,14 +21,18 @@
@Testcontainers
class JavaPulsarExampleApplicationTests {

@Autowired
private ConsumerAggregator consumerAggregator;

@Autowired
private ProducerService producerService;

@Autowired
private ConsumerService consumerService;

@Container
static PulsarContainer pulsarContainer = new PulsarContainer(DockerImageName.parse("apachepulsar/pulsar:latest"));
static PulsarContainer pulsarContainer = new PulsarContainer(DockerImageName.parse("apachepulsar/pulsar:latest"))
.waitingFor(Wait.forListeningPort());

@DynamicPropertySource
static void propertySettings(DynamicPropertyRegistry registry) {
Expand Down