Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-screen
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
byit-screen
Commits
77836bcf
Commit
77836bcf
authored
Jul 12, 2019
by
lichaomin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试类格式
parent
91204328
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
TestProducer.java
...-screen-computer/src/test/java/com/byit/TestProducer.java
+3
-2
No files found.
byit-screen-computer/src/test/java/com/byit/TestProducer.java
View file @
77836bcf
...
...
@@ -17,11 +17,12 @@ public class TestProducer {
props
.
put
(
"value.serializer"
,
"org.apache.kafka.common.serialization.StringSerializer"
);
KafkaProducer
producer
=
new
KafkaProducer
<
String
,
String
>(
props
);
for
(
int
i
=
1
;
i
<=
20
;
i
++)
{
String
student
=
"{
l_"
+
(
i
%
10
)
+
"
: "
+
i
+
"}"
;
for
(
int
i
=
1
;
i
<=
20
0
;
i
++)
{
String
student
=
"{
name:l_"
+
(
i
%
10
)
+
",sale
: "
+
i
+
"}"
;
ProducerRecord
record
=
new
ProducerRecord
<
String
,
String
>(
topic
,
null
,
null
,
student
);
producer
.
send
(
record
);
System
.
out
.
println
(
"发送数据: "
+
student
);
Thread
.
sleep
(
1000
);
}
producer
.
flush
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment