@Override // guarded by super#lifecycleLock protected void doStart() { if (!this.initialized) { onInit(); } this.pollingTask = createPollingTask(); if (isReactive()) { this.pollingFlux = createFluxGenerator(); } else { Assert.state(getTaskScheduler() != null, "unable to start polling, no taskScheduler available"); this.runningTask = getTaskScheduler() .schedule(createPoller(), this.trigger); } }
if (!(this.taskExecutor instanceof ErrorHandlingTaskExecutor)) { if (this.errorHandler == null) { Assert.notNull(this.getBeanFactory(), "BeanFactory is required"); this.errorHandler = new MessagePublishingErrorHandler( new BeanFactoryChannelResolver(getBeanFactory())); this.errorHandlerIsDefault = true;
@SuppressWarnings("unchecked") private Callable<Message<?>> createPollingTask() { List<Advice> receiveOnlyAdviceChain = null; if (!CollectionUtils.isEmpty(this.adviceChain)) { receiveOnlyAdviceChain = this.adviceChain.stream() .filter(this::isReceiveOnlyAdvice) .collect(Collectors.toList()); } Callable<Message<?>> task = this::doPoll; List<Advice> advices = this.adviceChain; if (!CollectionUtils.isEmpty(advices)) { ProxyFactory proxyFactory = new ProxyFactory(task); if (!CollectionUtils.isEmpty(advices)) { advices.stream() .filter(advice -> !isReceiveOnlyAdvice(advice)) .forEach(proxyFactory::addAdvice); } task = (Callable<Message<?>>) proxyFactory.getProxy(this.beanClassLoader); } if (!CollectionUtils.isEmpty(receiveOnlyAdviceChain)) { applyReceiveOnlyAdviceChain(receiveOnlyAdviceChain); } return task; }
private Message<?> doPoll() { IntegrationResourceHolder holder = bindResourceHolderIfNecessary(getResourceKey(), getResourceToBind()); Message<?> message; try { message = receiveMessage(); if (!isReactive()) { try { handleMessage(message);
@Override // guarded by super#lifecycleLock protected void doStart() { if (!this.initialized) { this.onInit(); } Assert.state(this.getTaskScheduler() != null, "unable to start polling, no taskScheduler available"); this.runningTask = this.getTaskScheduler().schedule(this.poller, this.trigger); }
@Override protected void onInit() { synchronized (this.initializationMonitor) { if (this.initialized) { return; } Assert.notNull(this.trigger, "trigger is required"); if (this.transactionManager != null) { if (this.transactionDefinition == null) { this.transactionDefinition = new DefaultTransactionDefinition(); } this.transactionTemplate = new TransactionTemplate( this.transactionManager, this.transactionDefinition); } if (this.taskExecutor != null && !(this.taskExecutor instanceof ErrorHandlingTaskExecutor)) { if (this.errorHandler == null) { this.errorHandler = new MessagePublishingErrorHandler(new BeanFactoryChannelResolver(getBeanFactory())); } this.taskExecutor = new ErrorHandlingTaskExecutor(this.taskExecutor, this.errorHandler); } this.poller = this.createPoller(); this.initialized = true; } }
@Override protected void onInit() { Assert.notNull(this.source, "source must not be null"); Assert.state((this.outputChannelName == null && this.outputChannel != null) || (this.outputChannelName != null && this.outputChannel == null), "One and only one of 'outputChannelName' or 'outputChannel' is required."); super.onInit(); if (this.getBeanFactory() != null) { this.messagingTemplate.setBeanFactory(this.getBeanFactory()); } }
@Override protected void doStop() { if (this.handler instanceof Lifecycle) { ((Lifecycle) this.handler).stop(); } super.doStop(); }
@Override protected void doStart() { if (this.handler instanceof Lifecycle) { ((Lifecycle) this.handler).start(); } super.doStart(); }
private Message<?> doPoll() { IntegrationResourceHolder holder = bindResourceHolderIfNecessary(getResourceKey(), getResourceToBind()); Message<?> message; try { message = receiveMessage(); if (!isReactive()) { try { handleMessage(message);
private TransactionTemplate getTransactionTemplate() { if (!this.initialized) { this.onInit(); } return this.transactionTemplate; }
@Override protected void doStop() { super.doStop(); if (this.source instanceof Lifecycle) { ((Lifecycle) this.source).stop(); } }
@Override protected void doStart() { if (this.source instanceof Lifecycle) { ((Lifecycle) this.source).start(); } super.doStart(); if (isReactive()) { ((ReactiveStreamsSubscribableChannel) this.outputChannel).subscribeTo(getPollingFlux()); } }
@Override // guarded by super#lifecycleLock protected void doStart() { if (!this.initialized) { onInit(); } this.pollingTask = createPollingTask(); if (isReactive()) { this.pollingFlux = createFluxGenerator(); } else { Assert.state(getTaskScheduler() != null, "unable to start polling, no taskScheduler available"); this.runningTask = getTaskScheduler() .schedule(createPoller(), this.trigger); } }
@Override protected void onInit() { Assert.notNull(this.source, "source must not be null"); Assert.notNull(this.outputChannel, "outputChannel must not be null"); if (this.maxMessagesPerPoll < 0) { // the default is 1 since a source might return // a non-null value every time it is invoked this.setMaxMessagesPerPoll(1); } super.onInit(); }
@SuppressWarnings("unchecked") private Callable<Message<?>> createPollingTask() { List<Advice> receiveOnlyAdviceChain = null; if (!CollectionUtils.isEmpty(this.adviceChain)) { receiveOnlyAdviceChain = this.adviceChain.stream() .filter(this::isReceiveOnlyAdvice) .collect(Collectors.toList()); } Callable<Message<?>> task = this::doPoll; List<Advice> advices = this.adviceChain; if (!CollectionUtils.isEmpty(advices)) { ProxyFactory proxyFactory = new ProxyFactory(task); if (!CollectionUtils.isEmpty(advices)) { advices.stream() .filter(advice -> !isReceiveOnlyAdvice(advice)) .forEach(proxyFactory::addAdvice); } task = (Callable<Message<?>>) proxyFactory.getProxy(this.beanClassLoader); } if (!CollectionUtils.isEmpty(receiveOnlyAdviceChain)) { applyReceiveOnlyAdviceChain(receiveOnlyAdviceChain); } return task; }
if (!(this.taskExecutor instanceof ErrorHandlingTaskExecutor)) { if (this.errorHandler == null) { Assert.notNull(this.getBeanFactory(), "BeanFactory is required"); this.errorHandler = new MessagePublishingErrorHandler( new BeanFactoryChannelResolver(getBeanFactory())); this.errorHandlerIsDefault = true;
@Override protected void doStop() { super.doStop(); if (this.source instanceof Lifecycle) { ((Lifecycle) this.source).stop(); } }
@Override protected void doStart() { if (this.handler instanceof Lifecycle) { ((Lifecycle) this.handler).start(); } super.doStart(); }
@Override protected void onInit() { Assert.notNull(this.source, "source must not be null"); Assert.state((this.outputChannelName == null && this.outputChannel != null) || (this.outputChannelName != null && this.outputChannel == null), "One and only one of 'outputChannelName' or 'outputChannel' is required."); super.onInit(); if (this.getBeanFactory() != null) { this.messagingTemplate.setBeanFactory(this.getBeanFactory()); } }