Hey guys,
I seem to be having an issue with the inbound-channel-adaptor. My setup is very basic. I've created a few classes and then an integration context file to wire it all together. The whole thing is just running in a main function that I threw together.
I've tried to add a poller to my inbound-channel-adaptor, but my method never gets called. I also tried to invoke this method from the main function and it still does not pass along my message to the intended channel. I can see that it has gotten into the method due to the fact that it spits out a log message.
I created a gateway to pass along the same object to the same channel and it works fine. Not sure at all what I'm doing wrong. I believe I've done everything properly. I'm using the latest spring and spring integration.
Here's my integration context XML file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--/*
*/
-->
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:si="http://www.springframework.org/schema/integration"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
">
<beans:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<beans:property name="location" value="classpath:integrationsContext.properties"/>
<beans:property name="ignoreUnresolvablePlaceholders" value="true"/>
</beans:bean>
<si:channel id="vendorEventsIn"/>
<si:channel id="smsEventsIn"/>
<si:channel id="smsEventsOut"/>
<si:channel id="vendorEventsOut"/>
<!-- need this? -->
<si:gateway id="eventGateway" default-request-channel="vendorEventsIn"
default-reply-channel="vendorEventsOut" service-interface="gateway.gateway.TestGateway" />
<si:inbound-channel-adapter ref="vendorHandler" method="checkForUpdates" channel="vendorEventsIn">
<si:poller>
<si:interval-trigger interval="1000"/>
</si:poller>
</si:inbound-channel-adapter>
<si:transformer input-channel="vendorEventsIn"
ref="vendorToSmsTransformer" method="transform" output-channel="smsEventsIn" />
<si:service-activator ref="smsWsClient" method="forwardSmsEvent" input-channel="smsEventsIn" output-channel="smsEventsOut"/>
<si:transformer input-channel="smsEventsOut" ref="smsToVendorTransformer"
method="transform" output-channel="vendorEventsOut" />
<si:outbound-channel-adapter ref="vendorHandler" method="reply" channel="vendorEventsOut"/>
<beans:bean id="vendorHandler" class="gateway.vendor.TestVendorHandler" />
<beans:bean id="vendorToSmsTransformer" class="gateway.transformer.TestVendorToSmsTransformer" />
<beans:bean id="smsToVendorTransformer" class="gateway.transformer.TestSmsToVendorTransformer" />
<beans:bean id="smsWsClient" class="gateway.sms.SmsWsClient" />
<si:poller max-messages-per-poll="1" id="defaultPoller" default="true">
<si:interval-trigger interval="3000"/>
</si:poller>
</beans:beans>
Here's my method being called in the class:
Code:
public Message<?> checkForEvents()
{
// TODO Auto-generated method stub
LOGGER.info("checking for events");
Message<?> response = null;
TestEvent e = new TestEvent();
e.setId(1L);
response = MessageBuilder.withPayload(e).build();
return response;
}
I've also tried this with just the object I wanted to send along to the channel. Still, no luck.
Finally, this is me trying to invoke the thing in my main class:
Code:
public static void main(String[] args)
{
try
{
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] { "integrationsContext.xml" });
appContext.start();
// works!!!!
//TestGateway tg = (TestGateway)appContext.getBean("eventGateway");
//tg.testIt(new TestEvent());
// does not work
TestVendorHandler tvh = (TestVendorHandler)appContext.getBean("vendorHandler");
tvh.checkForEvents();
}
catch (Throwable e)
{
LOGGER.info(ExceptionUtils.getFullStackTrace(e));
}
}