java - getting compile time error in main program itself in spring integration -


i have been using spring integration develop mail box listener using pop 3 protocol listen mailbox , read mails using pop3 protocol have develop main class in getting error error getting on below line

inputchannel.subscribe(new messagehandler() { 

and complie time error indicating the method subscribe(messagehandler) in type abstractsubscribablechannel not applicable arguments (new messagehandler(){})

below main class

import org.apache.log4j.logger; import org.springframework.context.applicationcontext; import org.springframework.context.support.classpathxmlapplicationcontext; import org.springframework.messaging.message; import org.springframework.messaging.messagingexception; import org.springframework.integration.channel.directchannel; import org.springframework.messaging.messagehandler;   public class gmailinboundpop3adaptertestapp {      private static logger logger = logger.getlogger(gmailinboundpop3adaptertestapp.class);      public static void main (string[] args) throws exception {         applicationcontext ac = new classpathxmlapplicationcontext("/test1/src/main/resources/gmail-pop3-config.xml");         directchannel inputchannel = ac.getbean("receivechannel", directchannel.class);         inputchannel.subscribe(new messagehandler() {             public void handlemessage(message<?> message) throws messagingexception {                 logger.info("message: " + message);             }         });     } } 

please advise how overcome error

also below xml

<int:channel id="receivechannel" />     <!-- replace 'userid , 'password' wit real values -->     <int-mail:inbound-channel-adapter id="pop3shoulddeletetrue"                         store-uri="pop3://[userid]:[password]@pop.gmail.com/inbox"                         channel="receivechannel"                         should-delete-messages="true"                         auto-startup="true"                         java-mail-properties="javamailproperties">             <!-- poll every 20 seconds -->             <int:poller fixed-rate="20000"/>      </int-mail:inbound-channel-adapter>      <util:properties id="javamailproperties">         <prop key="mail.pop3.socketfactory.fallback">false</prop>         <prop key="mail.debug">true</prop>         <prop key="mail.pop3.port">995</prop>         <prop key="mail.pop3.socketfactory.class">javax.net.ssl.sslsocketfactory</prop>         <prop key="mail.pop3.socketfactory.port">995</prop>     </util:properties> </beans> 

check classpath old spring integration version. based on spring-messaging since 4.0. so, version < 4.0 doesn't accepts org.springframework.messaging.messagehandler - must org.springframework.integration.core.messagehandler.

so, perspective it's mix of versions in classpath.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -