Help required to Configure failover for Jboss Seam mail
rohitpatidar Mar 13, 2013 6:19 AMHello,
I need to implement failover functionality for sending mails using jboss seam. I tried to configure two JNDINames in mail-service.xml. But I'm not getting how i can set 2nd JNDI name in code.
Also, I'm not getting how can i set smtp host in code.
MY Code:
- @Name("emailService")
My mail-service.xml:
- <?xml version="1.0" encoding="UTF-8"?>
- <server>
- <!-- ==================================================================== -->
- <!-- Mail Connection Factory -->
- <!-- ==================================================================== -->
- <mbean code="org.jboss.mail.MailService" name="jboss:service=Mail">
- <attribute name="JNDIName">java:/Mail</attribute>
- <attribute name="User">nobody</attribute>
- <attribute name="Password">password</attribute>
- <attribute name="Configuration">
- <!-- A test configuration -->
- <configuration>
- <!-- Change to your mail server prototocol -->
- <property name="mail.store.protocol" value="pop3"/>
- <property name="mail.transport.protocol" value="smtp"/>
- <!-- Change to the user who will receive mail -->
- <property name="mail.user" value="nobody"/>
- <!-- Change to the mail server -->
- <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/>
- <!-- Change to the SMTP gateway server -->
- <property name="mail.smtp.host" value="HOST_1"/>
- <!-- The mail server port -->
- <property name="mail.smtp.port" value="25"/>
- <!-- Change to the address mail will be from -->
- <property name="mail.from" value="nobody@abc.com"/>
- <!-- Enable debugging output from the javamail classes -->
- <property name="mail.debug" value="true"/>
- <property name="mail.smtp.auth" value="false"/>
- <property name="mail.smtp.starttls.enable" value="false"/>
- </configuration>
- </attribute>
- <depends>jboss:service=Naming</depends>
- </mbean>
- <mbean code="org.jboss.mail.MailService" name="jboss:service=Mail">
- <attribute name="JNDIName">java:/Mail1</attribute>
- <attribute name="User">nobody</attribute>
- <attribute name="Password">password</attribute>
- <attribute name="Configuration">
- <!-- A test configuration -->
- <configuration>
- <!-- Change to your mail server prototocol -->
- <property name="mail.store.protocol" value="pop3"/>
- <property name="mail.transport.protocol" value="smtp"/>
- <!-- Change to the user who will receive mail -->
- <property name="mail.user" value="nobody"/>
- <!-- Change to the mail server -->
- <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/>
- <!-- Change to the SMTP gateway server -->
- <property name="mail.smtp.host" value="HOST_2"/>
- <!-- The mail server port -->
- <property name="mail.smtp.port" value="25"/>
- <!-- Change to the address mail will be from -->
- <property name="mail.from" value="nobody@abc.com"/>
- <!-- Enable debugging output from the javamail classes -->
- <property name="mail.debug" value="true"/>
- <property name="mail.smtp.auth" value="false"/>
- <property name="mail.smtp.starttls.enable" value="false"/>
- </configuration>
- </attribute>
- <depends>jboss:service=Naming</depends>
- </mbean>
- </server>
Can you please help me on either how can i configure & use two JNDIs OR set SMTP host server on the fly for sending mail ?
Thanks a lot in advance.
Regards,
Rohit