first working version with event reception in kanban
This commit is contained in:
@@ -4,6 +4,7 @@ package de.srsoftware.umbrella.messagebus;
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
import static java.lang.Thread.sleep;
|
||||
import static java.net.HttpURLConnection.HTTP_OK;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
@@ -13,7 +14,6 @@ import de.srsoftware.tools.SessionToken;
|
||||
import de.srsoftware.umbrella.core.BaseHandler;
|
||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||
import de.srsoftware.umbrella.core.model.Token;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -42,14 +42,16 @@ public class MessageApi extends BaseHandler{
|
||||
LOG.log(INFO,"{0} opened event stream.",addr);
|
||||
var counter = 0;
|
||||
while (!stream.checkError()){
|
||||
Thread.sleep(100);
|
||||
sleep(100);
|
||||
if (eventQueue.isEmpty()){
|
||||
if (++counter > 300) counter = sendBeacon(addr,stream);
|
||||
} else {
|
||||
var elem = eventQueue.remove(0);
|
||||
LOG.log(DEBUG,"sending event to {0}",addr);
|
||||
sendEvent(stream,elem);
|
||||
counter = 0;
|
||||
var event = eventQueue.removeFirst();
|
||||
//if (event.isIntendedFor(user.get())) {
|
||||
LOG.log(DEBUG, "sending event to {0}", addr);
|
||||
sendEvent(stream, event);
|
||||
counter = 0;
|
||||
//}
|
||||
}
|
||||
}
|
||||
LOG.log(INFO,"{0} disconnected from event stream.",addr);
|
||||
|
||||
Reference in New Issue
Block a user