Permalink
Fetching contributors…
Cannot retrieve contributors at this time
137 lines (136 sloc) 3.73 KB

Home folders

Live coding

> cd ~/1/streaming-data-kubernetes

First time

Adjust Docker settings

  • Disable “Start Docker when you log in”
  • Disable “Automatic check for updates”
  • Advanced / CPUs 4 / Memory 8.0 GB
  • Daemon / Insecure Registries / 172.30.0.0/16

Pre talk

Start Gas Mask

  • Load streaming-data-kubernetes-hosts file
  • It should contain:
127.0.0.1		localhost
255.255.255.255	broadcasthost
::1				localhost
fe80::1%lo0		localhost
127.0.0.1        app-myproject.127.0.0.1.nip.io

Start OpenShift cluster

> oc37
> ./setup-local-openshift.sh

Deploy all components

> ./deploy-all.sh

Live coding

Stream -> IO

Show logs for injector in OpenShift console

Kick off the injector

It should print contents to standard output

> curl http://app-myproject.127.0.0.1.nip.io/inject

Stream -> Infinispan

Create data grid via OpenShift UI

  • Click on Select from Project
  • Click on infinispan-ephemeral
  • Give it these parameters:
APPLICATION_NAME: datagrid
MANAGEMENT_USER: developer
MANAGEMENT_PASSWORD: developer
NUMBER_OF_INSTANCES: 3

Create datagrid configuration

ConfigurationBuilder cfg = new ConfigurationBuilder();
cfg.addServer().host(datagridHost).port(datagridPort);

Create indexed InfinispanRxMap

InfinispanRxMap
  .<String, Stop>createIndexed(mapName, TO_INDEX, cfg, vertx)
  .doOnSuccess(map -> this.stationBoardsMap = map)

Clear map and track progress

stationBoardsMap.clear()
  .andThen(trackProgress(stationBoardsMap))

Call put on rx map

.flatMapCompletable(e -> stationBoardsMap.put(e.getKey(), e.getValue()))

Change throttle from 1000ms to 5ms

Flowable.interval(5, TimeUnit.MILLISECONDS).onBackpressureDrop();

Deploy changes

> cd app
> mvn compile && oc start-build app --from-dir=. --follow

Show datagrid visualizer while deployment ongoing

Start injector

> curl http://app-myproject.127.0.0.1.nip.io/inject

Show data grid visualizer filling up

URL: http://datagrid-visualizer-myproject.127.0.0.1.nip.io/infinispan-visualizer/

Stream -> Infinispan -> Dashboard

Create continuous query

stationBoardsMap.continuousQuery(queryString)

Publish to event bus

vertx.eventBus().publish(publishAddress, toJson(pair.getValue()))

Deploy changes

> cd app
> mvn compile && oc start-build app --from-dir=. --follow

Explain and start dashboard from IDE

  • When the dashboard connects, it also restarts data injection
  • So no need to pre-inject data
  • Run dashboard.DelayedDashboard class

Close dashboard

Stream -> Infinispan -> Map

Add query parameter

queryParams.put("name", trainName);

Create query

trainPositionsMap
  .<Object[]>query(queryString, queryParams)

Deploy changes

> cd app
> mvn compile && oc start-build app --from-dir=. --follow

Start Google Maps web application while deployment ongoing

> cd web-viewer
> nvm use 4.2
> npm start

Show empty Google Maps

http://localhost:3000

Start dashboard from IDE

  • Run dashboard.DelayedDashboard class
  • Wait until delayed trains start to appear

Show delayed train positions

  • Initially start in Basel area but then move to Lausanne area