Skip to content

Commit a7cc2c3

Browse files
committed
implemented subscriber microservice using kafkaConsumer
1 parent a7497c4 commit a7cc2c3

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

Diff for: polling-publisher/subscriber-service/src/main/java/com/iluwatar/subscriber/KafkaConsumer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.springframework.kafka.annotation.KafkaListener;
2929
import org.springframework.stereotype.Service;
3030
/**
31-
* Kafak consumer service to consume messages / updates.
31+
* Kafka consumer service to consume messages / updates.
3232
* */
3333
@Service
3434
public class KafkaConsumer {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# The MIT License
3+
# Copyright © 2014-2021 Ilkka Seppälä
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
#
23+
24+
server:
25+
port: 8082
26+
27+
spring:
28+
kafka:
29+
consumer:
30+
group-id: subscriber-group

Diff for: polling-publisher/subscriber-service/src/test/java/com/iluwatar/subscriber/AppTest.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@
2525

2626
package com.iluwatar.subscriber;
2727

28-
import org.springframework.boot.SpringApplication;
28+
import org.junit.jupiter.api.Test;
29+
import org.springframework.boot.test.context.SpringBootTest;
2930

30-
public class AppTest {
31-
public static void main(String[] args) {
32-
SpringApplication.run(App.class, args);
31+
import static org.junit.jupiter.api.Assertions.*;
32+
33+
@SpringBootTest
34+
class AppTest {
35+
36+
@Test
37+
void subscriber() {
38+
assertDoesNotThrow(() -> App.main(new String[]{}));
3339
}
34-
}
40+
}

0 commit comments

Comments
 (0)