0

I learn Spring Cloud Task and I write simple application that is divided into 3 services. 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.

@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?

user
  • 4,410
  • 16
  • 57
  • 83

1 Answers1

1

If you intend to launch a task application from an upstream event (e.g., 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.

Follow this example on how the 3-steps are orchestrated via SCDF's DSL.

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.

Sabby Anandan
  • 5,636
  • 2
  • 12
  • 21