Skip to content

About

Experimental support using stream-source in Spring projects.

Resources

Code of conduct

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

Overview

Experimental support for the use of the stream-source library in Spring projects.

SSE Streaming for RestClient

ServerSentEventSource is an implementation of Source that parses and decodes Server-sent events.

For events with String data (not converted):

InputStream body = ...;
ServerSentEventSource<String> source = new ServerSentEventSource<>(uri, body);

For events with data converted to higher level objects, also provide HttpMessageConverters and an EventProcessor to set the target Java type, and optionally the MediaType to choose an HttpMessageConverter:

ServerSentEventSource<Person> source =
        new ServerSentEventSource<Person>(url, body, converters, event -> {
            event.setTargetType(Person.class);
        });

For example use with RestClient, see SseIntegrationTests.

Maven Artefact

<dependency>
    <groupId>org.springframework.experimental.streamsource</groupId>
    <artifactId>stream-source-spring-extensions</artifactId>
    <version>0.8.0-SNAPSHOT</version>
</dependency>

Build

Currently stream-source is resolved from the local Maven repository. To install it, clone spring-projects-experimental/stream-source locally and run ./gradlew publishToMavenLocal.

About

Experimental support using stream-source in Spring projects.

Resources

Code of conduct

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages