INT-3704 Add Map ctor for SimpleMetadataStore

JIRA: https://jira.spring.io/browse/INT-3704

Some NoSQLs (e.g. Hazelcast) provide a distributed implementations for the `ConcurrentMap`,
so add `SimpleMetadataStore(ConcurrentMap<String, String> metadata)` to allow ot inject any `ConcurrentMap` implementation.
Demonstrate the support for Hazelcast in the `IdempotentReceiverIntegrationTests`

**Cherry-pick to 4.1.x**
This commit is contained in:
Artem Bilan
2015-04-19 20:56:00 +03:00
committed by Gary Russell
parent a0fdf6f0dc
commit f410c4a21d
3 changed files with 39 additions and 6 deletions

View File

@@ -69,6 +69,10 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
/**
* @author Artem Bilan
* @since 4.1
@@ -183,9 +187,15 @@ public class IdempotentReceiverIntegrationTests {
return new MBeanServerFactoryBean();
}
@Bean
public HazelcastInstance hazelcastInstance() {
return Hazelcast.newHazelcastInstance(new Config().setProperty( "hazelcast.logging.type", "log4j" ));
}
@Bean
public ConcurrentMetadataStore store() {
return new SimpleMetadataStore();
return new SimpleMetadataStore(hazelcastInstance().getMap("idempotentReceiverMetadataStore"));
}
@Bean
@@ -296,7 +306,7 @@ public class IdempotentReceiverIntegrationTests {
@Component
private static class FooService {
private List<Message<?>> messages = new ArrayList<Message<?>>();
private final List<Message<?>> messages = new ArrayList<Message<?>>();
@ServiceActivator(inputChannel = "annotatedMethodChannel")
@IdempotentReceiver("idempotentReceiverInterceptor")