if(!hasResponseChannelAttribute && !hasRequestChannelAttribute) {
BeanDefinitionBuilder defBuilder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
AbstractBeanDefinition beanDef = defBuilder.getBeanDefinition();
String reqChannelBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, reqChannelBeanName));
builder.addPropertyReference("requestChannel", reqChannelBeanName);
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(QueueChannel.class);
beanDef = defBuilder.getBeanDefinition();
String repChannelBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, repChannelBeanName));
builder.addPropertyReference("responseChannel", repChannelBeanName);
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(MindRpcSerializer.class);
beanDef = defBuilder.getBeanDefinition();
String serializerBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, serializerBeanName));
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(TcpNetClientConnectionFactory.class);
String host = element.hasAttribute("host") ? element.getAttribute("host") : "localhost";
String port = element.hasAttribute("port") ? element.getAttribute("port") : "0";
defBuilder.addConstructorArgValue(host);
defBuilder.addConstructorArgValue(port);
defBuilder.addPropertyReference("serializer", serializerBeanName);
defBuilder.addPropertyReference("deserializer", serializerBeanName);
beanDef = defBuilder.getBeanDefinition();
String conFactoryBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, conFactoryBeanName));
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(TcpOutboundGateway.class);
defBuilder.addPropertyReference("connectionFactory", conFactoryBeanName);
defBuilder.addPropertyReference("outputChannel", reqChannelBeanName);
defBuilder.addPropertyReference("replyChannel", repChannelBeanName);
beanDef = defBuilder.getBeanDefinition();
String gatewayBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, gatewayBeanName));
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(ConsumerEndpointFactoryBean.class);
defBuilder.addPropertyReference("handler", gatewayBeanName);
defBuilder.addPropertyValue("inputChannelName", reqChannelBeanName);
beanDef = defBuilder.getBeanDefinition();
String consumerBeanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, consumerBeanName));
} else if (hasResponseChannelAttribute && hasRequestChannelAttribute) {
// both references given
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "request-channel");
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "response-channel");