@Bean public ConsumerEndpointFactoryBean echo2() throws Exception { ConsumerEndpointFactoryBean factory = new ConsumerEndpointFactoryBean(); factory.setHandler(handler2()); factory.setInputChannel(pubSub()); return factory; }
@Override public S poller(PollerMetadata pollerMetadata) { this.endpointFactoryBean.setPollerMetadata(pollerMetadata); return _this(); }
@Override protected Tuple2<ConsumerEndpointFactoryBean, H> doGet() { this.endpointFactoryBean.setAdviceChain(this.adviceChain); if (this.handler instanceof AbstractReplyProducingMessageHandler && !this.adviceChain.isEmpty()) { ((AbstractReplyProducingMessageHandler) this.handler).setAdviceChain(this.adviceChain); } this.endpointFactoryBean.setHandler(this.handler); return super.doGet(); }
}; ConsumerEndpointFactoryBean endpointFactoryBean = new ConsumerEndpointFactoryBean(); endpointFactoryBean.setBeanFactory(mock(ConfigurableBeanFactory.class)); endpointFactoryBean.setInputChannel(testChannel); endpointFactoryBean.setHandler(messageHandler); endpointFactoryBean.setBeanName("reactiveConsumer"); endpointFactoryBean.afterPropertiesSet(); endpointFactoryBean.start(); endpointFactoryBean.stop(); endpointFactoryBean.start();
ConsumerEndpointFactoryBean cefb = new ConsumerEndpointFactoryBean(); cefb.setBeanName(bridgeName); cefb.setInputChannel(from); cefb.setHandler(handler); cefb.setBeanFactory(getBeanFactory()); if (from instanceof PollableChannel) { cefb.setPollerMetadata(poller); cefb.afterPropertiesSet(); cefb.getObject().setComponentName(handler.getComponentName()); Binding binding = isInbound ? Binding.forConsumer(name, cefb.getObject(), to, properties) : Binding.forProducer(name, from, cefb.getObject(), properties); addBinding(binding); binding.start();
handler.setOutputChannel(inputChannel); handler.afterPropertiesSet(); ConsumerEndpointFactoryBean bridgeFactoryBean = new ConsumerEndpointFactoryBean(); bridgeFactoryBean.setInputChannel(previousOutputChannel); bridgeFactoryBean.setHandler(handler); try { bridgeFactoryBean.setBeanFactory(this.context.getBeanFactory()); bridgeFactoryBean.afterPropertiesSet(); AbstractEndpoint endpoint = bridgeFactoryBean.getObject(); endpoints.add(endpoint); this.context.getBeanFactory().registerSingleton("bridge-" + i, endpoint);
@SuppressWarnings("unchecked") private <S extends ConsumerEndpointSpec<S, ? extends MessageHandler>> B register(S endpointSpec, Consumer<S> endpointConfigurer) { if (endpointConfigurer != null) { endpointConfigurer.accept(endpointSpec); } MessageChannel inputChannel = this.currentMessageChannel; this.currentMessageChannel = null; if (inputChannel == null) { inputChannel = new DirectChannel(); this.registerOutputChannelIfCan(inputChannel); } Tuple2<ConsumerEndpointFactoryBean, ? extends MessageHandler> factoryBeanTuple2 = endpointSpec.get(); addComponents(endpointSpec.getComponentsToRegister()); if (inputChannel instanceof MessageChannelReference) { factoryBeanTuple2.getT1().setInputChannelName(((MessageChannelReference) inputChannel).getName()); } else { if (inputChannel instanceof FixedSubscriberChannelPrototype) { String beanName = ((FixedSubscriberChannelPrototype) inputChannel).getName(); inputChannel = new FixedSubscriberChannel(factoryBeanTuple2.getT2()); if (beanName != null) { ((FixedSubscriberChannel) inputChannel).setBeanName(beanName); } registerOutputChannelIfCan(inputChannel); } factoryBeanTuple2.getT1().setInputChannel(inputChannel); } return addComponent(endpointSpec).currentComponent(factoryBeanTuple2.getT2()); }
@Override public Tuple2<ConsumerEndpointFactoryBean, BarrierMessageHandler> doGet() { BarrierMessageHandler barrierMessageHandler = new BarrierMessageHandler(this.timeout, this.outputProcessor, this.correlationStrategy); barrierMessageHandler.setAdviceChain(this.adviceChain); barrierMessageHandler.setRequiresReply(this.requiresReply); barrierMessageHandler.setSendTimeout(this.sendTimeout); barrierMessageHandler.setAsync(this.async); barrierMessageHandler.setOrder(this.order); this.endpointFactoryBean.setHandler(barrierMessageHandler); return Tuples.of(this.endpointFactoryBean, barrierMessageHandler); }
@Override public S phase(int phase) { this.endpointFactoryBean.setPhase(phase); return _this(); }
@Override public S autoStartup(boolean autoStartup) { this.endpointFactoryBean.setAutoStartup(autoStartup); return _this(); }
@Override public AbstractEndpoint getObject() throws Exception { if (!this.initialized) { this.initializeEndpoint(); } return this.endpoint; }
@SuppressWarnings("unchecked") private <S extends ConsumerEndpointSpec<S, ? extends MessageHandler>> B register(S endpointSpec, Consumer<S> endpointConfigurer) { if (endpointConfigurer != null) { endpointConfigurer.accept(endpointSpec); } MessageChannel inputChannel = this.currentMessageChannel; this.currentMessageChannel = null; if (inputChannel == null) { inputChannel = new DirectChannel(); this.registerOutputChannelIfCan(inputChannel); } Tuple2<ConsumerEndpointFactoryBean, ? extends MessageHandler> factoryBeanTuple2 = endpointSpec.get(); addComponents(endpointSpec.getComponentsToRegister()); if (inputChannel instanceof MessageChannelReference) { factoryBeanTuple2.getT1().setInputChannelName(((MessageChannelReference) inputChannel).getName()); } else { if (inputChannel instanceof FixedSubscriberChannelPrototype) { String beanName = ((FixedSubscriberChannelPrototype) inputChannel).getName(); inputChannel = new FixedSubscriberChannel(factoryBeanTuple2.getT2()); if (beanName != null) { ((FixedSubscriberChannel) inputChannel).setBeanName(beanName); } registerOutputChannelIfCan(inputChannel); } factoryBeanTuple2.getT1().setInputChannel(inputChannel); } return addComponent(endpointSpec).currentComponent(factoryBeanTuple2.getT2()); }
@Override public Tuple2<ConsumerEndpointFactoryBean, BarrierMessageHandler> doGet() { BarrierMessageHandler barrierMessageHandler = new BarrierMessageHandler(this.timeout, this.outputProcessor, this.correlationStrategy); barrierMessageHandler.setAdviceChain(this.adviceChain); barrierMessageHandler.setRequiresReply(this.requiresReply); barrierMessageHandler.setSendTimeout(this.sendTimeout); barrierMessageHandler.setAsync(this.async); barrierMessageHandler.setOrder(this.order); this.endpointFactoryBean.setHandler(barrierMessageHandler); return Tuples.of(this.endpointFactoryBean, barrierMessageHandler); }
@Override public S phase(int phase) { this.endpointFactoryBean.setPhase(phase); return _this(); }
@Override public S autoStartup(boolean autoStartup) { this.endpointFactoryBean.setAutoStartup(autoStartup); return _this(); }
this.channelResolver = new BeanFactoryMessageChannelDestinationResolver(this.beanFactory); initializeEndpoint();
@Bean public ConsumerEndpointFactoryBean echo1() throws Exception { ConsumerEndpointFactoryBean factory = new ConsumerEndpointFactoryBean(); factory.setHandler(handler1()); factory.setInputChannel(in()); return factory; }
protected ConsumerEndpointSpec(H messageHandler) { super(messageHandler); if (messageHandler != null) { this.endpointFactoryBean.setHandler(messageHandler); } this.endpointFactoryBean.setAdviceChain(this.adviceChain); if (messageHandler instanceof AbstractReplyProducingMessageHandler) { ((AbstractReplyProducingMessageHandler) messageHandler).setAdviceChain(this.adviceChain); } }
private <S extends ConsumerEndpointSpec<S, ? extends MessageHandler>> B register(S endpointSpec, Consumer<S> endpointConfigurer) { if (endpointConfigurer != null) { endpointConfigurer.accept(endpointSpec); } addComponents(endpointSpec.getComponentsToRegister()); MessageChannel inputChannel = this.currentMessageChannel; this.currentMessageChannel = null; if (inputChannel == null) { inputChannel = new DirectChannel(); this.registerOutputChannelIfCan(inputChannel); } Tuple2<ConsumerEndpointFactoryBean, ? extends MessageHandler> factoryBeanTuple2 = endpointSpec.get(); if (inputChannel instanceof MessageChannelReference) { factoryBeanTuple2.getT1().setInputChannelName(((MessageChannelReference) inputChannel).getName()); } else { if (inputChannel instanceof FixedSubscriberChannelPrototype) { String beanName = ((FixedSubscriberChannelPrototype) inputChannel).getName(); inputChannel = new FixedSubscriberChannel(factoryBeanTuple2.getT2()); if (beanName != null) { ((FixedSubscriberChannel) inputChannel).setBeanName(beanName); } registerOutputChannelIfCan(inputChannel); } factoryBeanTuple2.getT1().setInputChannel(inputChannel); } return addComponent(endpointSpec).currentComponent(factoryBeanTuple2.getT2()); }
@Override public S poller(PollerMetadata pollerMetadata) { this.endpointFactoryBean.setPollerMetadata(pollerMetadata); return _this(); }