http://jira.springframework.org/browse/INT-907 might cut it.
By the way, I did not know that I could supply a task executor with an error handler, like so:
Code:
<channel id="channel">
<dispatcher task-executor="errorHandlingTaskExecutor"/>
</channel>
<beans:bean id="errorHandlingTaskExecutor">
<beans:constructor-arg ref="someTaskExecutor"/>
<beans:constructor-arg ref="someErrorHandler"/>
</beans:bean>
Maybe I can get hold of the MessagingException there and use getFailedMessage() to avoid extending the gateway all together? My main objective is to avoid that an exception terminates the chain and stops messages from arriving at the aggregator. If an exception occurs it should be converted to a "normal" message and sent to the aggregator like every other message. That way the aggregator can release normally.