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
88805488
Commit
88805488
authored
Jul 11, 2025
by
liaowenwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改kafka连接
parent
b366e456
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
MysqlDataSlideSink.java
...ava/com/dsk/flink/dsc/common/sink/MysqlDataSlideSink.java
+17
-3
No files found.
src/main/java/com/dsk/flink/dsc/common/sink/MysqlDataSlideSink.java
View file @
88805488
...
...
@@ -30,6 +30,7 @@ public class MysqlDataSlideSink extends RichSinkFunction<Tuple6<String,String,St
private
transient
DruidDataSource
dataSource
;
private
static
final
int
MAX_RETRIES
=
3
;
// 最大重试次数
private
static
final
int
RETRY_DELAY_MS
=
100
;
// 重试间隔时间
private
static
final
int
QUEUE_CAPACITY
=
1000
;
private
static
final
String
SQL
=
"INSERT INTO dsc_cdc_log (`table`,op_type,pk_columns,pk_values,data_json,cdc_ts) values (?,?,?,?,?,?)"
;
public
MysqlDataSlideSink
(
EnvProperties
envProps
)
{
...
...
@@ -38,7 +39,10 @@ public class MysqlDataSlideSink extends RichSinkFunction<Tuple6<String,String,St
@Override
public
void
open
(
Configuration
parameters
)
throws
Exception
{
executorService
=
new
ThreadPoolExecutor
(
5
,
5
,
20
,
TimeUnit
.
MINUTES
,
new
LinkedBlockingDeque
<>());
executorService
=
new
ThreadPoolExecutor
(
8
,
20
,
60
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingDeque
<>(
QUEUE_CAPACITY
),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
//初始化获取配置
String
configTidbUrl
=
String
.
format
(
envProps
.
getDb_url
(),
envProps
.
getDb_host
(),
envProps
.
getDb_port
(),
envProps
.
getDb_database
());
//System.out.println(configTidbUrl);
...
...
@@ -56,8 +60,18 @@ public class MysqlDataSlideSink extends RichSinkFunction<Tuple6<String,String,St
@Override
public
void
close
()
throws
Exception
{
executorService
.
shutdown
();
dataSource
.
close
();
try
{
if
(
executorService
!=
null
)
{
executorService
.
shutdown
();
if
(!
executorService
.
awaitTermination
(
30
,
TimeUnit
.
SECONDS
))
{
executorService
.
shutdownNow
();
}
}
}
finally
{
if
(
dataSource
!=
null
)
{
dataSource
.
close
();
}
}
}
@Override
...
...
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