result = invocation.proceed(); if (result == null) { result = this.delegate.getInputChannel(); this.delegate.start(); break; Object[] arguments = invocation.getArguments(); if (!ObjectUtils.isEmpty(arguments)) { this.delegate.stop((Runnable) arguments[0]); this.delegate.stop(); result = this.delegate.isRunning(); result = this.delegate.isAutoStartup(); result = this.delegate.getPhase();
this.integrationFlow = new StandardIntegrationFlow(this.integrationComponents);
@Override public void stop(Runnable callback) { assertTargetIntegrationFlow(); if (this.running.getAndSet(false)) { this.targetIntegrationFlow.stop(callback); } else { callback.run(); } }
int subFlowNameIndex = 0; int channelNameIndex = 0; boolean registerSingleton = flow.isRegisterComponents(); List<Object> integrationComponents = new ArrayList<Object>(flow.getIntegrationComponents()); for (int i = 0; i < integrationComponents.size(); i++) { Object component = integrationComponents.get(i); flow.setIntegrationComponents(integrationComponents); return flow;
int channelNameIndex = 0; Map<Object, String> integrationComponents = flow.getIntegrationComponents(); Map<Object, String> targetIntegrationComponents = new LinkedHashMap<>(integrationComponents.size()); flow.setIntegrationComponents(targetIntegrationComponents); return flow;
@Override public void start() { assertTargetIntegrationFlow(); if (!this.running.getAndSet(true)) { this.targetIntegrationFlow.start(); } }
public MessageChannel getInputChannel() { if (this.inputChannel == null) { synchronized (this) { if (this.inputChannel == null) { if (this.integrationFlow instanceof StandardIntegrationFlow) { StandardIntegrationFlow integrationFlow = (StandardIntegrationFlow) this.integrationFlow; Object next = integrationFlow.getIntegrationComponents().iterator().next(); if (next instanceof MessageChannel) { this.inputChannel = (MessageChannel) next; } else { throw new IllegalStateException("The 'IntegrationFlow' [" + integrationFlow + "] " + "doesn't start with 'MessageChannel' for direct message sending."); } } else { throw new IllegalStateException("Only 'StandardIntegrationFlow' instances " + "(e.g. extracted from 'IntegrationFlow' Lambdas) can be used " + "for direct 'send' operation. " + "But [" + this.integrationFlow + "] ins't one of them.\n" + "Consider 'BeanFactory.getBean()' usage for sending messages " + "to the required 'MessageChannel'."); } } } } return this.inputChannel; }
@Override public MessageChannel getInputChannel() { assertTargetIntegrationFlow(); return this.targetIntegrationFlow.getInputChannel(); }
@Override public void stop() { assertTargetIntegrationFlow(); if (this.running.getAndSet(false)) { this.targetIntegrationFlow.stop(); } }
int subFlowNameIndex = 0; int channelNameIndex = 0; boolean registerSingleton = flow.isRegisterComponents(); List<Object> integrationComponents = new ArrayList<Object>(flow.getIntegrationComponents()); for (int i = 0; i < integrationComponents.size(); i++) { Object component = integrationComponents.get(i); flow.setIntegrationComponents(integrationComponents); return flow;
int channelNameIndex = 0; Map<Object, String> integrationComponents = flow.getIntegrationComponents(); Map<Object, String> targetIntegrationComponents = new LinkedHashMap<>(integrationComponents.size()); flow.setIntegrationComponents(targetIntegrationComponents); return flow;
@Override public void start() { assertTargetIntegrationFlow(); if (!this.running.getAndSet(true)) { this.targetIntegrationFlow.start(); } }
public MessageChannel getInputChannel() { if (this.inputChannel == null) { synchronized (this) { if (this.inputChannel == null) { if (this.integrationFlow instanceof StandardIntegrationFlow) { StandardIntegrationFlow integrationFlow = (StandardIntegrationFlow) this.integrationFlow; Object next = integrationFlow.getIntegrationComponents().iterator().next(); if (next instanceof MessageChannel) { this.inputChannel = (MessageChannel) next; } else { throw new IllegalStateException("The 'IntegrationFlow' [" + integrationFlow + "] " + "doesn't start with 'MessageChannel' for direct message sending."); } } else { throw new IllegalStateException("Only 'StandardIntegrationFlow' instances " + "(e.g. extracted from 'IntegrationFlow' Lambdas) can be used " + "for direct 'send' operation. " + "But [" + this.integrationFlow + "] ins't one of them.\n" + "Consider 'BeanFactory.getBean()' usage for sending messages " + "to the required 'MessageChannel'."); } } } } return this.inputChannel; }
@Override public MessageChannel getInputChannel() { assertTargetIntegrationFlow(); return this.targetIntegrationFlow.getInputChannel(); }
result = invocation.proceed(); if (result == null) { result = this.delegate.getInputChannel(); this.delegate.start(); break; Object[] arguments = invocation.getArguments(); if (!ObjectUtils.isEmpty(arguments)) { this.delegate.stop((Runnable) arguments[0]); this.delegate.stop(); result = this.delegate.isRunning(); result = this.delegate.isAutoStartup(); result = this.delegate.getPhase();
@Test public void testStreaming() throws Exception { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(StreamingConfig.class); StandardConfig config = ctx.getBean(StandardConfig.class); ctx.getBean(StandardIntegrationFlow.class).stop(); assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue(); List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList()); // there's an extra getSession() with this adapter in listFiles assertThat(sfCalls).containsExactly(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3); assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3); ctx.close(); }
@Override public void start() { assertTargetIntegrationFlow(); if (!this.running.getAndSet(true)) { this.targetIntegrationFlow.start(); } }
protected StandardIntegrationFlow get() { if (this.integrationFlow == null) { if (this.currentMessageChannel instanceof FixedSubscriberChannelPrototype) { throw new BeanCreationException("The 'currentMessageChannel' (" + this.currentMessageChannel + ") is a prototype for FixedSubscriberChannel which can't be created without MessageHandler " + "constructor argument. That means that '.fixedSubscriberChannel()' can't be the last " + "EIP-method in the IntegrationFlow definition."); } if (this.integrationComponents.size() == 1) { if (this.currentComponent != null) { if (this.currentComponent instanceof SourcePollingChannelAdapterSpec) { throw new BeanCreationException("The 'SourcePollingChannelAdapter' (" + this.currentComponent + ") " + "must be configured with at least one 'MessageChannel' or 'MessageHandler'."); } } else if (this.currentMessageChannel != null) { throw new BeanCreationException("The 'IntegrationFlow' can't consist of only one 'MessageChannel'. " + "Add at lest '.bridge()' EIP-method before the end of flow."); } } this.integrationFlow = new StandardIntegrationFlow(this.integrationComponents); } return this.integrationFlow; }
@Test public void testStandard() throws Exception { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(StandardConfig.class); StandardConfig config = ctx.getBean(StandardConfig.class); ctx.getBean(StandardIntegrationFlow.class).stop(); assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue(); List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList()); assertThat(sfCalls).containsExactly(1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1); File f1 = new File(tmpDir + File.separator + "standard" + File.separator + "f1"); assertThat(f1.exists()).isTrue(); File f2 = new File(tmpDir + File.separator + "standard" + File.separator + "f2"); assertThat(f2.exists()).isTrue(); File f3 = new File(tmpDir + File.separator + "standard" + File.separator + "f3"); assertThat(f3.exists()).isTrue(); assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3); ctx.close(); }
@Override public void start() { assertTargetIntegrationFlow(); if (!this.running.getAndSet(true)) { this.targetIntegrationFlow.start(); } }