Skip to content

Latest commit

 

History

History
90 lines (55 loc) · 2.08 KB

File metadata and controls

90 lines (55 loc) · 2.08 KB

drogon kafka

an example of using kafka with drogon framework,

consume topic using websocket & leveraging thread in drogon loop event framework.

quick preview



required library



build the example

after the required library installed, use below scrip to configure & build

you may adjust your configuration as you need

set -e;

mkdir -p build bin logs public out;

cmake -S . -G "Ninja" -B build \
      -DCMAKE_BUILD_TYPE=Debug \
      -DCMAKE_CXX_STANDARD=17 \
      -DCMAKE_CXX_FLAGS="-std=c++17" \
      -DCMAKE_EXPORT_COMPILE_COMMANDS=1;

ln -sf build/compile_commands.json ./;

cmake --build build;


run the example

  1. run your kafka server using docker or systemd

  2. configure & build the project

  3. go to out dir configured & build

  4. run producer_ctl & backend_drogon_kafka

  5. use websocket request with wscat

wscat -c "http://localhost:9000/ws/stock/trade"

NOTE:

  • there's no interaction for end-user
  • they only consume what publish by "kafka producer"
  • data is using stock trade simulation depend on ratio


references


end of readme