0
respostas

records.count() sempre retorna 1

Esse retorno está correto? Crio mensagens e sempre o FraudDetectorService entra 1 registro.

\código while(true) { var records = consumer.poll(Duration.ofMillis(100)); if(!records.isEmpty()) { System.out.println("encontrei " + records.count() + " registros"); for(var record : records) { System.out.println("-----------------------------------------"); System.out.println("Processing new order, cheking for fraud"); System.out.println(record.key()); System.out.println(record.value()); System.out.println(record.offset()); System.out.println(record.partition());

                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                System.out.println("Order processed");
            }
        }
    }

\saida

encontrei 1 registros

Processing new order, cheking for fraud 123, 67231, 15984 123, 67231, 15984 2 0 Order processed

encontrei 1 registros

Processing new order, cheking for fraud 123, 67231, 15984 123, 67231, 15984 3 0 Order processed

encontrei 1 registros

Processing new order, cheking for fraud 123, 67231, 15984 123, 67231, 15984 4 0 Order processed

encontrei 1 registros

Processing new order, cheking for fraud 123, 67231, 1234 123, 67231, 1234 5 0 Order processed