Hi, again
So, I've builded some approximate test for your use case:
HTML Code:
<int-jdbc:message-store id="messageStore" data-source="dataSource"/>
<channel id="input"/>
<channel id="output">
<queue/>
</channel>
<channel id="retryChannel">
<!--<queue/>-->
<queue message-store="messageStore"/>
</channel>
<gateway service-interface="org.springframework.integration.jdbc.RetryViaMessageStoreTests$TestGateway"
error-channel="retryChannel">
<method name="send" request-channel="input"/>
<method name="receive" reply-channel="output"/>
</gateway>
<service-activator input-channel="input" output-channel="output" ref="service" method="serviceIt"/>
<beans:bean id="service" class="org.springframework.integration.jdbc.RetryViaMessageStoreTests$TestService"/>
<chain input-channel="retryChannel">
<poller fixed-rate="100">
<transactional/>
</poller>
<transformer expression="payload.failedMessage.payload"/>
<gateway request-channel="input"/>
</chain>
Code:
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class RetryViaMessageStoreTests {
@Autowired
private TestGateway gateway;
@Test
public void testIt() throws InterruptedException {
gateway.send("test");
assertEquals("TEST", gateway.receive());
}
private static interface TestGateway {
void send(String s);
String receive();
}
private static class TestService {
private AtomicInteger counter = new AtomicInteger();
public String serviceIt(String s) {
System.out.println(counter);
if (10 == counter.getAndIncrement()) {
return s.toUpperCase();
}
throw new RuntimeException("intentional");
}
}
}
Here you can replace my <service-activator> with your WS-flow. If you change the 'retryChannel' <queue> to SimpleMessageStore you're going to lose message after first retry effort and your upstream invocation will hang on 'gateway.receive()'.
My test is passed after 10 retries.
Nevertheless you should try to use real robust solution with Spring-retry as it will be done after solving the issue: https://jira.springsource.org/browse/INT-343
Good luck