Giter Site home page Giter Site logo

inakianduaga / kafka-image-processor Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 0.0 970 KB

Process client images using Kafka & reactive architecture

Home Page: https://inakianduaga.github.io/kafka-image-processor/#/

Scala 57.69% HTML 1.58% JavaScript 3.00% TypeScript 35.84% Java 1.89%
avro cyclejs kafka

kafka-image-processor's People

Contributors

deigote avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

kafka-image-processor's Issues

Fix CycleJS websocket driver

CycleJS can't seem to push to the websocket, always throwing

WebSocket is already in CLOSING or CLOSED state.next @ websocket.ts:13Stream._n @ core.js:909Stream.shamefullySendNext @ core.js:1688next @ index.js:25next @ index.js:50Stream._n @ core.js:913MapOperator._n @ core.js:729Stream._n @ core.js:909MapFlattenInner._n @ core.js:635Stream._n @ core.js:909intervalHandler @ core.js:260 150:1 GET https://unsplash.it/150/150?image=462 404 (Not Found)

next: outgoing => ws.send(outgoing), // debug error

However a simple test shows the websocket connection should be working from scratch:

var ws = new WebSocket('ws://localhost:9000');
ws.send(JSON.stringify({"test": 123}));

Setup Avro schemas

We want

Frontend:

  • Has toggle to distinguish between V1 or V2. When V2 is chosen, it will forward the filter type to be used to process the image

UI-Backend:

  • This will produce using either V1 of the Avro schema (where the filter type is not specified) or V2 of the schema, where the filter is specified

Image Processor:

This will always use V2 of the schema to read the data, with Avro schema evolution filling the gap for V1 produced data.

So what we will test initially is the case of "old producers", which are pushing data into the stream with an older version of the schema, and consumers still can read data properly.

TODO

  • Avro schemas for the UI-backend for V1 & V2, and copy V2 over to the processor
  • Install Avro Hugger on UI-backend / processor to be able to hydrate from the schemas

UI: V1 vs V2 selector

Related to #15

We want to introduce a toggle to select the filter to be applied. If it's not enabled, we will
Has toggle to distinguish between V1 or V2. When V2 is chosen, it will forward the filter type to be used to process the image

Setup image processor

  • Setup SBT to run the processor hooks (maybe instantiate class manually instead of using dependency injection on the main method)
  • Add binding to kafka topic, print to console that it's receiving them
  • Add WS play to fetch images from the url, republish to kafka topic
  • Add 2nd processor to listen to downloaded images, run processing to apply filter to images
  • Push image binary to kafka so it can be downloaded by the frontend

Add frontend schema selector

Frontend should

  • Have the option to choose between specifying the color or leaving it undefined (with a toggle).
  • Backend should apply a monochrome filter for when there is no information passed, or a color filter when it is passed
  • Backend image processor should save a schema with V1 if the filter information is not there, or V2 if the filter info is there

Add Avro integration

Registry:

  • We need to setup an Avro schema registry
  • Save schema V1 with only image URL
  • Save schema V2 with image Url + Filter Type
  • Maybe a 3rd schema that adds some property automatically using schema evolution

Setup Docker compose

Setup docker compose to run

  • Kafka container
  • SBT container w/ play app
  • CycleJS UI running on webpack, mapped to port 80.
  • Image processor sbt app as well

After docker compose is done

  • Run the client to see if we can get a valid websocket connection to the server
  • Push data from client to server and check server logs to make sure we can read the data.

Improve documentation

Avro:

  • Add section about Avro
  • How choosing the filter on the frontend switches the avro schema used in the backend to test schema evolution

Investigate AvroHugger

Right now we do the whole deserializing / serializing from an Avro GenericRecord by hand. It would be nice to be able to hydrate directly into a generated Avro case class from AvroHugger. We have to see how this can be done

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.