How to get Spring XD to deploy a predefined set of

2019-03-28 18:50发布

问题:

Is there a way to launch a set of steams and taps that have been defined when a new instance of spring xd is launched?

The scenario is this: We've done some prototyping on our dev systems, but now when we'd like to build and release this to a test team. We'd like to automate most of the background work and the user needs to just worry about the output from the streams and not have to worry about the streams or their definitions or their deployment.

To facilitate this is there any runtime configurations we can use?

UPDATE: Our current approach involves writing a shell script to make some rest calls to the Spring API to create and deploy the required streams.

回答1:

The shell maintains a log of user commands:

spring-shell.log

You can edit it after creating your stream(s) (or create a file with shell commands) and then use the script command:

xd:>script foo.xd

or

$ bin/xd-shell < foo.xd

(the .xd suffix is not required, the file name can be anything).

EDIT (comment below)...

This does come with the caveat that bin/xd-shell < foo.xd will run all commands regardless of success or failure, and xd-shell --cmdfile foo.xd will terminate execution with an exit code immediately should a command fail.



标签: spring-xd