@Test public void publish() { ClientIdentifications clients = () -> Arrays.asList(new ClientStreamIdentification("context", "A"), new ClientStreamIdentification("context", "B")) .iterator(); Map<String, PlatformOutboundInstruction> receivedHeartbeat = new ConcurrentHashMap<>(); PlatformOutboundInstruction instruction = newBuilder().setHeartbeat(Heartbeat.newBuilder().build()).build(); HeartbeatPublisher testSubject = new HeartbeatPublisher(clients, receivedHeartbeat::put); testSubject.publish(instruction); assertEquals(2, receivedHeartbeat.size()); assertTrue(receivedHeartbeat.containsKey("A")); assertTrue(receivedHeartbeat.containsKey("B")); assertFalse(receivedHeartbeat.containsKey("C")); assertEquals(instruction, receivedHeartbeat.get("A")); assertEquals(instruction, receivedHeartbeat.get("B")); }
public void publish(PlatformOutboundInstruction heartbeat) { for (ClientStreamIdentification client : clientsSupportingHeartbeat) { try { clientPublisher.publish(client.getClientStreamId(), heartbeat); } catch (RuntimeException ignore) { } } }
HeartbeatPublisher implements Publisher<PlatformOutboundInstruction> { public void publish(PlatformOutboundInstruction heartbeat) { for (ClientStreamIdentification client : clientsSupportingHeartbeat) { try { clientPublisher.publish(client.getClientStreamId(), heartbeat); } catch (RuntimeException ignore) { } } } }
HeartbeatPublisher implements Publisher<PlatformOutboundInstruction> { public void publish(PlatformOutboundInstruction heartbeat) { for (ClientStreamIdentification client : clientsSupportingHeartbeat) { try { clientPublisher.publish(client.getClientStreamId(), heartbeat); } catch (RuntimeException ignore) { } } } @Autowired  HeartbeatPublisher(HeartbeatProvidedClients clients,
                              PlatformService platformService);  HeartbeatPublisher(ClientIdentifications clientsSupportingHeartbeat,
                              ClientPublisher clientPublisher); }
HeartbeatPublisher implements Publisher<PlatformOutboundInstruction> { public void publish(PlatformOutboundInstruction heartbeat) { for (ClientStreamIdentification client : clientsSupportingHeartbeat) { try { clientPublisher.publish(client.getClientStreamId(), heartbeat); } catch (RuntimeException ignore) { } } } @Autowired  HeartbeatPublisher(HeartbeatProvidedClients clients,
                              PlatformService platformService);  HeartbeatPublisher(ClientIdentifications clientsSupportingHeartbeat,
                              ClientPublisher clientPublisher); void publish(PlatformOutboundInstruction heartbeat); }
HeartbeatPublisher implements Publisher<PlatformOutboundInstruction> { public void publish(PlatformOutboundInstruction heartbeat) { for (ClientStreamIdentification client : clientsSupportingHeartbeat) { try { clientPublisher.publish(client.getClientStreamId(), heartbeat); } catch (RuntimeException ignore) { } } } @Autowired  HeartbeatPublisher(HeartbeatProvidedClients clients,
                              PlatformService platformService);  HeartbeatPublisher(ClientIdentifications clientsSupportingHeartbeat,
                              ClientPublisher clientPublisher); void publish(PlatformOutboundInstruction heartbeat);  }