public void start() { proxyClient.start(); }
@Autowired public ProxyServerEventHandler(Gson gson, WebSocketKafkaProxyConfig proxyConfig, HandlersMapper requestHandlersMapper) { this.gson = gson; this.requestHandlersMapper = requestHandlersMapper; WebSocketKafkaProxyClient webSocketKafkaProxyClient = new WebSocketKafkaProxyClient((message, client) -> {}); webSocketKafkaProxyClient.setWebSocketKafkaProxyConfig(proxyConfig); this.proxyClient = webSocketKafkaProxyClient; this.proxyClient.start(); }
@Autowired public ProxyMessageDispatcher(Gson gson, WebSocketKafkaProxyConfig proxyConfig) { this.gson = gson; WebSocketKafkaProxyClient webSocketKafkaProxyClient = new WebSocketKafkaProxyClient((message, client) -> {}); webSocketKafkaProxyClient.setWebSocketKafkaProxyConfig(proxyConfig); this.proxyClient = webSocketKafkaProxyClient; this.proxyClient.start(); }
@Override public void start() { client.start(); createTopic(Arrays.asList(requestTopic, replyToTopic)); subscribeToTopic(replyToTopic); pingServer(); }
@Override public void start() { client.start(); createTopic(Arrays.asList(requestTopic, replyToTopic)); subscribeToTopic(replyToTopic); pingServer(); }
public static void main(String[] args) { ProxyClient client = new WebSocketKafkaProxyClient((message, proxyClient) -> System.out.println("Received message: " + message)); client.start(); CompletableFuture<ProxyMessage> healthFuture = client.push(ProxyMessageBuilder.health()); System.out.println("Topic health: " + healthFuture.join()); CompletableFuture<ProxyMessage> subscribeFuture = client.push(ProxyMessageBuilder.subscribe(new SubscribePayload("kafka-ws-topic"))); System.out.println("Topic subscribe: " + subscribeFuture.join()); try { Thread.sleep(20000); } catch (InterruptedException e) { e.printStackTrace(); } finally { client.shutdown(); } } }