INT-845 added StartupMode enum since polling consumers must not start as eagerly as event-driven consumers subscribe to their input channels
This commit is contained in:
@@ -41,6 +41,8 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport {
|
||||
|
||||
private final IdleTask idleTask = new IdleTask();
|
||||
|
||||
private volatile boolean autoStartup = true;
|
||||
|
||||
private volatile boolean shouldReconnectAutomatically = true;
|
||||
|
||||
private volatile TaskExecutor taskExecutor;
|
||||
@@ -63,6 +65,10 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport {
|
||||
this.shouldReconnectAutomatically = shouldReconnectAutomatically;
|
||||
}
|
||||
|
||||
public void setAutoStartup(boolean autoStartup) {
|
||||
this.autoStartup = autoStartup;
|
||||
}
|
||||
|
||||
public void setTaskExecutor(TaskExecutor taskExecutor) {
|
||||
this.taskExecutor = taskExecutor;
|
||||
}
|
||||
@@ -73,6 +79,16 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInit() {
|
||||
if (this.autoStartup) {
|
||||
this.setStartupMode(StartupMode.ON_CONTEXT_REFRESH);
|
||||
}
|
||||
else {
|
||||
this.setStartupMode(StartupMode.MANUAL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Lifecycle implementation
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user