use of com.tvd12.ezymq.kafka.EzyKafkaProxy in project ezyfox-server-example by tvd12.
the class KafkaConfig method config.
@Override
public void config() {
EzyKafkaProxy kafkaProxy = EzyKafkaProxy.builder().scan("org.youngmonkeys.example.push_message.gateway.api.kafka").ignoreUnknownComponents(true).build();
singletonFactory.addSingleton("messageProducer", kafkaProxy.getProducer("message"));
}
use of com.tvd12.ezymq.kafka.EzyKafkaProxy in project ezyfox-server-example by tvd12.
the class KafkaConfig method config.
@Override
public void config() {
EzyKafkaProxy kafkaProxy = EzyKafkaProxy.builder().scan("org.youngmonkeys.example.push_message.kafka").ignoreUnknownComponents(true).addSingleton(responseFactory).build();
EzyKafkaConsumer consumer = kafkaProxy.getConsumer("message");
EzyProcessor.processWithException(consumer::start);
}
use of com.tvd12.ezymq.kafka.EzyKafkaProxy in project ezyfox-examples by tvd12.
the class KafkaConsumer method main.
public static void main(String[] args) throws Exception {
EzyKafkaProxy kafkaProxy = EzyKafkaProxy.builder().scan("com.tvd12.ezymq.example.kafka").build();
EzyKafkaConsumer consumer = kafkaProxy.getConsumer("hello-world");
consumer.start();
while (true) {
Thread.sleep(1000);
}
}
use of com.tvd12.ezymq.kafka.EzyKafkaProxy 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);
}
Aggregations