Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit f9cab8a

Browse files
committed
Make delta default for messsages without FORMAT header #32
1 parent bca4952 commit f9cab8a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/nz/co/fortytwo/signalk/processor/FullToDeltaProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
import org.apache.camel.Exchange;
3434
import org.apache.camel.Processor;
35+
import org.apache.commons.lang3.StringUtils;
3536
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;
3637

3738
/**
@@ -52,7 +53,8 @@ public void process(Exchange exchange) throws Exception {
5253
if (exchange.getIn().getBody() == null) return;
5354
if(logger.isDebugEnabled())logger.debug("Processing :" + exchange.getIn().getBody().toString());
5455
if(!(exchange.getIn().getBody() instanceof Json))return;
55-
if (FORMAT_DELTA.equals(exchange.getIn().getHeader(SIGNALK_FORMAT))) {
56+
String format = exchange.getIn().getHeader(SIGNALK_FORMAT, String.class);
57+
if (StringUtils.isBlank(format) || FORMAT_DELTA.equals(format)) {
5658
List<Json> json = fullToDelta.handle(exchange.getIn().getBody(Json.class));
5759
//if(logger.isDebugEnabled())logger.debug("Converted to delta :" + json);
5860
exchange.getIn().setBody(json);

src/main/java/nz/co/fortytwo/signalk/server/SignalkRouteFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public static void configureWebsocketRxRoute(RouteBuilder routeBuilder ,String i
190190
.end()
191191
.process(new WsSessionProcessor()).id(getName(WsSessionProcessor.class.getSimpleName()))
192192
//.to("log:nz.co.fortytwo.signalk.model.websocket.rx?level=INFO&showException=true&showStackTrace=true")
193-
.to(input).id(getName("SEDA_INPUT"));
193+
.to(input).id(getName(RouteManager.SEDA_INPUT));
194194

195195
}
196196
public static void configureTcpServerRoute(RouteBuilder routeBuilder ,String input, NettyServer nettyServer, String outputType) throws Exception{

0 commit comments

Comments
 (0)