Search in sources :

Example 1 with SseEmitter

use of org.springframework.web.servlet.mvc.method.annotation.SseEmitter in project spring-boot-admin by codecentric.

the class JournalController method getJournalEvents.

@RequestMapping(produces = "text/event-stream")
public SseEmitter getJournalEvents() {
    final SseEmitter emitter = new SseEmitter();
    emitter.onCompletion(new Runnable() {

        @Override
        public void run() {
            emitters.remove(emitter);
        }
    });
    emitters.add(emitter);
    return emitter;
}
Also used : SseEmitter(org.springframework.web.servlet.mvc.method.annotation.SseEmitter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 SseEmitter (org.springframework.web.servlet.mvc.method.annotation.SseEmitter)1