Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-dsc-flink
Project
Project
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
shezaixing
dsk-dsc-flink
Commits
006d98f6
Commit
006d98f6
authored
Feb 11, 2025
by
liaowenwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加日志
parent
28890f5a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
MysqlDataTransferFunction.java
.../flink/dsc/common/function/MysqlDataTransferFunction.java
+1
-1
SyncCustomerDataSource.java
...n/java/com/dsk/flink/dsc/sync/SyncCustomerDataSource.java
+5
-5
No files found.
src/main/java/com/dsk/flink/dsc/common/function/MysqlDataTransferFunction.java
View file @
006d98f6
...
@@ -109,7 +109,7 @@ public class MysqlDataTransferFunction extends ProcessFunction<JSONObject, Tuple
...
@@ -109,7 +109,7 @@ public class MysqlDataTransferFunction extends ProcessFunction<JSONObject, Tuple
pkColumns
.
setLength
(
pkColumns
.
length
()-
1
);
pkColumns
.
setLength
(
pkColumns
.
length
()-
1
);
pkValues
.
setLength
(
pkValues
.
length
()-
1
);
pkValues
.
setLength
(
pkValues
.
length
()-
1
);
}
}
return
Tuple6
.
of
(
table
,
type
,
pkColumns
.
toString
(),
pkValues
.
toString
(),
dataJsonStr
.
replace
(
"\\"
,
"\\\\"
).
replace
(
"'"
,
"\\'"
),
ts
);
return
Tuple6
.
of
(
table
,
type
,
pkColumns
.
toString
(),
pkValues
.
toString
()
.
replace
(
"'"
,
""
)
,
dataJsonStr
.
replace
(
"\\"
,
"\\\\"
).
replace
(
"'"
,
"\\'"
),
ts
);
}
}
private
static
String
tranferInsertSql
(
String
table
,
JSONObject
dataObj
,
JSONObject
mysqlType
)
{
private
static
String
tranferInsertSql
(
String
table
,
JSONObject
dataObj
,
JSONObject
mysqlType
)
{
...
...
src/main/java/com/dsk/flink/dsc/sync/SyncCustomerDataSource.java
View file @
006d98f6
...
@@ -46,7 +46,7 @@ public class SyncCustomerDataSource {
...
@@ -46,7 +46,7 @@ public class SyncCustomerDataSource {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
StreamExecutionEnvironment
env
=
StreamExecutionEnvironment
.
getExecutionEnvironment
();
StreamExecutionEnvironment
env
=
StreamExecutionEnvironment
.
getExecutionEnvironment
();
//
env.setParallelism(1);
env
.
setParallelism
(
1
);
env
.
setRestartStrategy
(
RestartStrategies
.
fixedDelayRestart
(
100
,
60000
));
env
.
setRestartStrategy
(
RestartStrategies
.
fixedDelayRestart
(
100
,
60000
));
env
.
enableCheckpointing
(
120000
);
env
.
enableCheckpointing
(
120000
);
env
.
getCheckpointConfig
().
setCheckpointingMode
(
CheckpointingMode
.
EXACTLY_ONCE
);
env
.
getCheckpointConfig
().
setCheckpointingMode
(
CheckpointingMode
.
EXACTLY_ONCE
);
...
@@ -91,7 +91,7 @@ public class SyncCustomerDataSource {
...
@@ -91,7 +91,7 @@ public class SyncCustomerDataSource {
.
name
(
"dsc-source"
)
.
name
(
"dsc-source"
)
.
uid
(
"dsc-source"
);
.
uid
(
"dsc-source"
);
//
tsGroupStream.print("source==>");
tsGroupStream
.
print
(
"source==>"
);
OutputTag
<
Tuple6
<
String
,
String
,
String
,
String
,
String
,
Long
>>
logSlideTag
=
new
OutputTag
<
Tuple6
<
String
,
String
,
String
,
String
,
String
,
Long
>>(
"log_slide"
)
{};
OutputTag
<
Tuple6
<
String
,
String
,
String
,
String
,
String
,
Long
>>
logSlideTag
=
new
OutputTag
<
Tuple6
<
String
,
String
,
String
,
String
,
String
,
Long
>>(
"log_slide"
)
{};
SingleOutputStreamOperator
<
Tuple3
<
String
,
String
,
Long
>>
slide
=
tsGroupStream
SingleOutputStreamOperator
<
Tuple3
<
String
,
String
,
Long
>>
slide
=
tsGroupStream
...
@@ -99,7 +99,7 @@ public class SyncCustomerDataSource {
...
@@ -99,7 +99,7 @@ public class SyncCustomerDataSource {
.
name
(
"dsc-sql"
)
.
name
(
"dsc-sql"
)
.
uid
(
"dsc-sql"
);
.
uid
(
"dsc-sql"
);
//
slide.print("dsc-sql ==>");
slide
.
print
(
"dsc-sql ==>"
);
SingleOutputStreamOperator
<
String
>
groupWindowSqlResultStream
=
slide
SingleOutputStreamOperator
<
String
>
groupWindowSqlResultStream
=
slide
.
keyBy
(
value
->
value
.
f1
)
.
keyBy
(
value
->
value
.
f1
)
...
@@ -123,13 +123,13 @@ public class SyncCustomerDataSource {
...
@@ -123,13 +123,13 @@ public class SyncCustomerDataSource {
.
name
(
"dsc-max"
)
.
name
(
"dsc-max"
)
.
uid
(
"dsc-max"
);
.
uid
(
"dsc-max"
);
//
groupWindowSqlResultStream.print("dsc-max==>");
groupWindowSqlResultStream
.
print
(
"dsc-max==>"
);
groupWindowSqlResultStream
.
addSink
(
new
MysqlDataTransferSinkBatch
(
envProps
))
groupWindowSqlResultStream
.
addSink
(
new
MysqlDataTransferSinkBatch
(
envProps
))
.
name
(
"dsc-sink"
)
.
name
(
"dsc-sink"
)
.
uid
(
"dsc-sink"
);
.
uid
(
"dsc-sink"
);
DataStream
<
Tuple6
<
String
,
String
,
String
,
String
,
String
,
Long
>>
sideOutput
=
slide
.
getSideOutput
(
logSlideTag
);
DataStream
<
Tuple6
<
String
,
String
,
String
,
String
,
String
,
Long
>>
sideOutput
=
slide
.
getSideOutput
(
logSlideTag
);
sideOutput
.
print
(
"log==>"
);
sideOutput
.
addSink
(
JdbcSink
.
sink
(
sideOutput
.
addSink
(
JdbcSink
.
sink
(
"INSERT INTO dsc_cdc_log (`table`,op_type,pk_columns,pk_values,data_json,cdc_ts) values (?,?,?,?,?,?)"
,
"INSERT INTO dsc_cdc_log (`table`,op_type,pk_columns,pk_values,data_json,cdc_ts) values (?,?,?,?,?,?)"
,
(
ps
,
t
)
->
{
(
ps
,
t
)
->
{
...
...
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