Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
ZHHT-IRN-BD-ANALYSIS
Project
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
李凯旋
ZHHT-IRN-BD-ANALYSIS
Commits
ad30d1f1
Commit
ad30d1f1
authored
Dec 08, 2022
by
吴延飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉打印信息,配置改为测试环境版本
parent
8e5edfaf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
9 deletions
+7
-9
Constant.java
...streaming/src/main/java/com/zhht/irn/consts/Constant.java
+1
-1
DirectionEvalJob.java
...ming/src/main/java/com/zhht/irn/job/DirectionEvalJob.java
+1
-3
TravelMetricSink.java
...ing/src/main/java/com/zhht/irn/sink/TravelMetricSink.java
+0
-1
kafka.properties
...me/hologram-streaming/src/main/resources/kafka.properties
+3
-2
mysql.properties
...me/hologram-streaming/src/main/resources/mysql.properties
+2
-2
No files found.
realtime/hologram-streaming/src/main/java/com/zhht/irn/consts/Constant.java
View file @
ad30d1f1
...
@@ -16,5 +16,5 @@ public class Constant {
...
@@ -16,5 +16,5 @@ public class Constant {
// 周期计算的延迟时间 15秒
// 周期计算的延迟时间 15秒
public
static
final
int
CYCLE_CALCULATE_LATENESS
=
15
*
1000
;
public
static
final
int
CYCLE_CALCULATE_LATENESS
=
15
*
1000
;
public
static
final
int
INSERT_BATCH_SIZE
=
100
0
;
public
static
final
int
INSERT_BATCH_SIZE
=
100
;
}
}
realtime/hologram-streaming/src/main/java/com/zhht/irn/job/DirectionEvalJob.java
View file @
ad30d1f1
...
@@ -38,7 +38,6 @@ public class DirectionEvalJob {
...
@@ -38,7 +38,6 @@ public class DirectionEvalJob {
DataStream
<
Cycle
>
cycleStream
=
DataStream
<
Cycle
>
cycleStream
=
FlinkUtils
.
createKafkaStream
(
args
,
env
,
Constant
.
CYCLE_TOPIC_NAME
,
"DirectionEvalJob"
)
FlinkUtils
.
createKafkaStream
(
args
,
env
,
Constant
.
CYCLE_TOPIC_NAME
,
"DirectionEvalJob"
)
.
map
(
record
->
{
.
map
(
record
->
{
System
.
out
.
println
(
"信控周期->"
+
record
);
return
JSON
.
parseObject
(
record
,
Cycle
.
class
);
return
JSON
.
parseObject
(
record
,
Cycle
.
class
);
});
});
...
@@ -46,7 +45,6 @@ public class DirectionEvalJob {
...
@@ -46,7 +45,6 @@ public class DirectionEvalJob {
DataStream
<
TravelEvent
>
travelEventStream
=
DataStream
<
TravelEvent
>
travelEventStream
=
FlinkUtils
.
createKafkaStream
(
args
,
env
,
Constant
.
TRAVEL_EVENT_TOPIC_NAME
,
"DirectionEvalJob"
)
FlinkUtils
.
createKafkaStream
(
args
,
env
,
Constant
.
TRAVEL_EVENT_TOPIC_NAME
,
"DirectionEvalJob"
)
.
map
(
record
->
{
.
map
(
record
->
{
System
.
out
.
println
(
"旅行事件->"
+
record
);
return
JSON
.
parseObject
(
record
,
TravelEvent
.
class
);
return
JSON
.
parseObject
(
record
,
TravelEvent
.
class
);
}).
filter
(
event
->
{
}).
filter
(
event
->
{
return
StringUtils
.
isNotEmpty
(
event
.
getEventLineId
());
return
StringUtils
.
isNotEmpty
(
event
.
getEventLineId
());
...
@@ -72,7 +70,7 @@ public class DirectionEvalJob {
...
@@ -72,7 +70,7 @@ public class DirectionEvalJob {
.
intervalJoin
(
travelEventKeyedStream
)
.
intervalJoin
(
travelEventKeyedStream
)
.
between
(
Time
.
minutes
(-
9
),
Time
.
minutes
(
1
))
.
between
(
Time
.
minutes
(-
9
),
Time
.
minutes
(
1
))
.
process
(
new
CalDirectionSecondMetricFunction
())
.
process
(
new
CalDirectionSecondMetricFunction
())
.
addSink
(
new
DirectionEvalSecondSink
());
.
addSink
(
new
DirectionEvalSecondSink
())
.
setParallelism
(
4
)
;
// 旅行数据流
// 旅行数据流
env
.
execute
(
"DirectionEvalJob"
);
env
.
execute
(
"DirectionEvalJob"
);
...
...
realtime/hologram-streaming/src/main/java/com/zhht/irn/sink/TravelMetricSink.java
View file @
ad30d1f1
...
@@ -44,7 +44,6 @@ public class TravelMetricSink extends RichSinkFunction<Travel> {
...
@@ -44,7 +44,6 @@ public class TravelMetricSink extends RichSinkFunction<Travel> {
@Override
@Override
public
void
invoke
(
Travel
travel
,
Context
context
)
throws
Exception
{
public
void
invoke
(
Travel
travel
,
Context
context
)
throws
Exception
{
System
.
out
.
println
(
"=====insert travel ======"
+
travel
);
insertPstmt
.
setString
(
1
,
travel
.
getRecordId
());
insertPstmt
.
setString
(
1
,
travel
.
getRecordId
());
insertPstmt
.
setString
(
2
,
travel
.
getCrossId
());
insertPstmt
.
setString
(
2
,
travel
.
getCrossId
());
insertPstmt
.
setDate
(
3
,
new
Date
(
Long
.
parseLong
(
travel
.
getRecordTime
())));
insertPstmt
.
setDate
(
3
,
new
Date
(
Long
.
parseLong
(
travel
.
getRecordTime
())));
...
...
realtime/hologram-streaming/src/main/resources/kafka.properties
View file @
ad30d1f1
bootstrap.servers
=
139.9.157.176:9092
bootstrap.servers
=
139.9.157.176:9092
kafka.input.topics
=
trips_info
kafka.input.topics
=
trips_info
auto.offset.reset
=
latest
auto.offset.reset
=
latest
group.id
=
wuyanfei
group.id
=
TravelInfoJob
checkpoint.path
=
file:///data/flink/state
checkpoint.path
=
file:///data/flink/state
checkpoint.interval
=
5
000
checkpoint.interval
=
60
000
enable.auto.commit
=
false
enable.auto.commit
=
false
\ No newline at end of file
realtime/hologram-streaming/src/main/resources/mysql.properties
View file @
ad30d1f1
driver
=
com.mysql.jdbc.Driver
driver
=
com.mysql.jdbc.Driver
host
=
1
27.0.0.1
host
=
1
0.243.0.26
port
=
13305
port
=
3306
username
=
root
username
=
root
password
=
mima
password
=
mima
database
=
test
database
=
test
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