Open Docker Desktop, go to the root directory of the project in the terminal and in order to run the containers of Kafka and Zookeeper digit:
docker compose uprun the project using any IDE or use maven with the following instruction:
mvn clean install
mvn spring-boot:runuse Postman to test the API, some examples:
POST /visit HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Content-Length: 49
{
"customerId":null,
"dateTime":null
}POST /visit HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Content-Length: 108
{
"customerId":"webID001-bf3c-4b21-8ea4-8bcc99a634d4",
"dateTime":"2024-04-06T17:36:55.1313334"
}🔗 Kafka Docker Compose Quickstart: https://developer.confluent.io/quickstart/kafka-local/
docker compose updocker exec broker kafka-topics --bootstrap-server broker:9092 --create --topic "customer.visit"docker exec --interactive --tty broker kafka-console-consumer --bootstrap-server broker:9092 --topic "customer.visit" --from-beginningdocker exec --interactive --tty broker kafka-console-producer --bootstrap-server broker:9092 --topic "customer.visit"Kafdrop is a web UI for viewing Kafka topics and browsing consumer groups. The tool displays information such as brokers, topics, partitions, consumers, and lets you view messages.
Open a browser and navigate to http://localhost:9000.
In order to use Jackson and the module for Java8 DateTimes, use the following dependencies:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>In order to use the model mapper module for implementing the mappers, use the following dependency:
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>3.0.0</version>
</dependency>