Giter Club home page Giter Club logo

undertow-websocket-kafka's Introduction

Undertow WebSocket Bridge for Apache Kafka

A demo that shows how the Undertow WebSocket API can be used to write incoming data to a Kafka topic

Running on Openshift

Login to your Openshift cluster, or simply start a local instance using the oc binaries, by executing:

oc cluster up

Once logged in, create a new project:

oc new-project kaftow

Adding Apache Zookeeper and Apache Kafka

In this project we need to add Apache Kafka and its Zookeeper, by using a simple in-memory installation. It is recommended to download these files and run the following:

oc create -f zookeeper.yaml
oc create -f zookeeper-service.yaml

oc create -f kafka.yaml
oc create -f kafka-service.yaml

Deploying the Java Application

This gives you the cluster you need, and now you can deploy the Undertow server to the same project by running

mvn fabric8:deploy -Popenshift

Testing

kafkacat CLI

Now that the Java app is also deployed you can use the nice kafkacat tool to connect to the websocket_bridge of our new project:

oc get services

Use the CLUSTER-IP of the kafka service, and run:

./kafkacat -C -b CLUSTER-IP:9092 -t websocket_bridge

This will give you a Connected message that is written, once the Undertow app is fully deployed!

WebSocket application in the browser

In the Openshift Console open the nip.io Link:

Openshift Console

This leads you a simple website, that captures mouse events from the browser, sends them to Undertow, via WebSocket.

The WebSocket connection handler than sends the data to the websocket_bridge.

check you kafkacat client to see the logs ;-)

undertow-websocket-kafka's People

Contributors

matzew avatar

Watchers

 avatar

Forkers

mzjdy

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.