private void translate(String body) throws MissingValueException { AuctionEvent event = AuctionEvent.from(body); String type = event.type(); if ("CLOSE".equals(type)) { listener.auctionClosed(); } else if ("PRICE".equals(type)) { listener.currentPrice(event.currentPrice(), event.increment(), event.isFrom(sniperId)); } }
@Override public void processMessage(Chat chat, Message message) { try { translate(message.getBody()); } catch (Exception parseException) { listener.auctionFailed(); } }