Skip to content

Commit 78c2ff4

Browse files
authored
Merge pull request #7 from pavankjadda/kafka_2.1.0-upgrade
Kafka 2.1.0 upgrade
2 parents 3887d47 + fb3c47c commit 78c2ff4

File tree

12 files changed

+717
-550
lines changed

12 files changed

+717
-550
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ This repository demonstrates [CQRS](https://www.confluent.io/blog/event-sourcing
55
## How to Run?
66
1. Download and install Kafka either from [Confluent](https://docs.confluent.io/current/installation/installing_cp.html#zip-and-tar-archives) or follow instructions [from here](https://www.tutorialspoint.com/apache_kafka/apache_kafka_installation_steps.htm) first. I recommend [Confluent](https://docs.confluent.io/current/installation/installing_cp.html#zip-and-tar-archives) as it combines all the servers into one package with additional tools.
77
2. Clone this repository and open in IntelliJ or Eclipse as maven project and run `KafkaStreamApplication` class. This will bring up producer class.
8-
3. Open http://localhost:8090/orders or http://localhost:8090/customers or http://localhost:8090/sendevents to send kafka evensts (objects).
9-
4. Modify [code](https://github.com/pavankjadda/KafkaStream-CQRS-EventSourcing/blob/master/src/main/java/com/kafkastream/web/EventsController.java), if you want to send events with dofferent information.
8+
3. Go to http://localhost:9021 => Topics=> create topics `customer`, `order` and `order-to-ktable` (if they do not exist)
9+
4. Go to EventsListener class and execute main method to start REST Proxy (Jetty) then access Kafka data through REST API
10+
5. Open http://localhost:8090/orders or http://localhost:8090/customers or http://localhost:8090/sendevents to send kafka events (objects).
11+
6. Go to http://localhost:8095/customer-orders/all to see all customer orders fetched from Kafka State Store. See [StateStore Rest](https://github.com/pavankjadda/KafkaStream-CQRS-EventSourcing/blob/master/src/main/java/com/kafkastream/web/kafkarest/StateStoreRestService.java) Api for possible methods, you can customize it further
12+
7. Modify [code](https://github.com/pavankjadda/KafkaStream-CQRS-EventSourcing/blob/master/src/main/java/com/kafkastream/web/EventsController.java), if you want to send events with different information.
1013

1114
## Technologies Used
1215
1. Kafka Streams [(Confluent)](https://docs.confluent.io/current/platform.html)

pom.xml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<parent>
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>2.0.1.RELEASE</version>
17+
<version>2.1.1.RELEASE</version>
1818
<relativePath/> <!-- lookup parent from repository -->
1919
</parent>
2020

@@ -24,6 +24,8 @@
2424
<java.version>1.8</java.version>
2525
<spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>
2626
<avro.version>1.8.2</avro.version>
27+
<kafka.version>2.1.0</kafka.version>
28+
<confluent.version>5.1.0</confluent.version>
2729
</properties>
2830

2931
<dependencies>
@@ -56,30 +58,17 @@
5658
<dependency>
5759
<groupId>io.confluent</groupId>
5860
<artifactId>kafka-streams-avro-serde</artifactId>
59-
<version>4.1.0</version>
61+
<version>${confluent.version}</version>
6062
</dependency>
61-
<dependency>
62-
<groupId>io.confluent</groupId>
63-
<artifactId>kafka-avro-serializer</artifactId>
64-
<version>3.2.1</version>
65-
</dependency>
66-
6763
<dependency>
6864
<groupId>org.apache.kafka</groupId>
6965
<artifactId>kafka_2.12</artifactId>
70-
<version>1.1.0</version>
66+
<version>${kafka.version}</version>
7167
</dependency>
72-
7368
<dependency>
74-
<groupId>io.confluent</groupId>
75-
<artifactId>common-config</artifactId>
76-
<version>4.1.0</version>
77-
</dependency>
78-
79-
<dependency>
80-
<groupId>org.apache.avro</groupId>
81-
<artifactId>avro</artifactId>
82-
<version>${avro.version}</version>
69+
<groupId>org.apache.avro</groupId>
70+
<artifactId>avro</artifactId>
71+
<version>${avro.version}</version>
8372
</dependency>
8473

8574

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.kafkastream.constants;
2+
3+
public class KafkaConstants
4+
{
5+
public static String schemaRegistryUrl = "http://localhost:8081";
6+
public static String APPLICATION_ID_CONFIG = "cqrs-streams";
7+
public static String APPLICATION_SERVER_CONFIG = "localhost:8095";
8+
public static String BOOTSTRAP_SERVERS_CONFIG = "localhost:9092";
9+
public static String COMMIT_INTERVAL_MS_CONFIG = "2000";
10+
public static String AUTO_OFFSET_RESET_CONFIG = "earliest";
11+
12+
13+
public static String REST_PROXY_HOST = "localhost";
14+
public static int REST_PROXY_PORT = 8095;
15+
16+
17+
public static String orderTopic = "order";
18+
public static String customerTopic = "customer";
19+
public static String customerOrderTopic = "customer-order";
20+
public static String greetingsTopic = "greetings";
21+
public static String orderToKtableTopic = "order-to-ktable";
22+
23+
}

0 commit comments

Comments
 (0)