/sample-scdf-datagenerator

SCDF/SCS sample project to demonstrate the infinite "deploying" state

Primary LanguageJavaApache License 2.0Apache-2.0

Sample Spring Cloud Data Flow - DataGenerator app

The purpose of this project is to demonstrate the infinite "deploying" state for custom Spring Cloud Stream apps deployed to Spring Cloud Data Flow.

Generating Spring Boot Project

Simple json data generator

@Slf4j
@RequiredArgsConstructor
@EnableBinding(Source.class)
@EnableScheduling
@SpringBootApplication
public class DatageneratorApplication {

	public static void main(String[] args) {
		SpringApplication.run(DatageneratorApplication.class, args);
	}

	private final Source source;
	private final Random random = new Random();

	@Scheduled(fixedRate = 1000)
	public void randomNumber() {
		String jsonString = "{\"A\": \"value-a\", \"b\": "+random.nextInt()+"}";
		source.output().send(MessageBuilder.withPayload(jsonString).build());
		log.info("Send random json message from demo source app {}", jsonString);
	}

Steps to reproduce

  • build an uberjar
`./gradlew bootjar
  • copy/mount output directory to dataflow-server /root/apps
  • download & run the shell
$ wget https://repo.spring.io/libs-snapshot/org/springframework/cloud/spring-cloud-dataflow-shell/2.0.0.BUILD-SNAPSHOT/spring-cloud-dataflow-shell-2.0.0.BUILD-SNAPSHOT.jar
$ java -jar spring-cloud-dataflow-shell-2.0.0.BUILD-SNAPSHOT.jar

  • register app
app register --name demo --type source --uri file://root/apps/demo/datagenerator-0.0.1.jar
  • Create and deploy a demo stream
stream create --name demo --definition "demo | log" --deploy

Results

  • The data generator produces random json data (see logs and topic)
  • The log receives the messages produced by the demo random client
  • however the state for the demo app is still deploying
dataflow:>runtime apps

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?App Id / Instance Id?Unit Status?                                      No. of Instances / Attributes                                      ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?demo.log-v3         ? deployed  ?                                                    1                                                    ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?                    ?           ?       guid = 28709                                                                                      ?
?                    ?           ?        pid = 2625                                                                                       ?
?                    ?           ?       port = 28709                                                                                      ?
?demo.log-v3-0       ? deployed  ?     stderr = /tmp/spring-cloud-deployer-6393748153284974405/demo-1544043550804/demo.log-v3/stderr_0.log ?
?                    ?           ?     stdout = /tmp/spring-cloud-deployer-6393748153284974405/demo-1544043550804/demo.log-v3/stdout_0.log ?
?                    ?           ?        url = http://192.168.16.5:28709                                                                  ?
?                    ?           ?working.dir = /tmp/spring-cloud-deployer-6393748153284974405/demo-1544043550804/demo.log-v3              ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?demo.demo-v3        ? deploying ?                                                    1                                                    ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?                    ?           ?       guid = 20687                                                                                      ?
?                    ?           ?        pid = 2615                                                                                       ?
?                    ?           ?       port = 20687                                                                                      ?
?demo.demo-v3-0      ? deploying ?     stderr = /tmp/spring-cloud-deployer-6393748153284974405/demo-1544043550690/demo.demo-v3/stderr_0.log?
?                    ?           ?     stdout = /tmp/spring-cloud-deployer-6393748153284974405/demo-1544043550690/demo.demo-v3/stdout_0.log?
?                    ?           ?        url = http://192.168.16.5:20687                                                                  ?
?                    ?           ?working.dir = /tmp/spring-cloud-deployer-6393748153284974405/demo-1544043550690/demo.demo-v3             ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
  • The Dashboard UI shows also the state deploying