When reading this documentation, it seems that we can write a microservice with @EnableTask
that has a source whose emitted messages are recorded as an execution step by spring-cloud-task
.
I would like to have several clarifications about this statement in order to achieve this without spring-cloud-dataflow
:
Source
bean with an InboundChannelAdapter
, we don't need to declare a CommandLineRunner
?Source
polled on a regular interval?spring-boot
application some configurations with @EnableTask
and a AggregateApplicationBuilder
to directly connect my Source
to a Sink
without the need to leverage Kafka
or RabbitMQ
, but it seems spring-cloud-task
requires a binder. Is there a way to skip it?Thanks
What's available today is the ability to listen to task's lifecycle events and publish them to a named (overridable) channel destinations for downstream analysis/processing. This is simply automated just by having the particular Spring Cloud Stream's binder implementation in the classpath.
Does it mean that if we have a Source bean with an InboundChannelAdapter, we don't need to declare a CommandLineRunner?
It seems like you're trying to mix Spring Cloud Stream (SCSt) and Spring Cloud Task (SCT) annotations in your Boot app. That's not how it is intended to be used. If you haven't already, please see this sample to get an idea.
By definition a task is expected to emit data one time, how to reproduce this behavior with a Source polled on a regular interval?
A task runs for a "finite period of time" and that's described by how much longer your business logic embedded in the application runs. A task also requires some form of a trigger to get launched. You could use a scheduler for recurring-timed launches or kick it off via a stream. Here's the write-up on how you'd launch it by a stream in Spring Cloud Data Flow (SCDF).
If you're to do it outside of SCDF, you'd still run the triggertask
on your own and set the right env-var's, so the Stream + Task apps are connected via a common channel destination.
... but it seems spring-cloud-task requires a binder. Is there a way to skip it?
The connectivity between SCSt and SCT is done via the spring-cloud-task-stream
and spring-cloud-stream-binder-<type-of-binder>
dependencies and there are no other methods to it.