public class LaunchRequestConsumer extends Object implements org.springframework.context.SmartLifecycle
LaunchRequest
s to a Data Flow
server. This polls a PollableMessageSource
only if the Data Flow server is not
at its concurrent task execution limit.
The consumer runs as a ScheduledFuture
, configured with a
DynamicPeriodicTrigger
to support exponential backoff up to a maximum period.
Every period cycle, the poller first makes a REST call to the Data Flow server to check
if it can accept a new task LaunchRequest before checking the Message source. The
polling period will back off (increase) when either the server is not accepting
requests or no request is received.
The period will revert to its initial value whenever both a request is received and the
DataFlow Server is accepting launch requests. The period remain at the maximum value
when there are no requests to avoid hammering the Data Flow server for no reason.Constructor and Description |
---|
LaunchRequestConsumer(org.springframework.cloud.stream.binder.PollableMessageSource input,
org.springframework.integration.util.DynamicPeriodicTrigger trigger,
long maxPeriod,
TaskLauncherFunction taskLauncherFunction) |
Modifier and Type | Method and Description |
---|---|
int |
getPhase() |
boolean |
isAutoStartup() |
boolean |
isPaused() |
boolean |
isRunning() |
void |
setAutoStartup(boolean autoStart) |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
public LaunchRequestConsumer(org.springframework.cloud.stream.binder.PollableMessageSource input, org.springframework.integration.util.DynamicPeriodicTrigger trigger, long maxPeriod, TaskLauncherFunction taskLauncherFunction)
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void setAutoStartup(boolean autoStart)
public void stop(Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public boolean isPaused()
public int getPhase()
getPhase
in interface org.springframework.context.Phased
getPhase
in interface org.springframework.context.SmartLifecycle
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.