Skip to content

JetStream archetype

Xinglang Wang edited this page Feb 24, 2015 · 4 revisions

Introduction

This archtype will create a sample app. The App will have a InboundMessaging channel, Sample Processor and OutboundMessaging Channel. It also generates Dockerfile and script for start the app inside the docker container.

Create a new app

mvn archetype:generate -DarchetypeGroupId=com.ebay.jetstream.archetype -DarchetypeArtifactId=simpleapp -DarchetypeVersion=4.0.2

Build and assemble the app

It is a maven project, just run: mvn clean install

Dockerize the app

Just run docker build on the project folder: sudo docker build -t <username>/appname .

Run the docker container

sudo docker run -i -p 0.0.0.0:9999:9999 --link zkserver:zkserver --link mongoserver:mongoserver -t <username>/appname

Run it in IDE

The app require the zookeeper, zookeeper must be ready before run the app, and by default, it will use 127.0.0.1:2181 to connect to zookeeper, and it can be overrided by the system property.

The app is a spring based app, and the main class is com.ebay.jetstream.application.JetstreamApplication, it require below command line options:

  1. -n appname - Indicate the app name
  2. -cv 1.0 - Indicate the config version
  3. -p 9999 - Indicate the http port of the monitoring page

And need configure below ENVIROMENT VARIABLE:

  1. JETSTREAM_HOME - point to the buildsrc folder, this is mandatory
  2. MONGO_HOME - the mongo url for configuration, this is optional, if it is not available, it will use local spring file.

Below system property can be overrided:

  1. jetstream.runtime.zkserver.host - For zk server
  2. jetstream.runtime.zkserver.port - For zk server port
  3. jetstream.runtime.netmask - Choose which NIC to be used.

Run it without docker

The app will be assembled as a tar.gz file, just unzip it and reference the start.sh which used for docker. Change the start.sh to set correct ENVIROMENT VARIABLE. then run the start.sh.

Next: Creating Custom Channels And Processors

Clone this wiki locally