Code Monkey home page Code Monkey logo

kafka_producer's Introduction

Contributors Forks Stargazers Issues GNU License


Logo

Kafka Java Producer

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

Table of Contents

About The Project

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.

The code is based on

  • 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

The components of this project are

  • 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.

Getting Started

To get a local copy up and running follow these simple steps.

Installation

  1. Clone the repo
git clone https://github.com/AntoineMeheut/kafka_producer

Usage

Build for the first time

mvn clean install -U

Execute the project

Method 1

  • 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

Method 2

  • 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 &

Roadmap

See the Project for a list of proposed features (and known issues).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU General Public License v3.0 License. See LICENSE for more information.

Contact

If you want to contact me just clic

Project Link: https://github.com/AntoineMeheut/kafka_producer

kafka_producer's People

Contributors

antoinemeheut avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.