Giter VIP home page Giter VIP logo

samples-spring-sse-redis's Introduction

Samples: Spring Server-Sent Events with Redis

Build

This repository contains sample applications that showcase Spring Framework’s support for server-sent events backed by Redis Pub/Sub.

The name of each sample application tells the web stack it’s based on, and optionally the data access paradigm it uses to interact with Redis:

  • sample-mvc-imperative: Spring MVC Sample with Imperative Spring Data Redis

  • sample-mvc-reactive: Spring MVC Sample with Reactive Spring Data Redis

  • sample-webflux: Spring WebFlux Sample (with Reactive Spring Data Redis)

Getting Started

Requirements

Java 11 is required to run the samples.

The project is built using Gradle and uses Gradle Wrapper to take care of downloading the appropriate Gradle version.

Running the Samples

Each sample is a Spring Boot based application that can be started:

  • using the bootRun task of the appropriate sample application

  • from IDE by running sample application’s main class

By default, all samples start web server on port 8080 and attempt to connect to Redis running locally at port 6379. In order to change those defaults, use appropriate Spring Boot configuration properties.

All the samples expose the following two HTTP endpoints:

  • POST /topics/{name:[a-z]{2}}

    Generates an event and publishes it to the specified Redis channel. For example, the following request will result in event being published to channel named aa:

    $ curl -s -X POST http://localhost:8080/topics/aa
  • GET /topics/{name:[a-z]{2}}

    Subscribes to server-sent events published to the specified Redis channel. The following request will subscribe to events published to channel named aa:

    $ curl -N http://localhost:8080/topics/aa

Spring MVC Sample with Imperative Redis

This sample uses Spring MVC and a traditional imperative Redis using Jedis driver.

$ ./gradlew :sample-mvc-imperative:bootRun

Spring MVC Sample with Reactive Redis

This sample uses Spring MVC combined with reactive Redis using Lettuce driver.

$ ./gradlew :sample-mvc-reactive:bootRun

Spring WebFlux Sample

This sample uses Spring WebFlux, naturally combined with reactive Redis using Lettuce driver.

$ ./gradlew :sample-webflux:bootRun

Building from Source

The project can be built the build task:

$ ./gradlew build

samples-spring-sse-redis's People

Contributors

dependabot[bot] avatar renovate[bot] avatar vpavic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

azinmakaranth

samples-spring-sse-redis's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • gradle/wrapper-validation-action v1.1.0@56b90f209b02bf6d1deae490e9ef18b21a389cd4
  • actions/setup-java v4.0.0@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
  • gradle/gradle-build-action v2.11.0@8cbcb9948b5892387aed077daf6f90e1f0ba5b27
  • actions/upload-artifact v4.0.0@c7d193f32edcb7bfad88892161225aeda64e9392
gradle
gradle.properties
settings.gradle.kts
gradle/libs.versions.toml
  • org.springframework.boot:spring-boot-dependencies 3.2.0
  • org.springframework.boot 3.2.0
gradle/plugins/settings.gradle.kts
gradle/plugins/conventions/build.gradle.kts
gradle/plugins/conventions/src/main/kotlin/sample.java-convention.gradle.kts
sample-mvc-imperative/build.gradle.kts
sample-mvc-reactive/build.gradle.kts
sample-webflux/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.4

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.