Hi,
I recommand to avoid the usage of the lightweight container and prefer
the pure JBI form.
In your case, you need to define two SUs:
1/ a mail poller SU
2/ a file sender (writer)
Concerning the mail poller, you can define the following xbean.xml:
<beans xmlns:my="http://www.example.org/myService"
xmlns:mail="http://servicemix.apache.org/mail/1.0">
<mail:poller service="my:MailService" endpoint="MailPoller"
targetService="my:MailService"
targetEndpoint="MailFileWriter"
period="10000"
connection="imap://[email protected]:143/INBOX?password=xxxx"
deleteProcessedMessages="false"
processOnlyUnseenMessages="true"/>
</beans>
Create a maven project with this xbean as resources.
On the file endpoint side, you can define the following xbean.xml:
<beans xmlns:my="http://www.example.org/myService"
xmlns:file="http://servicemix.apache.org/file/1.0">
<file:sender service="my:MailService" endpoint="MailFileWriter"
directory="file:/tmp/mailFiles"/>
</beans>
After that you can assemble both SU (the mail poller and file sender)
into a SA and create the SA zip file.
Once done, you can deploy the SA zip file by copying it into the
hotdeploy directory (if you use SMX3).
Regards
JB
FuinhaAzul wrote:
Hi there.
I´m trying to create a servicemix application that takes a email and put the
content on a file. But i´m not understand how. I did the file-binding
sample, but I´m not suceded to adapt this sample to use email.
This is waht I did:
servicemix.xml:
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:foo="http://servicemix.org/demo/"
xmlns:mail="http://servicemix.apache.org/mail/1.0">
<bean id="jndi"
class="org.apache.xbean.spring.jndi.SpringInitialContextFactory"
factory-method="makeInitialContext" singleton="true" />
<!-- the JBI container -->
<sm:container id="jbi" useMBeanServer="true" createMBeanServer="true">
<sm:activationSpecs>
<!-- Write files to the outbox directory -->
<sm:activationSpec componentName="fileSender"
service="foo:fileSender">
<sm:component>
<bean
class="org.apache.servicemix.components.file.FileWriter">
<property name="directory"
value="outbox" />
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="emailPoller"
service="emailPoller"
destinationService="foo:fileSender">
<sm:component>
<bean
class="org.apache.servicemix.components.email.MimeMailPoller">
<property name="hostName"
value="xxxxx" />
<property name="password"
value="xxxx" />
<property name="userName"
value="xxx" />
<property name="debug"
value="true" />
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
</beans>