diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/config/EventNamespaceHandler.java b/spring-integration-event/src/main/java/org/springframework/integration/event/config/EventNamespaceHandler.java
index deaf84e8ec..dea502859f 100644
--- a/spring-integration-event/src/main/java/org/springframework/integration/event/config/EventNamespaceHandler.java
+++ b/spring-integration-event/src/main/java/org/springframework/integration/event/config/EventNamespaceHandler.java
@@ -28,6 +28,7 @@ public class EventNamespaceHandler extends AbstractIntegrationNamespaceHandler {
public void init() {
registerBeanDefinitionParser("inbound-channel-adapter", new EventInboundChannelAdapterParser());
+ registerBeanDefinitionParser("outbound-channel-adapter", new EventOutboundChannelAdapterParser());
}
}
diff --git a/spring-integration-event/src/main/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParser.java b/spring-integration-event/src/main/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParser.java
new file mode 100644
index 0000000000..6dea1cd10e
--- /dev/null
+++ b/spring-integration-event/src/main/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParser.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2002-2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.event.config;
+
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser;
+import org.springframework.integration.event.ApplicationEventPublishingMessageHandler;
+import org.w3c.dom.Element;
+
+/**
+ * @author Oleg Zhurakousky
+ * @since 2.0
+ */
+public class EventOutboundChannelAdapterParser extends AbstractOutboundChannelAdapterParser{
+
+
+ @Override
+ protected AbstractBeanDefinition parseConsumer(Element element,
+ ParserContext parserContext) {
+ BeanDefinitionBuilder invokerBuilder = BeanDefinitionBuilder.genericBeanDefinition(ApplicationEventPublishingMessageHandler.class);
+// BeanComponentDefinition innerHandlerDefinition =
+// IntegrationNamespaceUtils.parseInnerHandlerDefinition(element, parserContext);
+// if (innerHandlerDefinition == null){
+// Assert.hasText(element.getAttribute(IntegrationNamespaceUtils.REF_ATTRIBUTE),
+// "You must provide 'ref' attribute or register inner bean for " +
+// "Outbound Channel consumer.");
+// invokerBuilder.addConstructorArgReference(element.getAttribute(IntegrationNamespaceUtils.REF_ATTRIBUTE));
+// } else {
+// invokerBuilder.addConstructorArgValue(innerHandlerDefinition);
+// }
+// invokerBuilder.addConstructorArgValue(element.getAttribute(IntegrationNamespaceUtils.METHOD_ATTRIBUTE));
+// String order = element.getAttribute(IntegrationNamespaceUtils.ORDER);
+// if (StringUtils.hasText(order)) {
+// invokerBuilder.addPropertyValue(IntegrationNamespaceUtils.ORDER, order);
+// }
+ return invokerBuilder.getBeanDefinition();
+ }
+
+
+
+}
diff --git a/spring-integration-event/src/main/resources/org/springframework/integration/event/config/spring-integration-event-2.0.xsd b/spring-integration-event/src/main/resources/org/springframework/integration/event/config/spring-integration-event-2.0.xsd
index 88cdf0a6c8..1157418ce8 100644
--- a/spring-integration-event/src/main/resources/org/springframework/integration/event/config/spring-integration-event-2.0.xsd
+++ b/spring-integration-event/src/main/resources/org/springframework/integration/event/config/spring-integration-event-2.0.xsd
@@ -41,4 +41,47 @@
+
+
+
+
+ Defines a Channel Adapter that receives from a MessageChannel and passes to
+ a method-invoking
+ MessageHandler.
+
+
+
+
+
+
+
+
+ Specifies the order for invocation when this endpoint is connected as a
+ subscriber to a
+ SubscribableChannel.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-integration-event/src/test/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParserTests-context.xml b/spring-integration-event/src/test/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParserTests-context.xml
new file mode 100644
index 0000000000..417526b7bb
--- /dev/null
+++ b/spring-integration-event/src/test/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParserTests-context.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/spring-integration-event/src/test/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParserTests.java b/spring-integration-event/src/test/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParserTests.java
new file mode 100644
index 0000000000..01442bfad1
--- /dev/null
+++ b/spring-integration-event/src/test/java/org/springframework/integration/event/config/EventOutboundChannelAdapterParserTests.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2002-2010 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.event.config;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.springframework.beans.DirectFieldAccessor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.integration.channel.DirectChannel;
+import org.springframework.integration.core.Message;
+import org.springframework.integration.endpoint.EventDrivenConsumer;
+import org.springframework.integration.event.ApplicationEventPublishingMessageHandler;
+import org.springframework.integration.message.MessageHandler;
+import org.springframework.integration.message.StringMessage;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Oleg Zhurakousky
+ * @since 2.0
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration
+public class EventOutboundChannelAdapterParserTests {
+ @Autowired
+ private ConfigurableApplicationContext context;
+
+ private boolean recievedEvent;
+
+ @Test
+ public void validateEventParser(){
+ EventDrivenConsumer adapter = context.getBean("eventAdapter", EventDrivenConsumer.class);
+ Assert.assertNotNull(adapter);
+ DirectFieldAccessor adapterAccessor = new DirectFieldAccessor(adapter);
+ MessageHandler handler = (MessageHandler) adapterAccessor.getPropertyValue("handler");
+ Assert.assertTrue(handler instanceof ApplicationEventPublishingMessageHandler);
+ Assert.assertEquals(context.getBean("input"), adapterAccessor.getPropertyValue("inputChannel"));
+ }
+ @Test
+ public void validateUsage(){
+
+ ApplicationListener listener = new ApplicationListener() {
+ public void onApplicationEvent(ApplicationEvent event) {
+ Object source = event.getSource();
+ if (source instanceof Message){
+ String payload = (String) ((Message)source).getPayload();
+ if (payload.equals("hello")){
+ recievedEvent = true;
+ }
+ }
+ }
+ };
+ context.addApplicationListener(listener);
+ DirectChannel channel = context.getBean("input", DirectChannel.class);
+ channel.send(new StringMessage("hello"));
+ Assert.assertTrue(recievedEvent);
+ }
+
+}