Switchyard - Configure for multiple E-Mail boxes
nojlib Oct 14, 2013 9:23 AMHi
In short:
I have a DB table that carries a list of mailboxes (with username/passwords). I am trying to configure switchyard to pull emails dynamically from exchange based on data in this table.
My plan is to "parameterise" the mailbox/username/password and then change properties as required. I am still stuck at parameterising the details in the switchyard.xml file.
This is what I currently have:
<sca:service name="PrintService" promote="PrintServiceBean/PrintService">
<sca:interface.java interface="org.switchyard.quickstarts.camel.mail.binding.PrintService"/>
<mail:binding.mail>
<mail:contextMapper/>
<mail:messageComposer class="org.switchyard.quickstarts.camel.mail.binding.MyComposer"/>
<mail:host>localhost</mail:host>
<mail:port>110</mail:port>
<mail:username>{{USER}}</mail:username>
<mail:password>{{PASS}}</mail:password>
<mail:consume accountType="pop3">
<mail:delay>10000</mail:delay>
<mail:delete>true</mail:delete>
</mail:consume>
</mail:binding.mail>
</sca:service>
and then later on in the file I have
<sca:property value="testuser" name="USER"/>
<sca:property value="testpassword" name="PASS"/>
When I run this I get the following error:
Consumer Consumer[pop3://localhost:110?delay=10000&delete=true&password=******&username=%7B%7BUSER%7D%7D] could not poll endpoint: Endpoint[pop3://localhost:110?delay=10000&delete=true&password=******&username=%7B%7BUSER%7D%7D] caused by: Authentication failed.: javax.mail.AuthenticationFailedException: Authentication failed.
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:208) [mail-1.4.5-redhat-1.jar:1.4.5-redhat-1]
at javax.mail.Service.connect(Service.java:317) [mail-1.4.5-redhat-1.jar:1.4.5-redhat-1]
at org.apache.camel.component.mail.MailConsumer.ensureIsConnected(MailConsumer.java:376) [camel-mail-2.10.0.jar:2.10.0]
at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:82) [camel-mail-2.10.0.jar:2.10.0]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139) [camel-core-2.10.0.jar:2.10.0]
I have tried a couple of other property-escaping methods described in the documentation, but the only one that works is the ${USER}, but that substitutes the property when loading so changing the property value afterwards, wouldn't work since the URI was passed to Camel-Mail as : pop3://localhost:110?delay=10000&delete=true&password=******&username=testuser
Now:
-Is this the suggested method, or do you have a better solution?
-What am I missing with regards to the properties that was explained above?
Thanks in advance
Ruan