[英]Spring Cloud Task - launch task from maven repository in docker container
I learn Spring Cloud Task and I write simple application that is divided into 3 services. 我学习Spring Cloud Task,并编写了分为3个服务的简单应用程序。 First is a
TaskApplication
that have only main()
and implements CommandLineRunner
, second is a TaskIntakeApplication
that receives request and send them to RabbitMQ, third service is an TaskLauncherApplication
that receives messages from RabbitMQ and runs the task with received parameters. 第一个是一个
TaskApplication
仅具有main()
并实现CommandLineRunner
,第二个是一个TaskIntakeApplication
接收请求并将其发送到RabbitMQ的,第三服务是一个TaskLauncherApplication
从RabbitMQ的接收消息,并运行与所接收的参数的任务。
@Component
@EnableBinding(Source.class)
public class TaskProcessor {
@Autowired
private Source source;
public void publishRequest(String arguments) {
final String url = "maven://groupId:artifatcId:jar:version";
final List<String> args = Arrays.asList(arguments.split(","));
final TaskLaunchRequest request = new TaskLaunchRequest(url, args, null, null, "TaskApplication");
final GenericMessage<TaskLaunchRequest> message = new GenericMessage<>(request);
source.output().send(message);
}
}
And as you can see I call my built artifact by giving maven url but I wonder how can I call artifact from another docker container? 如您所见,我通过提供Maven URL来调用构建的工件,但我想知道如何从另一个Docker容器中调用工件?
If you intend to launch a task application from an upstream event (eg, a new file event; a new DB record event; a new message in Rabbit event, etc.,) , you'd simply use the respective out-of-the-box applications and then launch the task via the Task Launcher. 如果您打算从上游事件(例如,新文件事件,新数据库记录事件,Rabbit事件中的新消息等)启动任务应用程序,则只需使用相应的-box应用程序 ,然后通过任务启动器启动任务。
Follow this example on how the 3-steps are orchestrated via SCDF's DSL. 按照此示例 ,了解如何通过SCDF的DSL编排3个步骤。
Perhaps you could consider reusing the existing apps instead of reinventing them unless you have got a completely different requirement and that these apps cannot meet it. 除非您有完全不同的要求并且这些应用程序无法满足要求,否则您也许可以考虑重用现有应用程序而不是重新发明它们。 I'd suggest trying to get the example mentioned above working locally before you consider extending the behavior.
我建议在考虑扩展行为之前尝试使上述示例在本地运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.