Search in sources :

Example 1 with EzyKafkaProducer

use of com.tvd12.ezymq.kafka.EzyKafkaProducer in project ezyfox-examples by tvd12.

the class KafkaProducer method main.

public static void main(String[] args) {
    EzyKafkaProxy kafkaProxy = EzyKafkaProxy.builder().build();
    EzyKafkaProducer producer = kafkaProxy.getProducer("hello-world");
    ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
    executorService.scheduleAtFixedRate(() -> {
        producer.send("hello", "Hello World");
    }, 1, 3, TimeUnit.SECONDS);
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) EzyKafkaProxy(com.tvd12.ezymq.kafka.EzyKafkaProxy) EzyKafkaProducer(com.tvd12.ezymq.kafka.EzyKafkaProducer)

Aggregations

EzyKafkaProducer (com.tvd12.ezymq.kafka.EzyKafkaProducer)1 EzyKafkaProxy (com.tvd12.ezymq.kafka.EzyKafkaProxy)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1