Code produced to check the technical feasibility of writing in a Kafka topic events from a java application. This project is the part that injects events into a Kafka topic. This code can be used to inject events.
Explore Kafka docs
View Demo
·
Report Bug
·
Request Feature
Code produced to check the technical feasibility of writing in a Kafka topic events from a java application.
This project is the part that injects events into a Kafka topic.
This code can be used to inject events.
- springframework.boot: to save time and quickly create an application executable on a ReadHat VM
- org.apache.kafka: which allows to open connection with the Kafka machine, connect to topic and write events there
- springframework.kafka: which saves time for everything concerns the use of Kafka in a Spring project
- a src/main/resources/application.properties file which contains the address of the Kafka machine
- the src/main/java/com/ame/messages/Producer.java class: main class which contains a run method for executing writes in the Kafka
- src/main/java/com/ame/messages/model/Message.java: class that defines the structure of messages sent to Kafka
- msgID: Identification ID of the message type, example: "EVT" for event
- msgTS: Timestamp of transmission of the stream, example: "2017-03-26-18.17.37.049316"
- date: Summarized date of an event, example: "2018-02-27"
- nuoff: Official number, example: 130
- nucycle: Cycle number, example: 234156
- nucycleg: General cycle number, example: 1
- ctit: Type of intervention code, example: "110"
- msgH: Timestamp of transmission of the stream with only the time, example: "18.17.37.049316"
- topic: Indicates the name of the topic to which one wishes to inject the messages, example: "AME_AME.IN"
- src/main/java/com/ame/messages/incoming/MessagesPublisher.java: class which creates the messages that will be sent to Kafka
- src/main/java/com/ame/messages/config/ProducerChannelConfig.java: class who makes the connection to Kafka. There is no topic creation, because they are instantiated on the fly by sending messages
The project opens on Eclipse or IntelliJ.
To get a local copy up and running follow these simple steps.
- Clone the repo
git clone https://github.com/AntoineMeheut/kafka_producer
mvn clean install -U
- Copy the sources on a RHEL, place in the directory where is the pom of the project namely kafka_producer and type the command:
mvn clean install -U spring-boot:run
- to use method 1: you must have maven on the RHEL machine
- Build a jar and copy it to the RHEL machine, go to the directory where the jar is and type the following command:
nohup java -jar kafka_producer.jar &
See the Project for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU General Public License v3.0 License. See LICENSE
for more information.
If you want to contact me just clic
Project Link: https://github.com/AntoineMeheut/kafka_producer