-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTopic.java
More file actions
35 lines (28 loc) · 871 Bytes
/
Copy pathTopic.java
File metadata and controls
35 lines (28 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
public class Topic {
private int topicId;
private Queue messageQueue;
private final ReentrantLock lock = new ReentrantLock();
// Multiple cgroups can consume from the same topic
// -> Topic include list of them
private List<ConsumerGroup> consumerGroups;
public Topic(int topicId) {
this.topicId = topicId;
this.messageQueue = new Queue();
this.consumerGroups = new ArrayList<>();
}
public int getTopicId() {
return topicId;
}
public Queue getMessageQueue() {
return messageQueue;
}
public ReentrantLock getLock() {
return lock;
}
public List<ConsumerGroup> getConsumerGroups() {
return consumerGroups;
}
}