Clojure Server Sent Events with Pedestal and Redis. Microservice for notifications push.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
src/it_service_sse
test/it_service_sse
.gitignore
.gitlab-ci.yml
.gitlab-ci.yml.docker
Capstanfile
Dockerfile
README.md
boot.properties
build.boot
project.clj

README.md

it-service-sse

This microservice is a part of the IT-Premium IT service management system to deliver ticket processing and other notifications for the javascript frontend via Server Sent Events technology. User connects with his own ID and listens only for those messages, which are only for his eyes. Service also counts number of concurrent user connections.

Configuration

This microservice uses 9292 port by default. Via docker and jwilder/nginx-proxy it exposes itself via HTTPS and proper domain name.

Logging

To configure logging see config/logback.xml. By default, the app logs to stdout and logs/. To learn more about configuring Logback, read its documentation.

Build

Docker container support

  1. Build an uberjar of your service: lein uberjar
  2. Build a Docker image: sudo docker build -t it-service-sse .
  3. Run your Docker image: docker run -p 9292:9292 -e REDIS_HOST=redis --link itservice_redis_1 it-service-sse

What's interesting here?

  • it uses Carmine library to connect to Redis
  • it uses Pedestal library to serve SSE connections
  • it uses Environ library to get redis settings from Docker (and not only Docker) environment
  • it uses core.async to listen Redis message and deliver to SSE channels
  • JSON CORS is also configured here