Java Examples for org.springframework.integration.channel.DirectChannel
The following java examples will help you to understand the usage of org.springframework.integration.channel.DirectChannel. These source code samples are taken from different open source projects.
Example 1
| Project: spring-integration-flow-master File: FlowUtilsTests.java View source code |
@Test
public void buildBridge() {
SubscribableChannel inputChannel = new DirectChannel();
SubscribableChannel outputChannel = new PublishSubscribeChannel();
PollableChannel receiveChannel = new QueueChannel();
FlowUtils.bridgeChannels(inputChannel, outputChannel);
FlowUtils.bridgeChannels(outputChannel, receiveChannel);
Message<?> message = new GenericMessage<String>("hello");
inputChannel.send(message);
Message<?> result = receiveChannel.receive(100);
assertNotNull(result);
assertSame(message, result);
}Example 2
| Project: opencredo-esper-master File: UnmatchedListenerInboundChannelAdapterParserTest.java View source code |
@Test
public void sendAnEsperContextMessageAndAssertThatListenerIsInvoked() {
template = new EsperTemplate();
template.initialize();
template.sendEvent(new MessageContext(new DirectChannel(), "testSourceId"));
template.sendEvent("A simple string event object!");
assertEquals(1, listener.getNumberOfTimesInvoked());
assertEquals(1, unmatchedListener.getNumberOfTimesInvoked());
}Example 3
| Project: spring-boot-master File: SpringIntegrationCompilerAutoConfiguration.java View source code |
@Override
public void applyImports(ImportCustomizer imports) {
imports.addImports("org.springframework.messaging.Message", "org.springframework.messaging.MessageChannel", "org.springframework.messaging.PollableChannel", "org.springframework.messaging.SubscribableChannel", "org.springframework.messaging.MessageHeaders", "org.springframework.integration.support.MessageBuilder", "org.springframework.integration.channel.DirectChannel", "org.springframework.integration.channel.QueueChannel", "org.springframework.integration.channel.ExecutorChannel", "org.springframework.integration.core.MessagingTemplate", "org.springframework.integration.config.EnableIntegration");
imports.addStarImports("org.springframework.integration.annotation");
}Example 4
| Project: spring-integration-samples-master File: ApplicationTests.java View source code |
@Test
public void testWebSockets() throws InterruptedException {
System.setProperty("local.server.port", this.port);
ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("client-context.xml", org.springframework.integration.samples.websocket.standard.client.Application.class);
DirectChannel webSocketInputChannel = ctx.getBean("webSocketInputChannel", DirectChannel.class);
final CountDownLatch stopLatch = new CountDownLatch(2);
webSocketInputChannel.addInterceptor(new ChannelInterceptorAdapter() {
@Override
public void postSend(Message<?> message, MessageChannel channel, boolean sent) {
Object payload = message.getPayload();
assertThat(payload, instanceOf(String.class));
Date date = null;
try {
date = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.DEFAULT).parse((String) payload);
} catch (ParseException e) {
fail("fail to parse date");
}
assertThat(new Date().compareTo(date), greaterThanOrEqualTo(0));
stopLatch.countDown();
}
});
assertTrue(stopLatch.await(10, TimeUnit.SECONDS));
ctx.close();
}Example 5
| Project: camel-master File: SpringIntegrationProducer.java View source code |
@Override
protected void doStart() throws Exception {
super.doStart();
if (getEndpoint().getMessageChannel() == null) {
String outputChannelName = getEndpoint().getDefaultChannel();
if (ObjectHelper.isEmpty(outputChannelName)) {
outputChannelName = getEndpoint().getInputChannel();
}
ObjectHelper.notEmpty(outputChannelName, "OutputChannelName", getEndpoint());
outputChannel = destinationResolver.resolveDestination(outputChannelName);
} else {
outputChannel = getEndpoint().getMessageChannel();
}
if (outputChannel == null) {
throw new IllegalArgumentException("Cannot resolve OutputChannel on " + getEndpoint());
}
// if we do in-out we need to setup the input channel as well
if (getEndpoint().isInOut()) {
// we need to setup right inputChannel for further processing
ObjectHelper.notEmpty(getEndpoint().getInputChannel(), "InputChannel", getEndpoint());
inputChannel = (DirectChannel) destinationResolver.resolveDestination(getEndpoint().getInputChannel());
if (inputChannel == null) {
throw new IllegalArgumentException("Cannot resolve InputChannel on " + getEndpoint());
}
}
}Example 6
| Project: spring-cloud-stream-master File: StreamListenerHandlerMethodTests.java View source code |
@Test
public void testStreamListenerMethodWithTargetBeanFromOutside() throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(TestStreamListenerMethodWithTargetBeanFromOutside.class, "--server.port=0");
Sink sink = context.getBean(Sink.class);
final String testMessageToSend = "testing";
sink.input().send(MessageBuilder.withPayload(testMessageToSend).build());
DirectChannel directChannel = (DirectChannel) context.getBean(testMessageToSend.toUpperCase(), MessageChannel.class);
MessageCollector messageCollector = context.getBean(MessageCollector.class);
Message<?> result = messageCollector.forChannel(directChannel).poll(1000, TimeUnit.MILLISECONDS);
sink.input().send(MessageBuilder.withPayload(testMessageToSend).build());
assertThat(result).isNotNull();
assertThat(result.getPayload()).isEqualTo(testMessageToSend.toUpperCase());
context.close();
}Example 7
| Project: spring-integration-master File: IntegrationFlowDefinition.java View source code |
/**
* Populate the {@code Wire Tap} EI Pattern specific
* {@link org.springframework.messaging.support.ChannelInterceptor} implementation
* to the current {@link #currentMessageChannel}.
* <p> It is useful when an implicit {@link MessageChannel} is used between endpoints:
* <pre class="code">
* {@code
* .transform("payload")
* .wireTap(new WireTap(tapChannel().selector(m -> m.getPayload().equals("foo")))
* .channel("foo")
* }
* </pre>
* This method can be used after any {@link #channel} for explicit {@link MessageChannel},
* but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s.
* @param wireTapSpec the {@link WireTapSpec} to use.
* <p> When this EIP-method is used in the end of flow, it appends {@code nullChannel} to terminate flow properly,
* Otherwise {@code Dispatcher has no subscribers} exception is thrown for implicit {@link DirectChannel}.
* @return the current {@link IntegrationFlowDefinition}.
*/
public B wireTap(WireTapSpec wireTapSpec) {
WireTap interceptor = wireTapSpec.get();
if (this.currentMessageChannel == null || !(this.currentMessageChannel instanceof ChannelInterceptorAware)) {
this.implicitChannel = true;
channel(new DirectChannel());
}
addComponent(wireTapSpec);
((ChannelInterceptorAware) this.currentMessageChannel).addInterceptor(interceptor);
return _this();
}Example 8
| Project: spring-hadoop-master File: IntegrationAmServiceParser.java View source code |
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
boolean hasChannelAttribute = element.hasAttribute("channel");
if (!hasChannelAttribute) {
// service dispatch channel
BeanDefinitionBuilder defBuilder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
AbstractBeanDefinition beanDef = defBuilder.getBeanDefinition();
String channelBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, channelBeanName));
builder.addPropertyReference("channel", channelBeanName);
// serializer
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(MindRpcSerializer.class);
beanDef = defBuilder.getBeanDefinition();
String serializerBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, serializerBeanName));
// socket support
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(DefaultPortExposingTcpSocketSupport.class);
beanDef = defBuilder.getBeanDefinition();
String socketSupportBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, socketSupportBeanName));
builder.addPropertyReference("socketSupport", socketSupportBeanName);
// connection factory
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(TcpNetServerConnectionFactory.class);
String port = element.hasAttribute("default-port") ? element.getAttribute("default-port") : "0";
defBuilder.addConstructorArgValue(port);
defBuilder.addPropertyReference("tcpSocketSupport", socketSupportBeanName);
defBuilder.addPropertyReference("serializer", serializerBeanName);
defBuilder.addPropertyReference("deserializer", serializerBeanName);
beanDef = defBuilder.getBeanDefinition();
String connectionFactoryBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, connectionFactoryBeanName));
// gateway
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(TcpInboundGateway.class);
defBuilder.addPropertyReference("connectionFactory", connectionFactoryBeanName);
defBuilder.addPropertyReference("requestChannel", channelBeanName);
beanDef = defBuilder.getBeanDefinition();
String gatewayBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, gatewayBeanName));
builder.addPropertyReference("channel", channelBeanName);
} else {
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "channel");
}
YarnNamespaceUtils.setValueIfAttributeDefined(builder, element, "service-impl");
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "service-ref");
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "object-mapper");
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "socket-support");
}Example 9
| Project: spring-integration-java-dsl-master File: IntegrationFlowDefinition.java View source code |
/**
* Populate the {@code Wire Tap} EI Pattern specific
* {@link org.springframework.messaging.support.ChannelInterceptor} implementation
* to the current {@link #currentMessageChannel}.
* It is useful when an implicit {@link MessageChannel} is used between endpoints:
* <pre class="code">
* {@code
* .transform("payload")
* .wireTap(new WireTap(tapChannel().selector(m -> m.getPayload().equals("foo")))
* .channel("foo")
* }
* </pre>
* This method can be used after any {@link #channel} for explicit {@link MessageChannel},
* but with the caution do not impact existing {@link org.springframework.messaging.support.ChannelInterceptor}s.
* @param wireTapSpec the {@link WireTapSpec} to use.
* @return the current {@link IntegrationFlowDefinition}.
* @since 1.2
*/
public B wireTap(WireTapSpec wireTapSpec) {
WireTap interceptor = wireTapSpec.get();
if (this.currentMessageChannel == null || !(this.currentMessageChannel instanceof ChannelInterceptorAware)) {
channel(new DirectChannel());
}
addComponents(wireTapSpec.getComponentsToRegister());
((ChannelInterceptorAware) this.currentMessageChannel).addInterceptor(interceptor);
return _this();
}Example 10
| Project: spring-xd-master File: RabbitMessageBus.java View source code |
private void doRegisterConsumer(String name, MessageChannel moduleInputChannel, Queue queue, RabbitPropertiesAccessor properties, boolean isPubSub) {
// Fix for XD-2503
// Temporarily overrides the thread context classloader with the one where the SimpleMessageListenerContainer
// is defined
// This allows for the proxying that happens while initializing the SimpleMessageListenerContainer to work
// correctly
ClassLoader originalClassloader = Thread.currentThread().getContextClassLoader();
try {
ClassUtils.overrideThreadContextClassLoader(SimpleMessageListenerContainer.class.getClassLoader());
SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(this.connectionFactory);
listenerContainer.setAcknowledgeMode(properties.getAcknowledgeMode(this.defaultAcknowledgeMode));
listenerContainer.setChannelTransacted(properties.getTransacted(this.defaultChannelTransacted));
listenerContainer.setDefaultRequeueRejected(properties.getRequeueRejected(this.defaultDefaultRequeueRejected));
int concurrency = properties.getConcurrency(this.defaultConcurrency);
concurrency = concurrency > 0 ? concurrency : 1;
listenerContainer.setConcurrentConsumers(concurrency);
int maxConcurrency = properties.getMaxConcurrency(this.defaultMaxConcurrency);
if (maxConcurrency > concurrency) {
listenerContainer.setMaxConcurrentConsumers(maxConcurrency);
}
listenerContainer.setPrefetchCount(properties.getPrefetchCount(this.defaultPrefetchCount));
listenerContainer.setTxSize(properties.getTxSize(this.defaultTxSize));
listenerContainer.setTaskExecutor(new SimpleAsyncTaskExecutor(queue.getName() + "-"));
listenerContainer.setQueues(queue);
int maxAttempts = properties.getMaxAttempts(this.defaultMaxAttempts);
if (maxAttempts > 1 || properties.getRepublishToDLQ(this.defaultRepublishToDLQ)) {
RetryOperationsInterceptor retryInterceptor = RetryInterceptorBuilder.stateless().maxAttempts(maxAttempts).backOffOptions(properties.getBackOffInitialInterval(this.defaultBackOffInitialInterval), properties.getBackOffMultiplier(this.defaultBackOffMultiplier), properties.getBackOffMaxInterval(this.defaultBackOffMaxInterval)).recoverer(determineRecoverer(name, properties)).build();
listenerContainer.setAdviceChain(new Advice[] { retryInterceptor });
}
listenerContainer.setAfterReceivePostProcessors(this.decompressingPostProcessor);
listenerContainer.setMessagePropertiesConverter(this.inboundMessagePropertiesConverter);
listenerContainer.afterPropertiesSet();
AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(listenerContainer);
adapter.setBeanFactory(this.getBeanFactory());
DirectChannel bridgeToModuleChannel = new DirectChannel();
bridgeToModuleChannel.setBeanFactory(this.getBeanFactory());
bridgeToModuleChannel.setBeanName(name + ".bridge");
adapter.setOutputChannel(bridgeToModuleChannel);
adapter.setBeanName("inbound." + name);
DefaultAmqpHeaderMapper mapper = new DefaultAmqpHeaderMapper();
mapper.setRequestHeaderNames(properties.getRequestHeaderPattens(this.defaultRequestHeaderPatterns));
mapper.setReplyHeaderNames(properties.getReplyHeaderPattens(this.defaultReplyHeaderPatterns));
adapter.setHeaderMapper(mapper);
adapter.afterPropertiesSet();
Binding consumerBinding = Binding.forConsumer(name, adapter, moduleInputChannel, properties);
addBinding(consumerBinding);
ReceivingHandler convertingBridge = new ReceivingHandler();
convertingBridge.setOutputChannel(moduleInputChannel);
convertingBridge.setBeanName(name + ".convert.bridge");
convertingBridge.afterPropertiesSet();
bridgeToModuleChannel.subscribe(convertingBridge);
consumerBinding.start();
} finally {
Thread.currentThread().setContextClassLoader(originalClassloader);
}
}Example 11
| Project: miso-lims-master File: DefaultNotifier.java View source code |
public static void main(String[] args) {
log.info("Starting notification system...");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/notification.xml");
ChannelResolver channelResolver = new BeanFactoryChannelResolver(context);
NotificationUtils notificationUtils = new NotificationUtils();
File propsPath = new File(".", "notification.properties");
Properties props = new Properties();
try {
props.load(new FileReader(propsPath));
CompositeFileListFilter statusFilter = (CompositeFileListFilter) context.getBean("statusFilter");
Map<String, Set<File>> allDataPaths = new HashMap<String, Set<File>>();
for (String platformType : PlatformType.getKeys()) {
platformType = platformType.toLowerCase();
if (props.containsKey(platformType + ".splitterBatchSize")) {
notificationUtils.setSplitterBatchSize(Integer.parseInt(props.getProperty(platformType + ".splitterBatchSize")));
}
if (props.containsKey(platformType + ".dataPaths")) {
log.debug("Resolving " + platformType + ".dataPaths ...");
String dataPaths = props.getProperty(platformType + ".dataPaths");
Set<File> paths = new HashSet<File>();
for (String path : dataPaths.split(",")) {
File f = new File(path);
if (f.exists() && f.canRead() && f.isDirectory()) {
paths.add(f);
log.debug("Added " + path);
}
}
allDataPaths.put(platformType, paths);
if (platformType.equals("solid")) {
for (String key : props.stringPropertyNames()) {
if (key.startsWith("solid.wsdl.url.")) {
String serviceName = key.substring(key.lastIndexOf(".") + 1);
log.debug("Creating service: " + serviceName);
SolidServiceWrapper ssw = new SolidServiceWrapper(serviceName, URI.create(props.getProperty(key)).toURL());
context.getBeanFactory().registerSingleton(serviceName, ssw);
}
}
}
if (platformType.equals("pacbio")) {
for (String key : props.stringPropertyNames()) {
if (key.startsWith("pacbio.ws.url.")) {
String serviceName = key.substring(key.lastIndexOf(".") + 1);
log.debug("Creating service: " + serviceName);
PacBioServiceWrapper psw = new PacBioServiceWrapper(serviceName, URI.create(props.getProperty(key)));
context.getBeanFactory().registerSingleton(serviceName, psw);
}
}
}
RunFolderScanner rfs = (RunFolderScanner) context.getBean(platformType + "StatusRecursiveScanner");
MultiFileQueueMessageSource mfqms = new MultiFileQueueMessageSource();
mfqms.setBeanName(platformType + "MultiFileQueueMessageSource");
mfqms.setBeanFactory(context.getBeanFactory());
mfqms.setScanner(rfs);
mfqms.setFilter(statusFilter);
mfqms.setDirectories(paths);
//make sure all the directories are rescanned each poll
mfqms.setScanEachPoll(false);
mfqms.afterPropertiesSet();
SourcePollingChannelAdapter spca = new SourcePollingChannelAdapter();
spca.setBeanName(platformType + "StatusFileSource");
spca.setBeanFactory(context.getBeanFactory());
spca.setMaxMessagesPerPoll(1);
DynamicTrigger trigger;
if (props.containsKey(platformType + ".scanRate")) {
trigger = new DynamicTrigger(Integer.parseInt(props.getProperty(platformType + ".scanRate")), TimeUnit.MILLISECONDS);
} else {
trigger = new DynamicTrigger(600000, TimeUnit.MILLISECONDS);
}
trigger.setFixedRate(false);
spca.setTrigger(trigger);
spca.setSource(mfqms);
spca.setOutputChannel(channelResolver.resolveChannelName(platformType + "StatusFileInputChannel"));
spca.setAutoStartup(false);
spca.afterPropertiesSet();
DirectChannel outputChannel = (DirectChannel) channelResolver.resolveChannelName(platformType + "StatusChannel");
outputChannel.setBeanName(platformType + "StatusChannel");
outputChannel.setBeanFactory(context.getBeanFactory());
if (props.containsKey("wiretap.enabled") && "true".equals(props.get("wiretap.enabled"))) {
//set up wire tap
DirectChannel wireTapChannel = (DirectChannel) channelResolver.resolveChannelName("wireTapChannel");
wireTapChannel.setBeanName("wireTapChannel");
wireTapChannel.setBeanFactory(context.getBeanFactory());
LoggingHandler wireTapLogger = new LoggingHandler("TRACE");
wireTapLogger.setBeanName("OutputWireTapper");
wireTapLogger.setBeanFactory(context.getBeanFactory());
wireTapLogger.setLoggerName("wiretap");
wireTapLogger.setShouldLogFullMessage(true);
wireTapLogger.afterPropertiesSet();
wireTapChannel.subscribe(wireTapLogger);
List<ChannelInterceptor> ints = new ArrayList<ChannelInterceptor>();
WireTap wt = new WireTap(wireTapChannel);
ints.add(wt);
outputChannel.setInterceptors(ints);
}
DirectChannel signChannel = (DirectChannel) channelResolver.resolveChannelName(platformType + "MessageSignerChannel");
signChannel.setBeanFactory(context.getBeanFactory());
DirectChannel splitterChannel = (DirectChannel) channelResolver.resolveChannelName(platformType + "SplitterChannel");
splitterChannel.setBeanFactory(context.getBeanFactory());
if (props.containsKey(platformType + ".http.statusEndpointURIs")) {
log.debug("Resolving " + platformType + ".http.statusEndpointURIs ...");
String statusEndpointURIs = props.getProperty(platformType + ".http.statusEndpointURIs");
for (String uri : statusEndpointURIs.split(",")) {
//split into multiple messages
MethodInvokingSplitter mis = new MethodInvokingSplitter(notificationUtils, "splitMessage");
mis.setBeanName(platformType + "Splitter");
mis.setBeanFactory(context.getBeanFactory());
mis.setChannelResolver(channelResolver);
mis.setOutputChannel(signChannel);
splitterChannel.subscribe(mis);
//sign messages and inject url into message headers via HeaderEnricher
Map<String, SignedHeaderValueMessageProcessor<String>> urlHeaderToSign = new HashMap<String, SignedHeaderValueMessageProcessor<String>>();
URI su = URI.create(uri);
urlHeaderToSign.put("x-url", new SignedHeaderValueMessageProcessor<String>(su.getPath()));
urlHeaderToSign.put("x-user", new SignedHeaderValueMessageProcessor<String>("notification"));
NotificationMessageEnricher signer = new NotificationMessageEnricher(urlHeaderToSign);
signer.setMessageProcessor(new MethodInvokingMessageProcessor(notificationUtils, "signMessageHeaders"));
MessageTransformingHandler mth = new MessageTransformingHandler(signer);
mth.setBeanName(platformType + "Signer");
mth.setBeanFactory(context.getBeanFactory());
mth.setChannelResolver(channelResolver);
mth.setOutputChannel(outputChannel);
mth.setRequiresReply(false);
signChannel.subscribe(mth);
DefaultHttpHeaderMapper hm = new DefaultHttpHeaderMapper();
hm.setUserDefinedHeaderPrefix("");
String[] names = { "Accept", "x-url", "x-signature", "x-user" };
hm.setBeanFactory(context.getBeanFactory());
hm.setOutboundHeaderNames(names);
hm.setInboundHeaderNames(names);
HttpRequestExecutingMessageHandler statusNotifier = new HttpRequestExecutingMessageHandler(uri);
statusNotifier.setBeanName(platformType + "StatusNotifier");
statusNotifier.setBeanFactory(context.getBeanFactory());
statusNotifier.setChannelResolver(channelResolver);
statusNotifier.setHttpMethod(HttpMethod.POST);
statusNotifier.setCharset("UTF-8");
statusNotifier.setHeaderMapper(hm);
statusNotifier.setExtractPayload(true);
statusNotifier.setOrder(3);
statusNotifier.setRequiresReply(false);
statusNotifier.setExpectReply(false);
outputChannel.subscribe(statusNotifier);
}
}
if (props.containsKey(platformType + ".tcp.host") && props.containsKey(platformType + ".tcp.port")) {
String host = props.getProperty(platformType + ".tcp.host");
int port = Integer.parseInt(props.getProperty(platformType + ".tcp.port"));
TcpNetClientConnectionFactory tnccf = new TcpNetClientConnectionFactory(host, port);
tnccf.setSoTimeout(10000);
tnccf.setSingleUse(true);
TcpOutboundGateway tog = new TcpOutboundGateway();
tog.setBeanName(platformType + "StatusNotifier");
tog.setBeanFactory(context.getBeanFactory());
tog.setChannelResolver(channelResolver);
tog.setConnectionFactory(tnccf);
tog.setRequestTimeout(10000);
tog.setRequiresReply(false);
tog.setOutputChannel(outputChannel);
outputChannel.subscribe(tog);
}
if ((!props.containsKey(platformType + ".tcp.host") || !props.containsKey(platformType + ".tcp.port")) && !props.containsKey(platformType + ".http.statusEndpointURIs")) {
log.error("You have specified a list of paths to scan, but no valid endpoint to notify. Please add a <platform>.http.statusEndpointURIs property and/or <platform>.tcp.host/port properties in notification.properties");
} else {
spca.start();
}
} else {
log.warn("You have not specified a list of " + platformType + " paths to scan. Please add a " + platformType.toLowerCase() + ".dataPaths property in notification.properties if you wish to track this platform");
}
NotificationRequestManager nrm = (NotificationRequestManager) context.getBean("notificationRequestManager");
nrm.setApplicationContext(context);
nrm.setDataPaths(allDataPaths);
}
} catch (FileNotFoundException e) {
log.error("Cannot find a notification.properties file in the same directory as the notification jar. Please add one");
} catch (IOException e) {
log.error("Cannot read notification.properties. Please check permissions/availability");
} catch (Exception e) {
log.error("Something else went wrong:" + e.getMessage());
}
}Example 12
| Project: spring-bus-master File: MessageBusAdapter.java View source code |
/**
* Creates a wiretap on the output channel and binds the tap channel to
* {@link MessageBus}'s message target.
*
* @param tapChannelName the name of the tap channel
* @param localName the channel to tap
*/
private void createAndBindTapChannel(String tapChannelName, String localName) {
logger.info("creating and binding tap channel for {}", tapChannelName);
MessageChannel channel = this.channelResolver.resolveDestination(localName);
if (channel instanceof ChannelInterceptorAware) {
DirectChannel tapChannel = new DirectChannel();
tapChannel.setBeanName(tapChannelName + ".tap.bridge");
// TODO
this.messageBus.bindPubSubProducer(// TODO
tapChannelName, // TODO
tapChannel, // TODO
null);
// tap
// producer
// props
tapOutputChannel(tapChannel, (ChannelInterceptorAware) channel);
} else {
if (logger.isDebugEnabled()) {
logger.debug("output channel is not interceptor aware. Tap will not be created.");
}
}
}Example 13
| Project: mbit-cloud-platform-master File: RedisMessageBus.java View source code |
private void doRegisterConsumer(String bindingName, String channelName, MessageChannel moduleInputChannel, MessageProducerSupport adapter, RedisPropertiesAccessor properties) {
DirectChannel bridgeToModuleChannel = new DirectChannel();
bridgeToModuleChannel.setBeanFactory(this.getBeanFactory());
bridgeToModuleChannel.setBeanName(channelName + ".bridge");
MessageChannel bridgeInputChannel = addRetryIfNeeded(channelName, bridgeToModuleChannel, properties);
adapter.setOutputChannel(bridgeInputChannel);
adapter.setBeanName("inbound." + bindingName);
adapter.afterPropertiesSet();
Binding consumerBinding = Binding.forConsumer(bindingName, adapter, moduleInputChannel, properties);
addBinding(consumerBinding);
ReceivingHandler convertingBridge = new ReceivingHandler();
convertingBridge.setOutputChannel(moduleInputChannel);
convertingBridge.setBeanName(channelName + ".bridge.handler");
convertingBridge.afterPropertiesSet();
bridgeToModuleChannel.subscribe(convertingBridge);
consumerBinding.start();
}Example 14
| Project: spring-integration-eventbus-master File: EventBusConfig.java View source code |
@Bean
public MessageChannel eventBusInputChannel() {
return new DirectChannel();
}Example 15
| Project: spring-xd-samples-master File: ModuleConfiguration.java View source code |
@Bean
MessageChannel input() {
return new DirectChannel();
}Example 16
| Project: scratches-master File: JmsRequestReply.java View source code |
@Bean
public MessageChannel requests() {
return new DirectChannel();
}Example 17
| Project: SIA-master File: MessagingConfig.java View source code |
@Bean
public MessageChannel amqpOutboundChannel() {
return new DirectChannel();
}Example 18
| Project: spring-xd-modules-master File: XsltTransformerModuleConfig.java View source code |
@Bean
public MessageChannel input() {
return new DirectChannel();
}Example 19
| Project: techtips-master File: Application.java View source code |
@Bean(name = "webSocketFlow.input")
MessageChannel requestChannel() {
return new DirectChannel();
}Example 20
| Project: building-microservices-master File: WebSocketIntegration.java View source code |
@Bean(name = "webSocketFlow.input")
public MessageChannel requestChannel() {
return new DirectChannel();
}Example 21
| Project: cloudfoundry-ftp-service-broker-master File: FtpServerProvisionerClientAutoConfiguration.java View source code |
@Bean(name = PROVISION_REQUESTS_CHANNEL_NAME)
@ConditionalOnMissingBean(value = MessageChannel.class, name = PROVISION_REQUESTS_CHANNEL_NAME)
MessageChannel provisionFtpRequestsChannel() {
return new DirectChannel();
}Example 22
| Project: SpringBatchWebinar-master File: IntegrationConfiguration.java View source code |
@Bean protected DirectChannel twitterChannel() { return new DirectChannel(); }
Example 23
| Project: sample-membership-master File: Membership.java View source code |
@Bean public DirectChannel inputChannel() { return new DirectChannel(); }
Example 24
| Project: spring-cloud-bus-master File: BusAutoConfigurationTests.java View source code |
@PostConstruct
public void init() {
((DirectChannel) this.cloudBusOutboundChannel).addInterceptor(interceptor());
}Example 25
| Project: spring-cloud-stream-modules-master File: CassandraSinkConfiguration.java View source code |
@Bean
public MessageChannel toSink() {
return new DirectChannel();
}