From 63926d58f89e99570bda182602819ed4828a3497 Mon Sep 17 00:00:00 2001 From: duanledexianxianxian Date: Tue, 22 Oct 2019 17:28:27 +0800 Subject: [PATCH] dataStream api --- .../demo/kafka/listener/AppListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kafka/src/main/java/com/duanledexianxianxian/demo/kafka/listener/AppListener.java b/kafka/src/main/java/com/duanledexianxianxian/demo/kafka/listener/AppListener.java index f92353d..fee2774 100644 --- a/kafka/src/main/java/com/duanledexianxianxian/demo/kafka/listener/AppListener.java +++ b/kafka/src/main/java/com/duanledexianxianxian/demo/kafka/listener/AppListener.java @@ -46,7 +46,7 @@ public class AppListener implements ApplicationListener { }); try { - Thread.sleep(5000); + Thread.sleep(new Random().nextInt(6) * 1000); } catch (InterruptedException e) { e.printStackTrace(); } @@ -56,8 +56,8 @@ public class AppListener implements ApplicationListener { private void sendData(int i) { Student student = new Student(); - student.setStudentId("duanledexianxianxian" + i); - student.setName(RandomStringUtils.randomAlphabetic(10)); + student.setStudentId(String.valueOf(i)); + student.setName("duanledexianxianxian" + new Random().nextInt(20)); student.setAge(new Random().nextInt(19) + 6); student.setSex(Byte.valueOf(String.valueOf((new Random().nextInt(2))))); log.info("Thread:{} Send Data:{}", Thread.currentThread().getName(), student); -- GitLab