List of usage examples for org.springframework.integration.endpoint EventDrivenConsumer afterPropertiesSet
@Override public final void afterPropertiesSet()
From source file:io.jmnarloch.spring.cloud.stream.binder.hermes.HermesClientBinder.java
private EventDrivenConsumer createConsumer(String name, SubscribableChannel channel, MessageHandler handler) { EventDrivenConsumer consumer = new EventDrivenConsumer(channel, handler); consumer.setBeanFactory(getBeanFactory()); consumer.setBeanName(String.format(BEAN_NAME_TEMPLATE, name)); consumer.afterPropertiesSet(); return consumer; }
From source file:org.springframework.integration.handler.AsyncHandlerTests.java
@Test public void testGateway() throws Exception { this.whichTest = 0; GatewayProxyFactoryBean gpfb = new GatewayProxyFactoryBean(Foo.class); gpfb.setBeanFactory(mock(BeanFactory.class)); DirectChannel input = new DirectChannel(); gpfb.setDefaultRequestChannel(input); gpfb.setDefaultReplyTimeout(10000L); gpfb.afterPropertiesSet();/* w w w. ja v a 2 s .c om*/ Foo foo = (Foo) gpfb.getObject(); this.handler.setOutputChannel(null); EventDrivenConsumer consumer = new EventDrivenConsumer(input, this.handler); consumer.afterPropertiesSet(); consumer.start(); this.latch.countDown(); String result = foo.exchange("foo"); assertEquals("reply", result); }
From source file:org.springframework.integration.handler.AsyncHandlerTests.java
@Test public void testGatewayWithException() throws Exception { this.whichTest = 0; GatewayProxyFactoryBean gpfb = new GatewayProxyFactoryBean(Foo.class); gpfb.setBeanFactory(mock(BeanFactory.class)); DirectChannel input = new DirectChannel(); gpfb.setDefaultRequestChannel(input); gpfb.setDefaultReplyTimeout(10000L); gpfb.afterPropertiesSet();/*w w w. j a va 2 s . co m*/ Foo foo = (Foo) gpfb.getObject(); this.handler.setOutputChannel(null); EventDrivenConsumer consumer = new EventDrivenConsumer(input, this.handler); consumer.afterPropertiesSet(); consumer.start(); this.latch.countDown(); try { foo.exchange("foo"); } catch (MessagingException e) { assertThat(e.getClass().getSimpleName(), equalTo("RuntimeException")); assertThat(e.getMessage(), equalTo("foo")); } }
From source file:org.springframework.integration.x.gemfire.GemFireMessageBus.java
private void doRegisterProducer(final String name, MessageChannel moduleOutputChannel, MessageHandler handler) { Assert.isInstanceOf(SubscribableChannel.class, moduleOutputChannel); EventDrivenConsumer consumer = new EventDrivenConsumer((SubscribableChannel) moduleOutputChannel, handler); consumer.setBeanName("outbound." + name); consumer.afterPropertiesSet(); addBinding(Binding.forProducer(moduleOutputChannel, consumer)); consumer.start();//from w w w. ja v a2s .c om }
From source file:org.springframework.integration.x.rabbit.RabbitChannelRegistry.java
@Override public void createOutbound(final String name, MessageChannel moduleOutputChannel, boolean aliasHint) { Assert.isInstanceOf(SubscribableChannel.class, moduleOutputChannel); MessageHandler handler = new CompositeHandler(name); EventDrivenConsumer consumer = new EventDrivenConsumer((SubscribableChannel) moduleOutputChannel, handler); consumer.setBeanName("outbound." + name); consumer.afterPropertiesSet(); this.lifecycleBeans.add(consumer); consumer.start();// w ww.j a v a2s . co m }
From source file:org.springframework.integration.x.rabbit.RabbitMessageBus.java
private void doRegisterProducer(final String name, MessageChannel moduleOutputChannel, MessageHandler delegate, String replyTo) {/*from w ww. j a v a 2 s . co m*/ Assert.isInstanceOf(SubscribableChannel.class, moduleOutputChannel); MessageHandler handler = new SendingHandler(delegate, replyTo); EventDrivenConsumer consumer = new EventDrivenConsumer((SubscribableChannel) moduleOutputChannel, handler); consumer.setBeanName("outbound." + name); consumer.afterPropertiesSet(); addBinding(Binding.forProducer(moduleOutputChannel, consumer)); consumer.start(); }
From source file:org.springframework.integration.x.redis.RedisChannelRegistry.java
@Override public void outbound(final String name, MessageChannel channel) { Assert.isInstanceOf(SubscribableChannel.class, channel); MessageHandler handler = new CompositeHandler(name, this.redisTemplate.getConnectionFactory()); EventDrivenConsumer consumer = new EventDrivenConsumer((SubscribableChannel) channel, handler); consumer.setBeanName("outbound." + name); consumer.afterPropertiesSet(); this.lifecycleBeans.add(consumer); consumer.start();// w w w. j a va 2s . c om }
From source file:org.springframework.xd.dirt.integration.bus.MessageBusSupport.java
private void bindProducerDirectly(String name, SubscribableChannel producerChannel, MessageChannel consumerChannel, AbstractBusPropertiesAccessor properties) { DirectHandler handler = new DirectHandler(consumerChannel); EventDrivenConsumer consumer = new EventDrivenConsumer(producerChannel, handler); consumer.setBeanFactory(getBeanFactory()); consumer.setBeanName("outbound." + name); consumer.afterPropertiesSet(); Binding binding = Binding.forDirectProducer(name, producerChannel, consumer, properties); addBinding(binding);//from w w w . j av a 2 s. c o m binding.start(); if (logger.isInfoEnabled()) { logger.info("Producer bound directly: " + binding); } }
From source file:org.springframework.xd.dirt.integration.rabbit.RabbitMessageBus.java
private void doRegisterProducer(final String name, MessageChannel moduleOutputChannel, AmqpOutboundEndpoint delegate, String replyTo, RabbitPropertiesAccessor properties) { Assert.isInstanceOf(SubscribableChannel.class, moduleOutputChannel); MessageHandler handler = new SendingHandler(delegate, replyTo, properties); EventDrivenConsumer consumer = new EventDrivenConsumer((SubscribableChannel) moduleOutputChannel, handler); consumer.setBeanFactory(getBeanFactory()); consumer.setBeanName("outbound." + name); consumer.afterPropertiesSet(); Binding producerBinding = Binding.forProducer(name, moduleOutputChannel, consumer, properties); addBinding(producerBinding);//from w ww . j av a2 s.com producerBinding.start(); }