-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
116 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
core-back-end/src/main/java/org/student/messaging/KafkaConsumer.java
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
core-back-end/src/main/java/org/student/messaging/KafkaTopics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.student.messaging; | ||
|
||
public class KafkaTopics { | ||
public static final String ARCHIVER_TOPIC = "archiver-topic"; | ||
public static final String DATA_PROCESSOR_TOPIC ="data-processor-topic"; | ||
public static final String ARTIFACT_PROCESSOR_TOPIC = "artifact-processor-topic"; | ||
} |
16 changes: 16 additions & 0 deletions
16
core-back-end/src/main/java/org/student/messaging/archiver/ArchiverListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.student.messaging.archiver; | ||
|
||
import org.springframework.kafka.annotation.KafkaListener; | ||
import org.springframework.kafka.annotation.TopicPartition; | ||
import org.springframework.stereotype.Service; | ||
import org.student.messaging.KafkaTopics; | ||
|
||
@Service | ||
public class ArchiverListener { | ||
|
||
@KafkaListener(id = "archiver-listener", topicPartitions = @TopicPartition(topic = KafkaTopics.ARCHIVER_TOPIC, partitions = {"1"}), groupId = "core-file-garbage-group") | ||
public void consume(byte[] message) { | ||
System.out.println("Consumed message: " + new String(message)); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
core-back-end/src/main/java/org/student/messaging/archiver/ArchiverProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.student.messaging.archiver; | ||
|
||
import org.apache.kafka.clients.producer.ProducerRecord; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.springframework.stereotype.Service; | ||
import org.student.messaging.KafkaTopics; | ||
|
||
@Service | ||
public class ArchiverProducer { | ||
|
||
private final KafkaTemplate<String, byte[]> template; | ||
|
||
ArchiverProducer(KafkaTemplate<String, byte[]> template) { | ||
this.template = template; | ||
} | ||
|
||
public void send(byte[] message) { | ||
template.send(new ProducerRecord<>(KafkaTopics.ARCHIVER_TOPIC, 0, null, message)); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
...end/src/main/java/org/student/messaging/artifact_processor/ArtifactProcessorListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.student.messaging.artifact_processor; | ||
|
||
import org.springframework.kafka.annotation.KafkaListener; | ||
import org.springframework.kafka.annotation.TopicPartition; | ||
import org.springframework.stereotype.Service; | ||
import org.student.messaging.KafkaTopics; | ||
|
||
@Service | ||
public class ArtifactProcessorListener { | ||
@KafkaListener(id = "artifact-processor-listener", topicPartitions = @TopicPartition(topic = KafkaTopics.ARTIFACT_PROCESSOR_TOPIC, partitions = {"1"}), groupId = "core-file-garbage-group") | ||
public void consume(byte[] message) { | ||
System.out.println("Consumed message: " + new String(message)); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
...end/src/main/java/org/student/messaging/artifact_processor/ArtifactProcessorProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.student.messaging.artifact_processor; | ||
|
||
import org.apache.kafka.clients.producer.ProducerRecord; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.student.messaging.KafkaTopics; | ||
|
||
public class ArtifactProcessorProducer { | ||
private final KafkaTemplate<String, byte[]> template; | ||
|
||
ArtifactProcessorProducer(KafkaTemplate<String, byte[]> template) { | ||
this.template = template; | ||
} | ||
|
||
public void send(byte[] message) { | ||
template.send(new ProducerRecord<>(KafkaTopics.ARTIFACT_PROCESSOR_TOPIC, 0, null, message)); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
core-back-end/src/main/java/org/student/messaging/data_processor/DataProcessorListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.student.messaging.data_processor; | ||
|
||
import org.springframework.kafka.annotation.KafkaListener; | ||
import org.springframework.kafka.annotation.TopicPartition; | ||
import org.springframework.stereotype.Service; | ||
import org.student.messaging.KafkaTopics; | ||
|
||
@Service | ||
public class DataProcessorListener { | ||
@KafkaListener(id = "data-processor-listener", topicPartitions = @TopicPartition(topic = KafkaTopics.DATA_PROCESSOR_TOPIC, partitions = {"1"}), groupId = "core-file-garbage-group") | ||
public void consume(byte[] message) { | ||
System.out.println("Consumed message: " + new String(message)); | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
core-back-end/src/main/java/org/student/messaging/data_processor/DataProcessorProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.student.messaging.data_processor; | ||
|
||
import org.apache.kafka.clients.producer.ProducerRecord; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.springframework.stereotype.Service; | ||
import org.student.messaging.KafkaTopics; | ||
|
||
@Service | ||
public class DataProcessorProducer { | ||
private final KafkaTemplate<String, byte[]> template; | ||
|
||
DataProcessorProducer(KafkaTemplate<String, byte[]> template) { | ||
this.template = template; | ||
} | ||
|
||
public void send(byte[] message) { | ||
template.send(new ProducerRecord<>(KafkaTopics.DATA_PROCESSOR_TOPIC, 0, null, message)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters