Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
f6d81b81
Commit
f6d81b81
authored
Mar 19, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client format
parent
2a471036
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
483 additions
and
398 deletions
+483
-398
FlinkCDCMergeBuilder.java
....11/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
+8
-8
CustomTableResultImpl.java
...c/main/java/com/dlink/executor/CustomTableResultImpl.java
+25
-12
TableSchemaField.java
...11/src/main/java/com/dlink/executor/TableSchemaField.java
+2
-2
FlinkUtil.java
...-client-1.11/src/main/java/com/dlink/utils/FlinkUtil.java
+3
-3
ExtractionUtils.java
.../apache/flink/table/types/extraction/ExtractionUtils.java
+74
-54
FlinkCDCMergeBuilder.java
....12/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
+8
-8
CustomTableResultImpl.java
...c/main/java/com/dlink/executor/CustomTableResultImpl.java
+30
-24
TableSchemaField.java
...12/src/main/java/com/dlink/executor/TableSchemaField.java
+2
-2
FlinkUtil.java
...-client-1.12/src/main/java/com/dlink/utils/FlinkUtil.java
+3
-3
ExtractionUtils.java
.../apache/flink/table/types/extraction/ExtractionUtils.java
+74
-54
FlinkCDCMergeBuilder.java
....13/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
+8
-8
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+2
-2
CustomTableResultImpl.java
...c/main/java/com/dlink/executor/CustomTableResultImpl.java
+33
-25
TableSchemaField.java
...13/src/main/java/com/dlink/executor/TableSchemaField.java
+2
-2
FlinkUtil.java
...-client-1.13/src/main/java/com/dlink/utils/FlinkUtil.java
+6
-4
ExtractionUtils.java
.../apache/flink/table/types/extraction/ExtractionUtils.java
+74
-54
FlinkCDCMergeBuilder.java
....14/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
+8
-8
CustomTableEnvironmentImpl.java
...n/java/com/dlink/executor/CustomTableEnvironmentImpl.java
+2
-2
CustomTableResultImpl.java
...c/main/java/com/dlink/executor/CustomTableResultImpl.java
+33
-25
TableSchemaField.java
...14/src/main/java/com/dlink/executor/TableSchemaField.java
+2
-2
FlinkUtil.java
...-client-1.14/src/main/java/com/dlink/utils/FlinkUtil.java
+3
-3
ExtractionUtils.java
.../apache/flink/table/types/extraction/ExtractionUtils.java
+74
-54
FlinkBaseUtil.java
...ent-base/src/main/java/com/dlink/utils/FlinkBaseUtil.java
+7
-7
dubbo-demo-consumer.xml
...nt-base/src/main/resources/spring/dubbo-demo-consumer.xml
+0
-32
No files found.
dlink-client/dlink-client-1.11/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
View file @
f6d81b81
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
public
class
FlinkCDCMergeBuilder
{
public
class
FlinkCDCMergeBuilder
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
env
.
setParallelism
(
config
.
getParallelism
());
env
.
setParallelism
(
config
.
getParallelism
());
}
}
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
}
}
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
.
port
(
config
.
getPort
())
.
port
(
config
.
getPort
())
.
username
(
config
.
getUsername
())
.
username
(
config
.
getUsername
())
.
password
(
config
.
getPassword
());
.
password
(
config
.
getPassword
());
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())&&
config
.
getDatabase
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())
&&
config
.
getDatabase
().
size
()
>
0
)
{
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
}
}
if
(
Asserts
.
isNotNull
(
config
.
getTable
())&&
config
.
getTable
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getTable
())
&&
config
.
getTable
().
size
()
>
0
)
{
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
}
}
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
switch
(
config
.
getStartupMode
().
toUpperCase
()){
switch
(
config
.
getStartupMode
().
toUpperCase
())
{
case
"INITIAL"
:
case
"INITIAL"
:
builder
.
startupOptions
(
StartupOptions
.
initial
());
builder
.
startupOptions
(
StartupOptions
.
initial
());
break
;
break
;
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
default
:
default
:
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
}
else
{
}
else
{
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
}
}
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
...
...
dlink-client/dlink-client-1.11/src/main/java/com/dlink/executor/CustomTableResultImpl.java
View file @
f6d81b81
...
@@ -17,8 +17,9 @@ import java.util.Optional;
...
@@ -17,8 +17,9 @@ import java.util.Optional;
/**
/**
* 定制TableResultImpl
* 定制TableResultImpl
* @author wenmo
*
* @since 2021/6/7 22:06
* @author wenmo
* @since 2021/6/7 22:06
**/
**/
@Internal
@Internal
class
CustomTableResultImpl
implements
TableResult
{
class
CustomTableResultImpl
implements
TableResult
{
...
@@ -49,12 +50,12 @@ class CustomTableResultImpl implements TableResult {
...
@@ -49,12 +50,12 @@ class CustomTableResultImpl implements TableResult {
this
.
printStyle
=
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
this
.
printStyle
=
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
}
}
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
if
(
fields
.
size
()>
0
)
{
if
(
fields
.
size
()
>
0
)
{
TableSchema
.
Builder
tableSchemaBuild
=
TableSchema
.
builder
();
TableSchema
.
Builder
tableSchemaBuild
=
TableSchema
.
builder
();
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
tableSchemaBuild
.
field
(
fields
.
get
(
i
).
getName
(),
fields
.
get
(
i
).
getType
());
tableSchemaBuild
.
field
(
fields
.
get
(
i
).
getName
(),
fields
.
get
(
i
).
getType
());
}
}
builder
.
tableSchema
(
tableSchemaBuild
.
build
()).
data
(
rows
);
builder
.
tableSchema
(
tableSchemaBuild
.
build
()).
data
(
rows
);
}
}
...
@@ -109,7 +110,9 @@ class CustomTableResultImpl implements TableResult {
...
@@ -109,7 +110,9 @@ class CustomTableResultImpl implements TableResult {
return
new
Builder
();
return
new
Builder
();
}
}
/** Builder for creating a {@link CustomTableResultImpl}. */
/**
* Builder for creating a {@link CustomTableResultImpl}.
*/
public
static
class
Builder
{
public
static
class
Builder
{
private
JobClient
jobClient
=
null
;
private
JobClient
jobClient
=
null
;
private
TableSchema
tableSchema
=
null
;
private
TableSchema
tableSchema
=
null
;
...
@@ -118,7 +121,8 @@ class CustomTableResultImpl implements TableResult {
...
@@ -118,7 +121,8 @@ class CustomTableResultImpl implements TableResult {
private
PrintStyle
printStyle
=
private
PrintStyle
printStyle
=
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
);
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
);
private
Builder
()
{}
private
Builder
()
{
}
/**
/**
* Specifies job client which associates the submitted Flink job.
* Specifies job client which associates the submitted Flink job.
...
@@ -174,20 +178,26 @@ class CustomTableResultImpl implements TableResult {
...
@@ -174,20 +178,26 @@ class CustomTableResultImpl implements TableResult {
return
this
;
return
this
;
}
}
/** Specifies print style. Default is {@link TableauStyle} with max integer column width. */
/**
* Specifies print style. Default is {@link TableauStyle} with max integer column width.
*/
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
this
.
printStyle
=
printStyle
;
this
.
printStyle
=
printStyle
;
return
this
;
return
this
;
}
}
/** Returns a {@link TableResult} instance. */
/**
* Returns a {@link TableResult} instance.
*/
public
TableResult
build
()
{
public
TableResult
build
()
{
return
new
CustomTableResultImpl
(
jobClient
,
tableSchema
,
resultKind
,
data
,
printStyle
);
return
new
CustomTableResultImpl
(
jobClient
,
tableSchema
,
resultKind
,
data
,
printStyle
);
}
}
}
}
/** Root interface for all print styles. */
/**
* Root interface for all print styles.
*/
public
interface
PrintStyle
{
public
interface
PrintStyle
{
/**
/**
* Create a tableau print style with given max column width, null column, and a flag to
* Create a tableau print style with given max column width, null column, and a flag to
...
@@ -211,7 +221,9 @@ class CustomTableResultImpl implements TableResult {
...
@@ -211,7 +221,9 @@ class CustomTableResultImpl implements TableResult {
}
}
}
}
/** print the result schema and content as tableau form. */
/**
* print the result schema and content as tableau form.
*/
private
static
final
class
TableauStyle
implements
PrintStyle
{
private
static
final
class
TableauStyle
implements
PrintStyle
{
/**
/**
* A flag to indicate whether the column width is derived from type (true) or content
* A flag to indicate whether the column width is derived from type (true) or content
...
@@ -245,5 +257,6 @@ class CustomTableResultImpl implements TableResult {
...
@@ -245,5 +257,6 @@ class CustomTableResultImpl implements TableResult {
/**
/**
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
*/
*/
private
static
final
class
RawContentStyle
implements
PrintStyle
{}
private
static
final
class
RawContentStyle
implements
PrintStyle
{
}
}
}
dlink-client/dlink-client-1.11/src/main/java/com/dlink/executor/TableSchemaField.java
View file @
f6d81b81
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
import
org.apache.flink.table.types.DataType
;
import
org.apache.flink.table.types.DataType
;
/**
/**
* @author
wenmo
* @author wenmo
* @since
2021/6/7 22:06
* @since 2021/6/7 22:06
**/
**/
public
class
TableSchemaField
{
public
class
TableSchemaField
{
private
String
name
;
private
String
name
;
...
...
dlink-client/dlink-client-1.11/src/main/java/com/dlink/utils/FlinkUtil.java
View file @
f6d81b81
...
@@ -17,18 +17,18 @@ import java.util.Optional;
...
@@ -17,18 +17,18 @@ import java.util.Optional;
*/
*/
public
class
FlinkUtil
{
public
class
FlinkUtil
{
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
){
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
)
{
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
);
);
if
(
tableOpt
.
isPresent
())
{
if
(
tableOpt
.
isPresent
())
{
return
Arrays
.
asList
(
tableOpt
.
get
().
getResolvedSchema
().
getFieldNames
());
return
Arrays
.
asList
(
tableOpt
.
get
().
getResolvedSchema
().
getFieldNames
());
}
else
{
}
else
{
return
new
ArrayList
<
String
>();
return
new
ArrayList
<
String
>();
}
}
}
}
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
){
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
)
{
return
Arrays
.
asList
(
tableResult
.
getTableSchema
().
getFieldNames
());
return
Arrays
.
asList
(
tableResult
.
getTableSchema
().
getFieldNames
());
}
}
}
}
dlink-client/dlink-client-1.11/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
View file @
f6d81b81
This diff is collapsed.
Click to expand it.
dlink-client/dlink-client-1.12/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
View file @
f6d81b81
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
public
class
FlinkCDCMergeBuilder
{
public
class
FlinkCDCMergeBuilder
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
env
.
setParallelism
(
config
.
getParallelism
());
env
.
setParallelism
(
config
.
getParallelism
());
}
}
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
}
}
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
.
port
(
config
.
getPort
())
.
port
(
config
.
getPort
())
.
username
(
config
.
getUsername
())
.
username
(
config
.
getUsername
())
.
password
(
config
.
getPassword
());
.
password
(
config
.
getPassword
());
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())&&
config
.
getDatabase
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())
&&
config
.
getDatabase
().
size
()
>
0
)
{
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
}
}
if
(
Asserts
.
isNotNull
(
config
.
getTable
())&&
config
.
getTable
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getTable
())
&&
config
.
getTable
().
size
()
>
0
)
{
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
}
}
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
switch
(
config
.
getStartupMode
().
toUpperCase
()){
switch
(
config
.
getStartupMode
().
toUpperCase
())
{
case
"INITIAL"
:
case
"INITIAL"
:
builder
.
startupOptions
(
StartupOptions
.
initial
());
builder
.
startupOptions
(
StartupOptions
.
initial
());
break
;
break
;
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
default
:
default
:
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
}
else
{
}
else
{
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
}
}
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
...
...
dlink-client/dlink-client-1.12/src/main/java/com/dlink/executor/CustomTableResultImpl.java
View file @
f6d81b81
...
@@ -2,11 +2,7 @@ package com.dlink.executor;
...
@@ -2,11 +2,7 @@ package com.dlink.executor;
import
org.apache.flink.annotation.Internal
;
import
org.apache.flink.annotation.Internal
;
import
org.apache.flink.core.execution.JobClient
;
import
org.apache.flink.core.execution.JobClient
;
import
org.apache.flink.table.api.DataTypes
;
import
org.apache.flink.table.api.*
;
import
org.apache.flink.table.api.ResultKind
;
import
org.apache.flink.table.api.TableException
;
import
org.apache.flink.table.api.TableResult
;
import
org.apache.flink.table.api.TableSchema
;
import
org.apache.flink.table.utils.PrintUtils
;
import
org.apache.flink.table.utils.PrintUtils
;
import
org.apache.flink.types.Row
;
import
org.apache.flink.types.Row
;
import
org.apache.flink.util.CloseableIterator
;
import
org.apache.flink.util.CloseableIterator
;
...
@@ -18,17 +14,13 @@ import java.util.Collections;
...
@@ -18,17 +14,13 @@ import java.util.Collections;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.*
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
/**
/**
* 定制CustomTableResultImpl
* 定制CustomTableResultImpl
* @author wenmo
*
* @since 2021/6/7 22:06
* @author wenmo
* @since 2021/6/7 22:06
**/
**/
@Internal
@Internal
class
CustomTableResultImpl
implements
TableResult
{
class
CustomTableResultImpl
implements
TableResult
{
...
@@ -60,12 +52,12 @@ class CustomTableResultImpl implements TableResult {
...
@@ -60,12 +52,12 @@ class CustomTableResultImpl implements TableResult {
this
.
printStyle
=
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
this
.
printStyle
=
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
}
}
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
if
(
fields
.
size
()>
0
)
{
if
(
fields
.
size
()
>
0
)
{
TableSchema
.
Builder
tableSchemaBuild
=
TableSchema
.
builder
();
TableSchema
.
Builder
tableSchemaBuild
=
TableSchema
.
builder
();
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
tableSchemaBuild
.
field
(
fields
.
get
(
i
).
getName
(),
fields
.
get
(
i
).
getType
());
tableSchemaBuild
.
field
(
fields
.
get
(
i
).
getName
(),
fields
.
get
(
i
).
getType
());
}
}
builder
.
tableSchema
(
tableSchemaBuild
.
build
()).
data
(
rows
);
builder
.
tableSchema
(
tableSchemaBuild
.
build
()).
data
(
rows
);
}
}
...
@@ -169,7 +161,9 @@ class CustomTableResultImpl implements TableResult {
...
@@ -169,7 +161,9 @@ class CustomTableResultImpl implements TableResult {
return
new
Builder
();
return
new
Builder
();
}
}
/** Builder for creating a {@link CustomTableResultImpl}. */
/**
* Builder for creating a {@link CustomTableResultImpl}.
*/
public
static
class
Builder
{
public
static
class
Builder
{
private
JobClient
jobClient
=
null
;
private
JobClient
jobClient
=
null
;
private
TableSchema
tableSchema
=
null
;
private
TableSchema
tableSchema
=
null
;
...
@@ -178,7 +172,8 @@ class CustomTableResultImpl implements TableResult {
...
@@ -178,7 +172,8 @@ class CustomTableResultImpl implements TableResult {
private
PrintStyle
printStyle
=
private
PrintStyle
printStyle
=
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
,
false
);
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
,
false
);
private
Builder
()
{}
private
Builder
()
{
}
/**
/**
* Specifies job client which associates the submitted Flink job.
* Specifies job client which associates the submitted Flink job.
...
@@ -234,20 +229,26 @@ class CustomTableResultImpl implements TableResult {
...
@@ -234,20 +229,26 @@ class CustomTableResultImpl implements TableResult {
return
this
;
return
this
;
}
}
/** Specifies print style. Default is {@link TableauStyle} with max integer column width. */
/**
* Specifies print style. Default is {@link TableauStyle} with max integer column width.
*/
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
this
.
printStyle
=
printStyle
;
this
.
printStyle
=
printStyle
;
return
this
;
return
this
;
}
}
/** Returns a {@link TableResult} instance. */
/**
* Returns a {@link TableResult} instance.
*/
public
TableResult
build
()
{
public
TableResult
build
()
{
return
new
CustomTableResultImpl
(
jobClient
,
tableSchema
,
resultKind
,
data
,
printStyle
);
return
new
CustomTableResultImpl
(
jobClient
,
tableSchema
,
resultKind
,
data
,
printStyle
);
}
}
}
}
/** Root interface for all print styles. */
/**
* Root interface for all print styles.
*/
public
interface
PrintStyle
{
public
interface
PrintStyle
{
/**
/**
* Create a tableau print style with given max column width, null column, change mode
* Create a tableau print style with given max column width, null column, change mode
...
@@ -275,7 +276,9 @@ class CustomTableResultImpl implements TableResult {
...
@@ -275,7 +276,9 @@ class CustomTableResultImpl implements TableResult {
}
}
}
}
/** print the result schema and content as tableau form. */
/**
* print the result schema and content as tableau form.
*/
private
static
final
class
TableauStyle
implements
PrintStyle
{
private
static
final
class
TableauStyle
implements
PrintStyle
{
/**
/**
* A flag to indicate whether the column width is derived from type (true) or content
* A flag to indicate whether the column width is derived from type (true) or content
...
@@ -285,7 +288,9 @@ class CustomTableResultImpl implements TableResult {
...
@@ -285,7 +288,9 @@ class CustomTableResultImpl implements TableResult {
private
final
int
maxColumnWidth
;
private
final
int
maxColumnWidth
;
private
final
String
nullColumn
;
private
final
String
nullColumn
;
/** A flag to indicate whether print row kind info. */
/**
* A flag to indicate whether print row kind info.
*/
private
final
boolean
printRowKind
;
private
final
boolean
printRowKind
;
private
TableauStyle
(
private
TableauStyle
(
...
@@ -319,7 +324,8 @@ class CustomTableResultImpl implements TableResult {
...
@@ -319,7 +324,8 @@ class CustomTableResultImpl implements TableResult {
/**
/**
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
*/
*/
private
static
final
class
RawContentStyle
implements
PrintStyle
{}
private
static
final
class
RawContentStyle
implements
PrintStyle
{
}
/**
/**
* A {@link CloseableIterator} wrapper class that can return whether the first row is ready.
* A {@link CloseableIterator} wrapper class that can return whether the first row is ready.
...
...
dlink-client/dlink-client-1.12/src/main/java/com/dlink/executor/TableSchemaField.java
View file @
f6d81b81
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
import
org.apache.flink.table.types.DataType
;
import
org.apache.flink.table.types.DataType
;
/**
/**
* @author
wenmo
* @author wenmo
* @since
2021/6/7 22:06
* @since 2021/6/7 22:06
**/
**/
public
class
TableSchemaField
{
public
class
TableSchemaField
{
private
String
name
;
private
String
name
;
...
...
dlink-client/dlink-client-1.12/src/main/java/com/dlink/utils/FlinkUtil.java
View file @
f6d81b81
...
@@ -17,18 +17,18 @@ import java.util.Optional;
...
@@ -17,18 +17,18 @@ import java.util.Optional;
*/
*/
public
class
FlinkUtil
{
public
class
FlinkUtil
{
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
){
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
)
{
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
);
);
if
(
tableOpt
.
isPresent
())
{
if
(
tableOpt
.
isPresent
())
{
return
Arrays
.
asList
(
tableOpt
.
get
().
getResolvedSchema
().
getFieldNames
());
return
Arrays
.
asList
(
tableOpt
.
get
().
getResolvedSchema
().
getFieldNames
());
}
else
{
}
else
{
return
new
ArrayList
<
String
>();
return
new
ArrayList
<
String
>();
}
}
}
}
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
){
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
)
{
return
Arrays
.
asList
(
tableResult
.
getTableSchema
().
getFieldNames
());
return
Arrays
.
asList
(
tableResult
.
getTableSchema
().
getFieldNames
());
}
}
}
}
dlink-client/dlink-client-1.12/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
View file @
f6d81b81
This diff is collapsed.
Click to expand it.
dlink-client/dlink-client-1.13/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
View file @
f6d81b81
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
public
class
FlinkCDCMergeBuilder
{
public
class
FlinkCDCMergeBuilder
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
env
.
setParallelism
(
config
.
getParallelism
());
env
.
setParallelism
(
config
.
getParallelism
());
}
}
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
}
}
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
.
port
(
config
.
getPort
())
.
port
(
config
.
getPort
())
.
username
(
config
.
getUsername
())
.
username
(
config
.
getUsername
())
.
password
(
config
.
getPassword
());
.
password
(
config
.
getPassword
());
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())&&
config
.
getDatabase
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())
&&
config
.
getDatabase
().
size
()
>
0
)
{
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
}
}
if
(
Asserts
.
isNotNull
(
config
.
getTable
())&&
config
.
getTable
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getTable
())
&&
config
.
getTable
().
size
()
>
0
)
{
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
}
}
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
switch
(
config
.
getStartupMode
().
toUpperCase
()){
switch
(
config
.
getStartupMode
().
toUpperCase
())
{
case
"INITIAL"
:
case
"INITIAL"
:
builder
.
startupOptions
(
StartupOptions
.
initial
());
builder
.
startupOptions
(
StartupOptions
.
initial
());
break
;
break
;
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
default
:
default
:
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
}
else
{
}
else
{
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
}
}
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
...
...
dlink-client/dlink-client-1.13/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
f6d81b81
...
@@ -235,7 +235,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -235,7 +235,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
if
(
setOperation
.
getKey
().
isPresent
()
&&
setOperation
.
getValue
().
isPresent
())
{
if
(
setOperation
.
getKey
().
isPresent
()
&&
setOperation
.
getValue
().
isPresent
())
{
String
key
=
setOperation
.
getKey
().
get
().
trim
();
String
key
=
setOperation
.
getKey
().
get
().
trim
();
String
value
=
setOperation
.
getValue
().
get
().
trim
();
String
value
=
setOperation
.
getValue
().
get
().
trim
();
if
(
Asserts
.
isNullString
(
key
)||
Asserts
.
isNullString
(
value
))
{
if
(
Asserts
.
isNullString
(
key
)
||
Asserts
.
isNullString
(
value
))
{
return
;
return
;
}
}
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
...
@@ -250,7 +250,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -250,7 +250,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
private
void
callReset
(
ResetOperation
resetOperation
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
private
void
callReset
(
ResetOperation
resetOperation
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
if
(
resetOperation
.
getKey
().
isPresent
())
{
if
(
resetOperation
.
getKey
().
isPresent
())
{
String
key
=
resetOperation
.
getKey
().
get
().
trim
();
String
key
=
resetOperation
.
getKey
().
get
().
trim
();
if
(
Asserts
.
isNullString
(
key
))
{
if
(
Asserts
.
isNullString
(
key
))
{
return
;
return
;
}
}
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
...
...
dlink-client/dlink-client-1.13/src/main/java/com/dlink/executor/CustomTableResultImpl.java
View file @
f6d81b81
...
@@ -17,22 +17,14 @@ import org.apache.flink.util.Preconditions;
...
@@ -17,22 +17,14 @@ import org.apache.flink.util.Preconditions;
import
javax.annotation.Nullable
;
import
javax.annotation.Nullable
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.concurrent.*
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
/**
/**
* 定制CustomTableResultImpl
* 定制CustomTableResultImpl
* @author wenmo
*
* @since 2021/6/7 22:06
* @author wenmo
* @since 2021/6/7 22:06
**/
**/
@Internal
@Internal
public
class
CustomTableResultImpl
implements
TableResult
{
public
class
CustomTableResultImpl
implements
TableResult
{
...
@@ -68,16 +60,16 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -68,16 +60,16 @@ public class CustomTableResultImpl implements TableResult {
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
}
}
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
if
(
fields
.
size
()>
0
)
{
if
(
fields
.
size
()
>
0
)
{
List
<
String
>
columnNames
=
new
ArrayList
<>();
List
<
String
>
columnNames
=
new
ArrayList
<>();
List
<
DataType
>
columnTypes
=
new
ArrayList
<>();
List
<
DataType
>
columnTypes
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
columnNames
.
add
(
fields
.
get
(
i
).
getName
());
columnNames
.
add
(
fields
.
get
(
i
).
getName
());
columnTypes
.
add
(
fields
.
get
(
i
).
getType
());
columnTypes
.
add
(
fields
.
get
(
i
).
getType
());
}
}
builder
.
schema
(
ResolvedSchema
.
physical
(
columnNames
,
columnTypes
)).
data
(
rows
);
builder
.
schema
(
ResolvedSchema
.
physical
(
columnNames
,
columnTypes
)).
data
(
rows
);
}
}
return
builder
.
build
();
return
builder
.
build
();
}
}
...
@@ -184,7 +176,9 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -184,7 +176,9 @@ public class CustomTableResultImpl implements TableResult {
return
new
Builder
();
return
new
Builder
();
}
}
/** Builder for creating a {@link CustomTableResultImpl}. */
/**
* Builder for creating a {@link CustomTableResultImpl}.
*/
public
static
class
Builder
{
public
static
class
Builder
{
private
JobClient
jobClient
=
null
;
private
JobClient
jobClient
=
null
;
private
ResolvedSchema
resolvedSchema
=
null
;
private
ResolvedSchema
resolvedSchema
=
null
;
...
@@ -194,7 +188,8 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -194,7 +188,8 @@ public class CustomTableResultImpl implements TableResult {
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
,
false
);
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
,
false
);
private
ZoneId
sessionTimeZone
=
ZoneId
.
of
(
"UTC"
);
private
ZoneId
sessionTimeZone
=
ZoneId
.
of
(
"UTC"
);
private
Builder
()
{}
private
Builder
()
{
}
/**
/**
* Specifies job client which associates the submitted Flink job.
* Specifies job client which associates the submitted Flink job.
...
@@ -250,28 +245,36 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -250,28 +245,36 @@ public class CustomTableResultImpl implements TableResult {
return
this
;
return
this
;
}
}
/** Specifies print style. Default is {@link TableauStyle} with max integer column width. */
/**
* Specifies print style. Default is {@link TableauStyle} with max integer column width.
*/
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
this
.
printStyle
=
printStyle
;
this
.
printStyle
=
printStyle
;
return
this
;
return
this
;
}
}
/** Specifies session time zone. */
/**
* Specifies session time zone.
*/
public
Builder
setSessionTimeZone
(
ZoneId
sessionTimeZone
)
{
public
Builder
setSessionTimeZone
(
ZoneId
sessionTimeZone
)
{
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
this
.
sessionTimeZone
=
sessionTimeZone
;
this
.
sessionTimeZone
=
sessionTimeZone
;
return
this
;
return
this
;
}
}
/** Returns a {@link TableResult} instance. */
/**
* Returns a {@link TableResult} instance.
*/
public
TableResult
build
()
{
public
TableResult
build
()
{
return
new
CustomTableResultImpl
(
return
new
CustomTableResultImpl
(
jobClient
,
resolvedSchema
,
resultKind
,
data
,
printStyle
,
sessionTimeZone
);
jobClient
,
resolvedSchema
,
resultKind
,
data
,
printStyle
,
sessionTimeZone
);
}
}
}
}
/** Root interface for all print styles. */
/**
* Root interface for all print styles.
*/
public
interface
PrintStyle
{
public
interface
PrintStyle
{
/**
/**
* Create a tableau print style with given max column width, null column, change mode
* Create a tableau print style with given max column width, null column, change mode
...
@@ -299,7 +302,9 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -299,7 +302,9 @@ public class CustomTableResultImpl implements TableResult {
}
}
}
}
/** print the result schema and content as tableau form. */
/**
* print the result schema and content as tableau form.
*/
private
static
final
class
TableauStyle
implements
PrintStyle
{
private
static
final
class
TableauStyle
implements
PrintStyle
{
/**
/**
* A flag to indicate whether the column width is derived from type (true) or content
* A flag to indicate whether the column width is derived from type (true) or content
...
@@ -309,7 +314,9 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -309,7 +314,9 @@ public class CustomTableResultImpl implements TableResult {
private
final
int
maxColumnWidth
;
private
final
int
maxColumnWidth
;
private
final
String
nullColumn
;
private
final
String
nullColumn
;
/** A flag to indicate whether print row kind info. */
/**
* A flag to indicate whether print row kind info.
*/
private
final
boolean
printRowKind
;
private
final
boolean
printRowKind
;
private
TableauStyle
(
private
TableauStyle
(
...
@@ -343,7 +350,8 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -343,7 +350,8 @@ public class CustomTableResultImpl implements TableResult {
/**
/**
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
*/
*/
private
static
final
class
RawContentStyle
implements
PrintStyle
{}
private
static
final
class
RawContentStyle
implements
PrintStyle
{
}
/**
/**
* A {@link CloseableIterator} wrapper class that can return whether the first row is ready.
* A {@link CloseableIterator} wrapper class that can return whether the first row is ready.
...
...
dlink-client/dlink-client-1.13/src/main/java/com/dlink/executor/TableSchemaField.java
View file @
f6d81b81
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
import
org.apache.flink.table.types.DataType
;
import
org.apache.flink.table.types.DataType
;
/**
/**
* @author
wenmo
* @author wenmo
* @since
2021/6/7 22:06
* @since 2021/6/7 22:06
**/
**/
public
class
TableSchemaField
{
public
class
TableSchemaField
{
private
String
name
;
private
String
name
;
...
...
dlink-client/dlink-client-1.13/src/main/java/com/dlink/utils/FlinkUtil.java
View file @
f6d81b81
...
@@ -4,7 +4,9 @@ import org.apache.flink.table.api.TableResult;
...
@@ -4,7 +4,9 @@ import org.apache.flink.table.api.TableResult;
import
org.apache.flink.table.catalog.CatalogManager
;
import
org.apache.flink.table.catalog.CatalogManager
;
import
org.apache.flink.table.catalog.ObjectIdentifier
;
import
org.apache.flink.table.catalog.ObjectIdentifier
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
/**
/**
* FlinkUtil
* FlinkUtil
...
@@ -14,18 +16,18 @@ import java.util.*;
...
@@ -14,18 +16,18 @@ import java.util.*;
*/
*/
public
class
FlinkUtil
{
public
class
FlinkUtil
{
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
){
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
)
{
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
);
);
if
(
tableOpt
.
isPresent
())
{
if
(
tableOpt
.
isPresent
())
{
return
tableOpt
.
get
().
getResolvedSchema
().
getColumnNames
();
return
tableOpt
.
get
().
getResolvedSchema
().
getColumnNames
();
}
else
{
}
else
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
}
}
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
){
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
)
{
return
tableResult
.
getResolvedSchema
().
getColumnNames
();
return
tableResult
.
getResolvedSchema
().
getColumnNames
();
}
}
}
}
dlink-client/dlink-client-1.13/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
View file @
f6d81b81
This diff is collapsed.
Click to expand it.
dlink-client/dlink-client-1.14/src/main/java/com/dlink/cdc/FlinkCDCMergeBuilder.java
View file @
f6d81b81
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
...
@@ -21,10 +21,10 @@ import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer;
public
class
FlinkCDCMergeBuilder
{
public
class
FlinkCDCMergeBuilder
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
public
static
void
buildMySqlCDC
(
StreamExecutionEnvironment
env
,
FlinkCDCConfig
config
)
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getParallelism
()))
{
env
.
setParallelism
(
config
.
getParallelism
());
env
.
setParallelism
(
config
.
getParallelism
());
}
}
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
if
(
Asserts
.
isNotNull
(
config
.
getCheckpoint
()))
{
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
env
.
enableCheckpointing
(
config
.
getCheckpoint
());
}
}
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
MySqlSourceBuilder
<
String
>
sourceBuilder
=
MySqlSource
.<
String
>
builder
()
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
...
@@ -32,16 +32,16 @@ public class FlinkCDCMergeBuilder {
.
port
(
config
.
getPort
())
.
port
(
config
.
getPort
())
.
username
(
config
.
getUsername
())
.
username
(
config
.
getUsername
())
.
password
(
config
.
getPassword
());
.
password
(
config
.
getPassword
());
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())&&
config
.
getDatabase
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getDatabase
())
&&
config
.
getDatabase
().
size
()
>
0
)
{
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
databaseList
(
config
.
getDatabase
().
toArray
(
new
String
[
0
]));
}
}
if
(
Asserts
.
isNotNull
(
config
.
getTable
())&&
config
.
getTable
().
size
()>
0
)
{
if
(
Asserts
.
isNotNull
(
config
.
getTable
())
&&
config
.
getTable
().
size
()
>
0
)
{
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
sourceBuilder
.
tableList
(
config
.
getTable
().
toArray
(
new
String
[
0
]));
}
}
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
MySqlSourceBuilder
<
String
>
builder
=
sourceBuilder
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
.
deserializer
(
new
JsonDebeziumDeserializationSchema
());
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
if
(
Asserts
.
isNotNullString
(
config
.
getStartupMode
()))
{
switch
(
config
.
getStartupMode
().
toUpperCase
()){
switch
(
config
.
getStartupMode
().
toUpperCase
())
{
case
"INITIAL"
:
case
"INITIAL"
:
builder
.
startupOptions
(
StartupOptions
.
initial
());
builder
.
startupOptions
(
StartupOptions
.
initial
());
break
;
break
;
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
...
@@ -54,12 +54,12 @@ public class FlinkCDCMergeBuilder {
default
:
default
:
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
}
else
{
}
else
{
builder
.
startupOptions
(
StartupOptions
.
latest
());
builder
.
startupOptions
(
StartupOptions
.
latest
());
}
}
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
MySqlSource
<
String
>
sourceFunction
=
builder
.
build
();
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
DataStreamSource
<
String
>
streamSource
=
env
.
fromSource
(
sourceFunction
,
WatermarkStrategy
.
noWatermarks
(),
"MySQL Source"
);
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
streamSource
.
addSink
(
getKafkaProducer
(
config
.
getBrokers
(),
config
.
getTopic
()));
}
}
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
private
static
FlinkKafkaProducer
<
String
>
getKafkaProducer
(
String
brokers
,
String
topic
)
{
...
...
dlink-client/dlink-client-1.14/src/main/java/com/dlink/executor/CustomTableEnvironmentImpl.java
View file @
f6d81b81
...
@@ -298,7 +298,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -298,7 +298,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
if
(
setOperation
.
getKey
().
isPresent
()
&&
setOperation
.
getValue
().
isPresent
())
{
if
(
setOperation
.
getKey
().
isPresent
()
&&
setOperation
.
getValue
().
isPresent
())
{
String
key
=
setOperation
.
getKey
().
get
().
trim
();
String
key
=
setOperation
.
getKey
().
get
().
trim
();
String
value
=
setOperation
.
getValue
().
get
().
trim
();
String
value
=
setOperation
.
getValue
().
get
().
trim
();
if
(
Asserts
.
isNullString
(
key
)||
Asserts
.
isNullString
(
value
))
{
if
(
Asserts
.
isNullString
(
key
)
||
Asserts
.
isNullString
(
value
))
{
return
;
return
;
}
}
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
...
@@ -313,7 +313,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
...
@@ -313,7 +313,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
private
void
callReset
(
ResetOperation
resetOperation
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
private
void
callReset
(
ResetOperation
resetOperation
,
StreamExecutionEnvironment
environment
,
Map
<
String
,
Object
>
setMap
)
{
if
(
resetOperation
.
getKey
().
isPresent
())
{
if
(
resetOperation
.
getKey
().
isPresent
())
{
String
key
=
resetOperation
.
getKey
().
get
().
trim
();
String
key
=
resetOperation
.
getKey
().
get
().
trim
();
if
(
Asserts
.
isNullString
(
key
))
{
if
(
Asserts
.
isNullString
(
key
))
{
return
;
return
;
}
}
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
Map
<
String
,
String
>
confMap
=
new
HashMap
<>();
...
...
dlink-client/dlink-client-1.14/src/main/java/com/dlink/executor/CustomTableResultImpl.java
View file @
f6d81b81
...
@@ -17,22 +17,14 @@ import org.apache.flink.util.Preconditions;
...
@@ -17,22 +17,14 @@ import org.apache.flink.util.Preconditions;
import
javax.annotation.Nullable
;
import
javax.annotation.Nullable
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.concurrent.*
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
/**
/**
* 定制TableResultImpl
* 定制TableResultImpl
* @author wenmo
*
* @since 2021/10/22 10:02
* @author wenmo
* @since 2021/10/22 10:02
**/
**/
@Internal
@Internal
public
class
CustomTableResultImpl
implements
TableResult
{
public
class
CustomTableResultImpl
implements
TableResult
{
...
@@ -68,16 +60,16 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -68,16 +60,16 @@ public class CustomTableResultImpl implements TableResult {
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
}
}
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
public
static
TableResult
buildTableResult
(
List
<
TableSchemaField
>
fields
,
List
<
Row
>
rows
)
{
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
Builder
builder
=
builder
().
resultKind
(
ResultKind
.
SUCCESS
);
if
(
fields
.
size
()>
0
)
{
if
(
fields
.
size
()
>
0
)
{
List
<
String
>
columnNames
=
new
ArrayList
<>();
List
<
String
>
columnNames
=
new
ArrayList
<>();
List
<
DataType
>
columnTypes
=
new
ArrayList
<>();
List
<
DataType
>
columnTypes
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
columnNames
.
add
(
fields
.
get
(
i
).
getName
());
columnNames
.
add
(
fields
.
get
(
i
).
getName
());
columnTypes
.
add
(
fields
.
get
(
i
).
getType
());
columnTypes
.
add
(
fields
.
get
(
i
).
getType
());
}
}
builder
.
schema
(
ResolvedSchema
.
physical
(
columnNames
,
columnTypes
)).
data
(
rows
);
builder
.
schema
(
ResolvedSchema
.
physical
(
columnNames
,
columnTypes
)).
data
(
rows
);
}
}
return
builder
.
build
();
return
builder
.
build
();
}
}
...
@@ -184,7 +176,9 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -184,7 +176,9 @@ public class CustomTableResultImpl implements TableResult {
return
new
Builder
();
return
new
Builder
();
}
}
/** Builder for creating a {@link CustomTableResultImpl}. */
/**
* Builder for creating a {@link CustomTableResultImpl}.
*/
public
static
class
Builder
{
public
static
class
Builder
{
private
JobClient
jobClient
=
null
;
private
JobClient
jobClient
=
null
;
private
ResolvedSchema
resolvedSchema
=
null
;
private
ResolvedSchema
resolvedSchema
=
null
;
...
@@ -194,7 +188,8 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -194,7 +188,8 @@ public class CustomTableResultImpl implements TableResult {
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
,
false
);
PrintStyle
.
tableau
(
Integer
.
MAX_VALUE
,
PrintUtils
.
NULL_COLUMN
,
false
,
false
);
private
ZoneId
sessionTimeZone
=
ZoneId
.
of
(
"UTC"
);
private
ZoneId
sessionTimeZone
=
ZoneId
.
of
(
"UTC"
);
private
Builder
()
{}
private
Builder
()
{
}
/**
/**
* Specifies job client which associates the submitted Flink job.
* Specifies job client which associates the submitted Flink job.
...
@@ -250,28 +245,36 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -250,28 +245,36 @@ public class CustomTableResultImpl implements TableResult {
return
this
;
return
this
;
}
}
/** Specifies print style. Default is {@link TableauStyle} with max integer column width. */
/**
* Specifies print style. Default is {@link TableauStyle} with max integer column width.
*/
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
public
Builder
setPrintStyle
(
PrintStyle
printStyle
)
{
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
Preconditions
.
checkNotNull
(
printStyle
,
"printStyle should not be null"
);
this
.
printStyle
=
printStyle
;
this
.
printStyle
=
printStyle
;
return
this
;
return
this
;
}
}
/** Specifies session time zone. */
/**
* Specifies session time zone.
*/
public
Builder
setSessionTimeZone
(
ZoneId
sessionTimeZone
)
{
public
Builder
setSessionTimeZone
(
ZoneId
sessionTimeZone
)
{
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
Preconditions
.
checkNotNull
(
sessionTimeZone
,
"sessionTimeZone should not be null"
);
this
.
sessionTimeZone
=
sessionTimeZone
;
this
.
sessionTimeZone
=
sessionTimeZone
;
return
this
;
return
this
;
}
}
/** Returns a {@link TableResult} instance. */
/**
* Returns a {@link TableResult} instance.
*/
public
TableResult
build
()
{
public
TableResult
build
()
{
return
new
CustomTableResultImpl
(
return
new
CustomTableResultImpl
(
jobClient
,
resolvedSchema
,
resultKind
,
data
,
printStyle
,
sessionTimeZone
);
jobClient
,
resolvedSchema
,
resultKind
,
data
,
printStyle
,
sessionTimeZone
);
}
}
}
}
/** Root interface for all print styles. */
/**
* Root interface for all print styles.
*/
public
interface
PrintStyle
{
public
interface
PrintStyle
{
/**
/**
* Create a tableau print style with given max column width, null column, change mode
* Create a tableau print style with given max column width, null column, change mode
...
@@ -299,7 +302,9 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -299,7 +302,9 @@ public class CustomTableResultImpl implements TableResult {
}
}
}
}
/** print the result schema and content as tableau form. */
/**
* print the result schema and content as tableau form.
*/
private
static
final
class
TableauStyle
implements
PrintStyle
{
private
static
final
class
TableauStyle
implements
PrintStyle
{
/**
/**
* A flag to indicate whether the column width is derived from type (true) or content
* A flag to indicate whether the column width is derived from type (true) or content
...
@@ -309,7 +314,9 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -309,7 +314,9 @@ public class CustomTableResultImpl implements TableResult {
private
final
int
maxColumnWidth
;
private
final
int
maxColumnWidth
;
private
final
String
nullColumn
;
private
final
String
nullColumn
;
/** A flag to indicate whether print row kind info. */
/**
* A flag to indicate whether print row kind info.
*/
private
final
boolean
printRowKind
;
private
final
boolean
printRowKind
;
private
TableauStyle
(
private
TableauStyle
(
...
@@ -343,7 +350,8 @@ public class CustomTableResultImpl implements TableResult {
...
@@ -343,7 +350,8 @@ public class CustomTableResultImpl implements TableResult {
/**
/**
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
* only print the result content as raw form. column delimiter is ",", row delimiter is "\n".
*/
*/
private
static
final
class
RawContentStyle
implements
PrintStyle
{}
private
static
final
class
RawContentStyle
implements
PrintStyle
{
}
/**
/**
* A {@link CloseableIterator} wrapper class that can return whether the first row is ready.
* A {@link CloseableIterator} wrapper class that can return whether the first row is ready.
...
...
dlink-client/dlink-client-1.14/src/main/java/com/dlink/executor/TableSchemaField.java
View file @
f6d81b81
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
...
@@ -3,8 +3,8 @@ package com.dlink.executor;
import
org.apache.flink.table.types.DataType
;
import
org.apache.flink.table.types.DataType
;
/**
/**
* @author
wenmo
* @author wenmo
* @since
2021/10/22 10:02
* @since 2021/10/22 10:02
**/
**/
public
class
TableSchemaField
{
public
class
TableSchemaField
{
private
String
name
;
private
String
name
;
...
...
dlink-client/dlink-client-1.14/src/main/java/com/dlink/utils/FlinkUtil.java
View file @
f6d81b81
...
@@ -16,19 +16,19 @@ import java.util.Optional;
...
@@ -16,19 +16,19 @@ import java.util.Optional;
*/
*/
public
class
FlinkUtil
{
public
class
FlinkUtil
{
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
){
public
static
List
<
String
>
getFieldNamesFromCatalogManager
(
CatalogManager
catalogManager
,
String
catalog
,
String
database
,
String
table
)
{
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
Optional
<
CatalogManager
.
TableLookupResult
>
tableOpt
=
catalogManager
.
getTable
(
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
ObjectIdentifier
.
of
(
catalog
,
database
,
table
)
);
);
if
(
tableOpt
.
isPresent
())
{
if
(
tableOpt
.
isPresent
())
{
return
tableOpt
.
get
().
getResolvedSchema
().
getColumnNames
();
return
tableOpt
.
get
().
getResolvedSchema
().
getColumnNames
();
}
else
{
}
else
{
return
new
ArrayList
<
String
>();
return
new
ArrayList
<
String
>();
}
}
}
}
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
){
public
static
List
<
String
>
catchColumn
(
TableResult
tableResult
)
{
return
tableResult
.
getResolvedSchema
().
getColumnNames
();
return
tableResult
.
getResolvedSchema
().
getColumnNames
();
}
}
}
}
dlink-client/dlink-client-1.14/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
View file @
f6d81b81
This diff is collapsed.
Click to expand it.
dlink-client/dlink-client-base/src/main/java/com/dlink/utils/FlinkBaseUtil.java
View file @
f6d81b81
...
@@ -14,14 +14,14 @@ import java.util.Map;
...
@@ -14,14 +14,14 @@ import java.util.Map;
*/
*/
public
class
FlinkBaseUtil
{
public
class
FlinkBaseUtil
{
public
static
Map
<
String
,
String
>
getParamsFromArgs
(
String
[]
args
)
{
public
static
Map
<
String
,
String
>
getParamsFromArgs
(
String
[]
args
)
{
Map
<
String
,
String
>
params
=
new
HashMap
<>();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
ParameterTool
parameters
=
ParameterTool
.
fromArgs
(
args
);
ParameterTool
parameters
=
ParameterTool
.
fromArgs
(
args
);
params
.
put
(
FlinkParamConstant
.
ID
,
parameters
.
get
(
FlinkParamConstant
.
ID
,
null
));
params
.
put
(
FlinkParamConstant
.
ID
,
parameters
.
get
(
FlinkParamConstant
.
ID
,
null
));
params
.
put
(
FlinkParamConstant
.
DRIVER
,
parameters
.
get
(
FlinkParamConstant
.
DRIVER
,
null
));
params
.
put
(
FlinkParamConstant
.
DRIVER
,
parameters
.
get
(
FlinkParamConstant
.
DRIVER
,
null
));
params
.
put
(
FlinkParamConstant
.
URL
,
parameters
.
get
(
FlinkParamConstant
.
URL
,
null
));
params
.
put
(
FlinkParamConstant
.
URL
,
parameters
.
get
(
FlinkParamConstant
.
URL
,
null
));
params
.
put
(
FlinkParamConstant
.
USERNAME
,
parameters
.
get
(
FlinkParamConstant
.
USERNAME
,
null
));
params
.
put
(
FlinkParamConstant
.
USERNAME
,
parameters
.
get
(
FlinkParamConstant
.
USERNAME
,
null
));
params
.
put
(
FlinkParamConstant
.
PASSWORD
,
parameters
.
get
(
FlinkParamConstant
.
PASSWORD
,
null
));
params
.
put
(
FlinkParamConstant
.
PASSWORD
,
parameters
.
get
(
FlinkParamConstant
.
PASSWORD
,
null
));
return
params
;
return
params
;
}
}
}
}
dlink-client/dlink-client-base/src/main/resources/spring/dubbo-demo-consumer.xml
deleted
100644 → 0
View file @
2a471036
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo=
"http://dubbo.apache.org/schema/dubbo"
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:context=
"http://www.springframework.org/schema/context"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
>
<context:property-placeholder/>
<dubbo:application
name=
"demo-consumer"
/>
<dubbo:registry
address=
"zookeeper://${zookeeper.address:127.0.0.1}:2181"
/>
<!-- <dubbo:reference id="demoService" check="true" interface="com.dlink.service.DemoService" version="1.0.0"/>-->
</beans>
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