use of org.springframework.integration.file.tail.FileTailingMessageProducerSupport in project spring-integration by spring-projects.
the class FileTailInboundChannelAdapterFactoryBean method createInstance.
@Override
protected FileTailingMessageProducerSupport createInstance() throws Exception {
FileTailingMessageProducerSupport adapter;
if (this.delay == null && this.end == null && this.reopen == null) {
adapter = new OSDelegatingFileTailingMessageProducer();
((OSDelegatingFileTailingMessageProducer) adapter).setEnableStatusReader(this.enableStatusReader);
if (this.nativeOptions != null) {
((OSDelegatingFileTailingMessageProducer) adapter).setOptions(this.nativeOptions);
}
} else {
Assert.isTrue(this.nativeOptions == null, "'native-options' is not allowed with 'delay', 'end', or 'reopen'");
adapter = new ApacheCommonsFileTailingMessageProducer();
if (this.delay != null) {
((ApacheCommonsFileTailingMessageProducer) adapter).setPollingDelay(this.delay);
}
if (this.end != null) {
((ApacheCommonsFileTailingMessageProducer) adapter).setEnd(this.end);
}
if (this.reopen != null) {
((ApacheCommonsFileTailingMessageProducer) adapter).setReopen(this.reopen);
}
}
adapter.setFile(this.file);
if (this.taskExecutor != null) {
adapter.setTaskExecutor(this.taskExecutor);
}
if (this.taskScheduler != null) {
adapter.setTaskScheduler(this.taskScheduler);
}
if (this.fileDelay != null) {
adapter.setTailAttemptsDelay(this.fileDelay);
}
if (this.idleEventInterval != null) {
adapter.setIdleEventInterval(this.idleEventInterval);
}
adapter.setOutputChannel(this.outputChannel);
adapter.setErrorChannel(this.errorChannel);
adapter.setBeanName(this.beanName);
if (this.autoStartup != null) {
adapter.setAutoStartup(this.autoStartup);
}
if (this.phase != null) {
adapter.setPhase(this.phase);
}
if (this.applicationEventPublisher != null) {
adapter.setApplicationEventPublisher(this.applicationEventPublisher);
}
if (getBeanFactory() != null) {
adapter.setBeanFactory(getBeanFactory());
}
adapter.afterPropertiesSet();
this.adapter = adapter;
return adapter;
}
use of org.springframework.integration.file.tail.FileTailingMessageProducerSupport in project spring-integration by spring-projects.
the class TailAdapterSpec method doGet.
@Override
protected FileTailingMessageProducerSupport doGet() {
if (this.outputChannel == null) {
this.factoryBean.setOutputChannel(new NullChannel());
}
FileTailingMessageProducerSupport tailingMessageProducerSupport = null;
try {
this.factoryBean.afterPropertiesSet();
tailingMessageProducerSupport = this.factoryBean.getObject();
} catch (Exception e) {
throw new IllegalStateException(e);
}
if (this.errorChannel != null) {
tailingMessageProducerSupport.setErrorChannel(this.errorChannel);
}
tailingMessageProducerSupport.setOutputChannel(this.outputChannel);
return tailingMessageProducerSupport;
}
Aggregations