Hi,

I want to setup a Spring integration project with a REST call to handle a request existing of some tasks. Tasks must be processed in parallel. However,
when I use the configuration below, I keep getting following exception:

Code:
Exception in thread "main" org.springframework.web.client.RestClientException: Cannot extract response: no Content-Type found
	at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:66)
	at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:619)
	at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:1)
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446)
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)
	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:377)
	at com.mycompany.prototype.CallPrototype.main(CallPrototype.java:48)
This is because the tasks are still processing, the REST call does not wait for the result. If I remove the task executor on the splitterChannel, everything is processed in sequence and it works, but that's not what I want to achieve. What I am doing wrong here?

Config:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:int="http://www.springframework.org/schema/integration"
	xmlns:jmx="http://www.springframework.org/schema/integration/jmx"
	xmlns:int-http="http://www.springframework.org/schema/integration/http"
	xmlns:task="http://www.springframework.org/schema/task"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
	http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	http://www.springframework.org/schema/integration
	http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
	http://www.springframework.org/schema/integration/jmx 
	http://www.springframework.org/schema/integration/jmx/spring-integration-jmx-2.0.xsd
	http://www.springframework.org/schema/integration/stream
	http://www.springframework.org/schema/integration/stream/spring-integration-stream-1.0.xsd
	http://www.springframework.org/schema/integration/http
	http://www.springframework.org/schema/integration/http/spring-integration-http-2.0.xsd
	http://www.springframework.org/schema/task 
	http://www.springframework.org/schema/task/spring-task-3.0.xsd
	http://www.springframework.org/schema/context
	http://www.springframework.org/schema/context/spring-context-3.0.xsd">
	
	<context:component-scan base-package="com.mycompany.prototype"/>
		
	<int-http:inbound-gateway 
		request-channel="requestChannel"
		reply-channel="responseChannel"
        name="/generate.html"                                  
        supported-methods="POST"/> 

	<int:channel id="requestChannel"/>
	
	<int:service-activator 
		input-channel="requestChannel"
		output-channel="json" 
		ref="byteHandler"/>
		
	<!-- JSON string -->
	<int:channel id="json" >
		<int:interceptors>
			<int:wire-tap channel="logger"/>
		</int:interceptors>
	</int:channel>
		
	<!--  log channel -->
	<int:logging-channel-adapter id="logger" level="INFO"/>
		
	<int:json-to-object-transformer
		input-channel="json"
		output-channel="tasksRequest"
		type="com.mycompany.prototype.TaskRequest"/>
		
	 <!-- Tasks -->
	<int:channel id="tasksRequest"/>
	
	<bean id="pool" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
		<property name="corePoolSize" value="2"/>
		<property name="daemon" value="false"/>
	</bean>
	
	<int:splitter 
		input-channel="tasksRequest"
		ref="taskSplitter"
		output-channel="splitterChannel"/>		
		
	<int:channel id="splitterChannel">
		<int:dispatcher task-executor="pool"/>
	</int:channel>	
	
	<!-- route attachments to type processors -->	
	<int:router input-channel="splitterChannel" ref="taskTypeRouter"/>
	
	<int:channel id="tasks1"/>						
	<int:channel id="tasks2"/>
						
	<int:service-activator 
		input-channel="tasks1" 
		output-channel="handledTasks" 
		ref="taskHandler1"/>
		
	<int:service-activator 
		input-channel="tasks2" 
		output-channel="handledTasks" 
		ref="taskHandler1"/>
		
	<int:channel id="handledTasks"/>	
	
	<!--  aggregate -->
	<int:aggregator 
		input-channel="handledTasks"
		output-channel="responseChannel"
		ref="taskAggregator"/>
		
    <int:channel id="responseChannel"/>
    	
</beans>
call:

Code:
RestTemplate template = new RestTemplate();
		
		template.getMessageConverters();
		template.getMessageConverters().add(
			      new MappingJacksonHttpMessageConverter());
		
		HttpEntity<TaskRequest> entity = new HttpEntity<TaskRequest>(req);
		
		ResponseEntity<String> response = template.exchange("http://localhost:8080/MailExport/generate.html", HttpMethod.POST, entity, String.class);
		
		System.out.println(response);