Giter Site home page Giter Site logo

irc-kafka's Introduction

Kafka Chat

simple IRC chat with Apache Kafka

Members

  • 13512078 Ramandika Pranamulia
  • 13512086 Stanley Santoso

Concepts

Each nickname will be a client in a consumer group. That consumer group will subscribe to some specific topics contains a partition only. The list of channel a user join will not be saved in Kafka, the only one being saved is the offset of message a consumer group has by zookeper. Therefore if a user logout and join with the same nickname he/she will get message that he/she has left behind when he/she logged-out.

Assume stanley joins pat and if4031

When a user types `/JOIN` or `/LEAVE`, it will create a connector for that specific channel and save it into Map<String,Connector> connectors
and after joining a channel it gives the connector handler to a thread and start listening. If a topic doesn't exist the client will create a topic with the same name that intended at /JOIN

/JOIN tbd Client ######################################

connectors.add("tbd",connector) # -> add connector handler to specific topic/channel

ThreadConsumer t=new ThreadConsumer(chname,connector);#

Thread thread = new Thread(t);

thread.start();

######################################

/LEAVE tbd Client ################################## #connector.shutdown() # -> will stop listening to that channel and exit thread #connectors.remove("tbd") # -> remove from map ##################################

When a user sends a message, it will create a kafka producer which will send the message to the associated
channel. One channel represented as one kafka topic. The topic must be exist since they tried to create the topic at join time if 
te topic doesn't exit

@pat hello Client Server ############################################### ###########################

producer = create kafka producer # # Topic pat:

record = new ProducerRecord("pat","hello") # -> # message:

producer.send(record) # # hello

############################################### ###########################

When the user types `/EXIT`, all the connectors will be shutdown and connectors map will be cleared.

Available commands

  1. /NICK <nickname>: give your own nickname
  2. /NICK: give random nickname provided by the application
  3. /JOIN <channelname>: join current nickname to channelname
  4. /LEAVE <channel>: leave current nickname from channel
  5. /EXIT: terminate the application
  6. @<channelname> <any_text> send any_text to channelname
  7. <any_text> send any_text to all channels joined by the user.

Running Program

  1. Install maven
  2. Import bin ke $PATH dan pastikan $JAVA_HOME berisi alamat jdk yang akan digunakan
  3. jalankan perintah mvn clean install, jika terjadi error ubah target jdk pada pom.xml sesuai dengan versi jdk pada JAVA_HOME
  4. jalankan perintah mvn exec:java -Dexec.mainClass="Client"
  5. Ketikkan perintah yang tersedia

irc-kafka's People

Stargazers

cornfeedhobo avatar

Watchers

James Cloos avatar Ramandika Pranamulia 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.