private MessageProducerNode producerNode(String name, MessageProducerSupport producer) { String errorChannel = producer.getErrorChannel() != null ? producer.getErrorChannel().toString() : null; String outputChannel = producer.getOutputChannel() != null ? producer.getOutputChannel().toString() : null; return new MessageProducerNode(this.nodeId.incrementAndGet(), name, producer, outputChannel, errorChannel); }
private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer, @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) { IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg; MessageChannel outputChannel = messageProducer.getOutputChannel(); if (outputChannel == null) { outputChannel = new DirectChannel(); messageProducer.setOutputChannel(outputChannel); } if (integrationFlowBuilder == null) { integrationFlowBuilder = from(outputChannel); } else { integrationFlowBuilder.channel(outputChannel); } return integrationFlowBuilder.addComponent(messageProducer); }
protected void sendMessage(Message<?> messageArg) { Message<?> message = messageArg; if (message == null) { throw new MessagingException("cannot send a null message"); } if (this.shouldTrack) { message = MessageHistory.write(message, this, this.getMessageBuilderFactory()); } try { this.messagingTemplate.send(getOutputChannel(), message); } catch (RuntimeException e) { if (!sendErrorMessageIfNecessary(message, e)) { throw e; } } }
@Test public void testWithChannelName() { DirectChannel outChannel = new DirectChannel(); MessageProducerSupport mps = new MessageProducerSupport() { }; mps.setOutputChannelName("foo"); this.context.registerBean("foo", outChannel); this.context.refresh(); mps.setBeanFactory(this.context); mps.afterPropertiesSet(); mps.start(); assertSame(outChannel, mps.getOutputChannel()); }
private MessageProducerNode producerNode(String name, MessageProducerSupport producer) { String errorChannel = producer.getErrorChannel() != null ? producer.getErrorChannel().toString() : null; String outputChannel = producer.getOutputChannel() != null ? producer.getOutputChannel().toString() : null; return new MessageProducerNode(this.nodeId.incrementAndGet(), name, producer, outputChannel, errorChannel); }
private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer, @Nullable IntegrationFlowBuilder integrationFlowBuilderArg) { IntegrationFlowBuilder integrationFlowBuilder = integrationFlowBuilderArg; MessageChannel outputChannel = messageProducer.getOutputChannel(); if (outputChannel == null) { outputChannel = new DirectChannel(); messageProducer.setOutputChannel(outputChannel); } if (integrationFlowBuilder == null) { integrationFlowBuilder = from(outputChannel); } else { integrationFlowBuilder.channel(outputChannel); } return integrationFlowBuilder.addComponent(messageProducer); }
private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer, IntegrationFlowBuilder integrationFlowBuilder) { MessageChannel outputChannel = messageProducer.getOutputChannel(); if (outputChannel == null) { outputChannel = new DirectChannel(); messageProducer.setOutputChannel(outputChannel); } if (integrationFlowBuilder == null) { integrationFlowBuilder = from(outputChannel); } else { integrationFlowBuilder.channel(outputChannel); } return integrationFlowBuilder.addComponent(messageProducer); }
protected void sendMessage(Message<?> messageArg) { Message<?> message = messageArg; if (message == null) { throw new MessagingException("cannot send a null message"); } if (this.shouldTrack) { message = MessageHistory.write(message, this, this.getMessageBuilderFactory()); } try { this.messagingTemplate.send(getOutputChannel(), message); } catch (RuntimeException e) { if (!sendErrorMessageIfNecessary(message, e)) { throw e; } } }
private static IntegrationFlowBuilder from(MessageProducerSupport messageProducer, IntegrationFlowBuilder integrationFlowBuilder) { MessageChannel outputChannel = messageProducer.getOutputChannel(); if (outputChannel == null) { outputChannel = new DirectChannel(); messageProducer.setOutputChannel(outputChannel); } if (integrationFlowBuilder == null) { integrationFlowBuilder = from(outputChannel); } else { integrationFlowBuilder.channel(outputChannel); } return integrationFlowBuilder.addComponent(messageProducer); }