Skip to content
Alonso edited this page May 4, 2018 · 1 revision

Welcome to the demo-quartz wiki!

The idea of this mini demo is to create an example of a micro service that periodically consumes the bitcoin quote of a third-party, event-driven, asynchronous, status-oriented api, using docker as a container, kafka as a message broker, h2 as a database in memory and cassandra or elastic search as a database to save the json with the current bitcoin quote data.

Actually i have to run zookeeper and kafka before running the process: aironman is the topic name. If you want to use another one else, modify message.topic.name within application.properties file, then run again mvn clean package.

WORK IN PROGRESS.

  • Consuming data from the rest api every time. DONE

  • Saving data to h2. DONE.

  • Consume data from kafka topic to save it to Cassandra. NOT YET.

  • Saving data to Kafka. DONE.

  • Moving data to a websocket channel. NOT YET.

  • Adding docker file. In progress.

  • Adding a RESTfull controller. NOT YET.

To build the project, be sure that Zookeeper and kafka 0.10.0.1 is installed with defaults.

mvn clean package

zkServer start

kafka-server-start /usr/local/etc/kafka/server.properties

kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic aironman

java -jar target/demo-quartz-0.0.1-SNAPSHOT.jar

There is an uploaded container in hub.docker.com/r/aironman/demo-quartz/tags/

To run it:

docker pull aironman/demo-quartz:0.0.1-SNAPSHOT
docker run aironman/demo-quartz:0.0.1-SNAPSHOT

Actually you need to run locally Zookeeper and kafka in your local machine, i have to add a prebuilt container as a dependency.

HINT!

Be sure that your .m2/settings.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers>
  <server>
    <id>docker.io</id>
    <username>mydockerhub_username</username>
    <password>mydockerhub_password</password>
  </server>
</servers>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>

LINKS

[dockerfile-maven-plugin](github.com/spotify/dockerfile-maven)

Clone this wiki locally