INT-3381: Messaging Annotations on @Bean Method

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

* Add support to mark `@Bean` methods with `Messaging Annotations`
* Addition attributes for `Messaging Annotations`
* Some refactoring and fixing
* Fix `AbstractMappingMessageRouter#onInit()` propagation
* Fix `GemfireGroupStoreTests` (https://build.spring.io/browse/INT-MASTERSPRING40-JOB1-246/test/case/135235772)

There is still some side effect: we need define `MessageChannel` beans explicitly. Since methods are processed within `BPP`,
not all beans with `Messaging Annotations` might be processed.

INT-3381: PR comments and other fixes

INT-3381 Polishing

INT-3381: Revert `RouterFB` & `SplitterFB`
This commit is contained in:
Artem Bilan
2014-04-28 15:56:01 +03:00
committed by Gary Russell
parent 3e0f10a657
commit 34cc492942
20 changed files with 638 additions and 95 deletions

View File

@@ -39,16 +39,16 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.history.MessageHistory;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.integration.store.MessageGroup;
import org.springframework.integration.store.SimpleMessageGroup;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.test.support.LongRunningIntegrationTest;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.util.Assert;
import com.gemstone.gemfire.cache.Cache;
@@ -291,6 +291,7 @@ public class GemfireGroupStoreTests {
executor = Executors.newCachedThreadPool();
executor.execute(new Runnable() {
@Override
public void run() {
MessageGroup group = store1.addMessageToGroup(1, message);
if (group.getMessages().size() != 1) {
@@ -300,6 +301,7 @@ public class GemfireGroupStoreTests {
}
});
executor.execute(new Runnable() {
@Override
public void run() {
MessageGroup group = store2.removeMessageFromGroup(1, message);
if (group.getMessages().size() != 0) {
@@ -319,10 +321,10 @@ public class GemfireGroupStoreTests {
@Test
public void testWithAggregatorWithShutdown() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("gemfire-aggregator-config.xml",
ClassPathXmlApplicationContext context1 = new ClassPathXmlApplicationContext("gemfire-aggregator-config.xml",
this.getClass());
MessageChannel input = context.getBean("inputChannel", MessageChannel.class);
QueueChannel output = context.getBean("outputChannel", QueueChannel.class);
MessageChannel input = context1.getBean("inputChannel", MessageChannel.class);
QueueChannel output = context1.getBean("outputChannel", QueueChannel.class);
Message<?> m1 = MessageBuilder.withPayload("1").setSequenceNumber(1).setSequenceSize(3).setCorrelationId(1)
.build();
@@ -333,14 +335,17 @@ public class GemfireGroupStoreTests {
input.send(m2);
assertNull(output.receive(1000));
context = new ClassPathXmlApplicationContext("gemfire-aggregator-config-a.xml", this.getClass());
MessageChannel inputA = context.getBean("inputChannel", MessageChannel.class);
QueueChannel outputA = context.getBean("outputChannel", QueueChannel.class);
ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext("gemfire-aggregator-config-a.xml",
this.getClass());
MessageChannel inputA = context2.getBean("inputChannel", MessageChannel.class);
QueueChannel outputA = context2.getBean("outputChannel", QueueChannel.class);
Message<?> m3 = MessageBuilder.withPayload("3").setSequenceNumber(3).setSequenceSize(3).setCorrelationId(1)
.build();
inputA.send(m3);
assertNotNull(outputA.receive(1000));
context1.close();
context2.close();
}
@Test
@@ -356,9 +361,10 @@ public class GemfireGroupStoreTests {
Thread.sleep(1);
}
for (int i = 0; i < 20; i++) {
assertNotNull(outputQueue.receive(1));
assertNotNull(outputQueue.receive(5000));
}
assertNull(outputQueue.receive(1));
context.close();
}
@Before