Subscription CLI updates
This commit is contained in:
parent
5edd290013
commit
06bdce8bbc
|
@ -8,6 +8,7 @@ import org.apache.commons.cli.CommandLine;
|
||||||
import org.apache.commons.cli.Options;
|
import org.apache.commons.cli.Options;
|
||||||
import org.apache.commons.cli.ParseException;
|
import org.apache.commons.cli.ParseException;
|
||||||
import org.eclipse.jetty.websocket.api.Session;
|
import org.eclipse.jetty.websocket.api.Session;
|
||||||
|
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
|
||||||
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
|
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
|
||||||
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError;
|
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError;
|
||||||
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame;
|
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame;
|
||||||
|
@ -100,8 +101,12 @@ public class WebsocketSubscribeCommand extends BaseCommand {
|
||||||
|
|
||||||
@OnWebSocketFrame
|
@OnWebSocketFrame
|
||||||
public void onFrame(Frame theFrame) {
|
public void onFrame(Frame theFrame) {
|
||||||
ourLog.info("Websocket frame: {}", theFrame);
|
ourLog.debug("Websocket frame: {}", theFrame);
|
||||||
myQuit = true;
|
}
|
||||||
|
|
||||||
|
@OnWebSocketClose
|
||||||
|
public void onClose(int statusCode, String reason) {
|
||||||
|
ourLog.info("Received CLOSE status={} reason={}", statusCode, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnWebSocketConnect
|
@OnWebSocketConnect
|
||||||
|
|
|
@ -218,7 +218,9 @@ public class SubscriptionWebsocketHandler extends TextWebSocketHandler implement
|
||||||
|
|
||||||
if (!id.hasIdPart() || !id.isIdPartValid()) {
|
if (!id.hasIdPart() || !id.isIdPartValid()) {
|
||||||
try {
|
try {
|
||||||
theSession.close(new CloseStatus(CloseStatus.PROTOCOL_ERROR.getCode(), "Invalid bind request - No ID included"));
|
String message = "Invalid bind request - No ID included";
|
||||||
|
ourLog.warn(message);
|
||||||
|
theSession.close(new CloseStatus(CloseStatus.PROTOCOL_ERROR.getCode(), message));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
handleFailure(e);
|
handleFailure(e);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +238,9 @@ public class SubscriptionWebsocketHandler extends TextWebSocketHandler implement
|
||||||
myState = new BoundStaticSubscipriptionState(theSession);
|
myState = new BoundStaticSubscipriptionState(theSession);
|
||||||
} catch (ResourceNotFoundException e) {
|
} catch (ResourceNotFoundException e) {
|
||||||
try {
|
try {
|
||||||
theSession.close(new CloseStatus(CloseStatus.PROTOCOL_ERROR.getCode(), "Invalid bind request - Unknown subscription: " + id.getValue()));
|
String message = "Invalid bind request - Unknown subscription: " + id.getValue();
|
||||||
|
ourLog.warn(message);
|
||||||
|
theSession.close(new CloseStatus(CloseStatus.PROTOCOL_ERROR.getCode(), message));
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
handleFailure(e);
|
handleFailure(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue