INT-1477 restructuring samples repo to have basic, intermediate, advancedand applications directories
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.0.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
|
||||
xmlns:util="http://www.springframework.org/schema/util">
|
||||
|
||||
<int:channel id="recieveChannel" />
|
||||
<!-- replace 'userid and 'password' wit the real values -->
|
||||
<int-mail:imap-idle-channel-adapter id="customAdapter"
|
||||
store-uri="imaps://[userid]:[pasword]@imap.gmail.com:993/inbox"
|
||||
channel="recieveChannel"
|
||||
auto-startup="true"
|
||||
should-delete-messages="false"
|
||||
should-mark-messages-as-read="false"
|
||||
java-mail-properties="javaMailProperties"/>
|
||||
|
||||
<util:properties id="javaMailProperties">
|
||||
<prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
|
||||
<prop key="mail.imap.socketFactory.fallback">false</prop>
|
||||
<prop key="mail.store.protocol">imaps</prop>
|
||||
<prop key="mail.debug">false</prop>
|
||||
</util:properties>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail-2.0.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
|
||||
xmlns:util="http://www.springframework.org/schema/util">
|
||||
|
||||
<int:channel id="recieveChannel" />
|
||||
<!-- replace 'userid and 'password' wit the real values -->
|
||||
<int-mail:inbound-channel-adapter id="pop3ShouldDeleteTrue"
|
||||
store-uri="pop3://[userid]:[password]@pop.gmail.com/INBOX"
|
||||
channel="recieveChannel"
|
||||
should-delete-messages="true"
|
||||
auto-startup="true"
|
||||
java-mail-properties="javaMailProperties">
|
||||
<!-- Will 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>
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.springframework.integration.samples.mail.imapidle;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class GmailInboundImapIdleAdapterTest {
|
||||
private static Logger logger = Logger.getLogger(GmailInboundImapIdleAdapterTest.class);
|
||||
|
||||
|
||||
public static void main (String[] args) throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/gmail-imap-idle-config.xml");
|
||||
DirectChannel inputChannel = ac.getBean("recieveChannel", DirectChannel.class);
|
||||
inputChannel.subscribe(new MessageHandler() {
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
logger.info("Message: " + message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.springframework.integration.samples.mail.imapidle;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
*
|
||||
*/
|
||||
public class GmailInboundPop3AdapterTest {
|
||||
private static Logger logger = Logger.getLogger(GmailInboundPop3AdapterTest.class);
|
||||
|
||||
|
||||
public static void main (String[] args) throws Exception {
|
||||
ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/gmail-pop3-config.xml");
|
||||
DirectChannel inputChannel = ac.getBean("recieveChannel", DirectChannel.class);
|
||||
inputChannel.subscribe(new MessageHandler() {
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
logger.info("Message: " + message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
28
basic/mail/src/test/resources/log4j.xml
Normal file
28
basic/mail/src/test/resources/log4j.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Loggers -->
|
||||
<logger name="org.springframework.integration.mail">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.samples">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
Reference in New Issue
Block a user