@Test public void gossip_newMessage() { final Bytes message = Bytes.fromHexString("0x01"); gossipHandler.gossip(message); verify(publisher).publish(toByteBuf(message), topic); }
public void gossip(Bytes bytes) { if (!processedMessages.add(bytes)) { return; } LOG.trace("Gossiping {}: {} bytes", topic, bytes.size()); SafeFuture.of(publisher.publish(Unpooled.wrappedBuffer(bytes.toArrayUnsafe()), topic)) .finish( () -> LOG.trace("Successfully gossiped message on {}", topic), err -> LOG.debug("Failed to gossip message on " + topic, err)); }
GossipHandler implements Function<MessageApi, CompletableFuture<ValidationResult>> { public void gossip(Bytes bytes) { if (!processedMessages.add(bytes)) { return; } LOG.trace("Gossiping {}: {} bytes", topic, bytes.size()); SafeFuture.of(publisher.publish(Unpooled.wrappedBuffer(bytes.toArrayUnsafe()), topic)) .finish( () -> LOG.trace("Successfully gossiped message on {}", topic), err -> LOG.debug("Failed to gossip message on " + topic, err)); } }
GossipHandler implements Function<MessageApi, CompletableFuture<ValidationResult>> { public void gossip(Bytes bytes) { if (!processedMessages.add(bytes)) { return; } LOG.trace("Gossiping {}: {} bytes", topic, bytes.size()); SafeFuture.of(publisher.publish(Unpooled.wrappedBuffer(bytes.toArrayUnsafe()), topic)) .finish( () -> LOG.trace("Successfully gossiped message on {}", topic), err -> LOG.debug("Failed to gossip message on " + topic, err)); } GossipHandler(
      final Topic topic, final PubsubPublisherApi publisher, final TopicHandler handler); }
GossipHandler implements Function<MessageApi, CompletableFuture<ValidationResult>> { public void gossip(Bytes bytes) { if (!processedMessages.add(bytes)) { return; } LOG.trace("Gossiping {}: {} bytes", topic, bytes.size()); SafeFuture.of(publisher.publish(Unpooled.wrappedBuffer(bytes.toArrayUnsafe()), topic)) .finish( () -> LOG.trace("Successfully gossiped message on {}", topic), err -> LOG.debug("Failed to gossip message on " + topic, err)); } GossipHandler(
      final Topic topic, final PubsubPublisherApi publisher, final TopicHandler handler); @Override SafeFuture<ValidationResult> apply(final MessageApi message); void gossip(Bytes bytes); }
GossipHandler implements Function<MessageApi, CompletableFuture<ValidationResult>> { public void gossip(Bytes bytes) { if (!processedMessages.add(bytes)) { return; } LOG.trace("Gossiping {}: {} bytes", topic, bytes.size()); SafeFuture.of(publisher.publish(Unpooled.wrappedBuffer(bytes.toArrayUnsafe()), topic)) .finish( () -> LOG.trace("Successfully gossiped message on {}", topic), err -> LOG.debug("Failed to gossip message on " + topic, err)); } GossipHandler(
      final Topic topic, final PubsubPublisherApi publisher, final TopicHandler handler); @Override SafeFuture<ValidationResult> apply(final MessageApi message); void gossip(Bytes bytes);  }