Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
streamingUserPortrait
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
赵威
streamingUserPortrait
Commits
dc7a678b
Commit
dc7a678b
authored
Feb 03, 2021
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kafka connection
parent
a3eb0138
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
Main.scala
src/main/scala/com.gmei.up/Main.scala
+23
-6
No files found.
src/main/scala/com.gmei.up/Main.scala
View file @
dc7a678b
package
com.gmei.up
package
com.gmei.up
import
org.apache.flink.streaming.api.scala._
import
java.util.Properties
import
org.apache.flink.api.scala._
import
org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import
org.apache.flink.streaming.util.serialization.SimpleStringSchema
import
org.apache.flink.streaming.connectors.kafka.
{
FlinkKafkaConsumer
,
FlinkKafkaProducer
}
object
Main
{
object
Main
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
println
(
"hello"
)
val
env
=
StreamExecutionEnvironment
.
getExecutionEnvironment
val
env
=
StreamExecutionEnvironment
.
getExecutionEnvironment
val
a
=
env
.
fromElements
(
1
,
2
,
-
3
,
0
,
5
,
-
9
,
8
)
val
properties
=
new
Properties
val
b
=
a
.
map
(
_
+
1
)
properties
.
setProperty
(
"group.id"
,
"user_portrait_flink_streaming"
)
properties
.
setProperty
(
"bootstrap.servers"
,
"172.16.44.25:9092,172.16.44.31:9092,172.16.44.45:9092"
)
b
.
print
()
val
kafkaConsumer
=
new
FlinkKafkaConsumer
[
String
](
"gm-portrait-update-device"
,
new
SimpleStringSchema
,
properties
)
env
.
execute
val
stream
=
env
.
addSource
(
kafkaConsumer
)
// val a = env.fromElements(1, 2, -3, 0, 5, -9, 8)
// val b = a.map(_ + 1)
// b.print()
stream
.
print
env
.
execute
(
"flink streaming user portrait"
)
}
}
}
}
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