Skip to content

Commit

Permalink
added reproducer for quarkusio/quarkus#35966
Browse files Browse the repository at this point in the history
  • Loading branch information
sdaschner committed Sep 18, 2023
1 parent fc2ba37 commit 0688781
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 60 deletions.
24 changes: 6 additions & 18 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,17 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-picocli</artifactId>
</dependency>

<!-- <dependency>-->
<!-- <groupId>io.quarkus</groupId>-->
<!-- <artifactId>quarkus-rest-client-reactive-jsonb</artifactId>-->
<!-- </dependency>-->
<!-- when switching to classic, the issue with https://github.com/quarkusio/quarkus/issues/35966 goes away -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jsonb</artifactId>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.11.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.20.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@Path("updates")
@Produces(MediaType.SERVER_SENT_EVENTS)
//
// this class is required due to https://github.com/quarkusio/quarkus/issues/35967
// this class is required due to https://github.com/quarkusio/quarkus/issues/35967 (only when quarkus-rest-client-jsonb is used, not for -reactive)
// if this class gets removed, the SSE client connection stops working
public class DummyUpdatesResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void someMethod() {
WebTarget target = client.target("http://localhost:8080/updates");
updateSource = SseEventSource.target(target).build();
updateSource.register(ev -> {
System.out.println(ev.getName());
System.out.println(ev.readData());
System.out.println("ev.isEmpty() = " + ev.isEmpty());
System.out.println("event: " + ev.getName() + " " + ev.readData());
}, thr -> {
System.err.println("Error in SSE updates");
thr.printStackTrace();
Expand All @@ -44,7 +44,7 @@ public void someMethod() {
System.out.println("SSE opened");
updateSource.open();

LockSupport.parkNanos(5_000_000_000L);
LockSupport.parkNanos(7_000_000_000L);
}

}
32 changes: 0 additions & 32 deletions client/src/test/java/SseClientTest.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ public class UpdatesResource {

@GET
public void updates(@Context SseEventSink eventSink) {
eventSink.send(createEvent());
eventSink.send(createEvent("test234", "test"));
LockSupport.parkNanos(1_000_000_000L);
eventSink.send(createEvent());
eventSink.send(createEvent("test123", ""));
LockSupport.parkNanos(1_000_000_000L);
eventSink.send(createEvent());
eventSink.send(createEvent("test234", "test"));
LockSupport.parkNanos(1_000_000_000L);
eventSink.send(createEvent("test123", ""));
}

private OutboundSseEvent createEvent() {
private OutboundSseEvent createEvent(String name, String data) {
return sse.newEventBuilder()
.name("test")
.data("test")
.name(name)
.data(data)
.build();
}

Expand Down

0 comments on commit 0688781

Please sign in to comment.