Skip to content

Commit

Permalink
Receiver respects keepalives.
Browse files Browse the repository at this point in the history
 + minor enhancements.
  • Loading branch information
Wiktor Gromniak committed Aug 11, 2016
1 parent d89adba commit 9736907
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 396 deletions.
7 changes: 7 additions & 0 deletions src/main/java/net/quedex/api/common/MessageReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public abstract class MessageReceiver {

public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
private static final String KEEPALIVE_STR = "keepalive";

private final Logger logger;

Expand All @@ -27,6 +28,12 @@ protected MessageReceiver(Logger logger) {
protected abstract void processData(String data) throws IOException, PGPExceptionBase;

public final void processMessage(String message) {

if (KEEPALIVE_STR.equals(message)) {
logger.trace(KEEPALIVE_STR);
return;
}

try {
JsonNode metaJson = OBJECT_MAPPER.readTree(message);

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/net/quedex/api/market/Quotes.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ public int getInstrumentId() {
return instrumentId;
}

public PriceQuantity getLast() {
return new PriceQuantity(last, lastQuantity);
public BigDecimal getLast() {
return last;
}

public int getLastQuantity() {
return lastQuantity;
}

public Optional<PriceQuantity> getBid() {
Expand Down

This file was deleted.

148 changes: 0 additions & 148 deletions src/main/java/net/quedex/client/commons/Config.java

This file was deleted.

This file was deleted.

69 changes: 0 additions & 69 deletions src/main/java/net/quedex/client/commons/MessageReceiver.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9736907

Please sign in to comment.