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** Conflicts: build.gradle Resolved. Fix Generics usage in IdempotentReceiverIntTests
This commit is contained in:
committed by
Gary Russell
parent
eacc196255
commit
55ff8ac786
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
@@ -69,6 +70,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 +188,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().<String, String>getMap("idempotentReceiverMetadataStore"));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -296,7 +307,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")
|
||||
|
||||
Reference in New Issue
Block a user