Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
tsai
CAP
Commits
e631ca74
Commit
e631ca74
authored
May 26, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add producerclient
parent
0476ed43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
26 deletions
+12
-26
KafkaConsumerClient.cs
src/Cap.Consistency.Kafka/KafkaConsumerClient.cs
+1
-26
KafkaProducerClient.cs
src/Cap.Consistency.Kafka/KafkaProducerClient.cs
+11
-0
No files found.
src/Cap.Consistency.Kafka/KafkaConsumerClient.cs
View file @
e631ca74
...
@@ -9,14 +9,7 @@ using Confluent.Kafka.Serialization;
...
@@ -9,14 +9,7 @@ using Confluent.Kafka.Serialization;
namespace
Cap.Consistency.Kafka
namespace
Cap.Consistency.Kafka
{
{
public
class
KafkaTopicPartition
public
class
KafkaConsumerClient
:
IConsumerClient
{
public
string
Topic
{
get
;
set
;
}
public
int
Partition
{
get
;
set
;
}
}
public
class
KafkaConsumerClient
:
IConsumerClient
,
IDisposable
{
{
private
readonly
string
_groupId
;
private
readonly
string
_groupId
;
...
@@ -47,22 +40,6 @@ namespace Cap.Consistency.Kafka
...
@@ -47,22 +40,6 @@ namespace Cap.Consistency.Kafka
_consumerClient
.
Assignment
.
Add
(
new
TopicPartition
(
topicName
,
partition
));
_consumerClient
.
Assignment
.
Add
(
new
TopicPartition
(
topicName
,
partition
));
}
}
public
void
Subscribe
(
IEnumerable
<
KafkaTopicPartition
>
topicList
)
{
if
(
_consumerClient
==
null
)
{
InitKafkaClient
();
}
if
(
topicList
==
null
||
topicList
.
Count
()
==
0
)
{
throw
new
ArgumentNullException
(
nameof
(
topicList
));
}
foreach
(
var
item
in
topicList
)
{
Subscribe
(
item
.
Topic
,
item
.
Partition
);
}
}
public
void
Listening
(
TimeSpan
timeout
)
{
public
void
Listening
(
TimeSpan
timeout
)
{
while
(
true
)
{
while
(
true
)
{
_consumerClient
.
Poll
(
timeout
);
_consumerClient
.
Poll
(
timeout
);
...
@@ -95,7 +72,5 @@ namespace Cap.Consistency.Kafka
...
@@ -95,7 +72,5 @@ namespace Cap.Consistency.Kafka
#
endregion
#
endregion
//public void
}
}
}
}
src/Cap.Consistency.Kafka/KafkaProducerClient.cs
0 → 100644
View file @
e631ca74
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Cap.Consistency.Kafka
{
public
class
KafkaProducerClient
{
}
}
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