Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tzolov/task-demo-metrics
https://github.com/tzolov/task-demo-metrics
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tzolov/task-demo-metrics
- Owner: tzolov
- Created: 2019-07-08T22:16:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-09T22:29:27.000Z (almost 3 years ago)
- Last Synced: 2023-03-23T02:47:27.708Z (over 1 year ago)
- Language: Java
- Size: 26.2 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Create custom Spring Cloud Task
Bootstrap by follow the [Task development instructions](https://docs.spring.io/spring-cloud-task/docs/2.0.0.RELEASE/reference/htmlsingle/#getting-started-developing-first-task) and then:
* Set the POM parent to Boot 2.2.0.M4 or newer
```xml
org.springframework.boot
spring-boot-starter-parent
2.2.0.M4
```
* Add dependencies to enable the Spring Cloud Task functionality and to configure the jdbc dependencies for the task repository:
```xml
org.springframework.cloud
spring-cloud-starter-task
2.2.0.BUILD-SNAPSHOTorg.springframework.cloud
spring-cloud-task-core
2.2.0.BUILD-SNAPSHOT```
* Add dependencies to configure the jdbc dependencies for the task repository:
```xml
org.springframework.boot
spring-boot-starter-jdbcorg.mariadb.jdbc
mariadb-java-client
runtime```
* Add dependencies to configure Micrometer integration:
```xml
org.springframework.boot
spring-boot-starter-actuatorio.micrometer
micrometer-registry-influx```
## Spring Cloud Data FLow server
Run SCDF locally using the Docker Compose `docker-compose-influxdb.yml` file.
To download the Spring Cloud Data Flow Server Docker Compose file, run the following command:
```
wget https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v2.2.0.M1/spring-cloud-dataflow-server/docker-compose-influxdb.yml
```The Docker Compose file starts instances of the following products:
* Spring Cloud Data Flow Server
* Spring Cloud Skipper Server
* MySQL
* Apache Kafka
* Influx DB
* Grafana with pre-registered dashboards#### Starting Docker Compose
```
export DATAFLOW_VERSION=2.2.0.M1
export SKIPPER_VERSION=2.1.0.M1
docker-compose -f ./docker-compose-influxdb.yml up
```#### Register and launch the custom Task
To use it, open another console window and type the following:
```
docker exec -it dataflow-server java -jar shell.jar
```* Register the custom task application
```
dataflow:>app register --name myTask --type task --uri https://github.com/tzolov/task-demo-metrics/raw/master/apps/task-demo-metrics-0.0.1-SNAPSHOT.jar```
* Create two tasks: `task1` and `task2` using the `myTask` application.
```
dataflow:>task create --name task1 --definition "myTask"
dataflow:>task create --name task2 --definition "myTask"
```* Launch `task1` and `task2` couple of times
```
dataflow:>task launch --name task1
dataflow:>task launch --name task2
```Check task execution in the SCDF UI: http://localhost:9393/dashboard/#/tasks/executions
![scdf tasks](./docs/scdf-task.png "SCDF Tasks")
## Grafana
Open Grafana at http://localhost:3000 (user: `admin`, password: `admin`) and select the `Task & Batch` dashboard
![grafana task](./docs/grafana-task.png "Grafana Task")