1 Reply Latest reply on Mar 13, 2013 2:13 AM by Rohit Patidar

    Help required to Configure failover for Jboss Seam mail

    Rohit Patidar Newbie

      Hello,
      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:

       

      view plaincopy to clipboardprint?
      1.  
      2. @Name("emailService")  

       

      My mail-service.xml:

       

      view plaincopy to clipboardprint?
      1. <?xml version="1.0" encoding="UTF-8"?> 
      2.  
      3. <server> 
      4.  
      5.   <!-- ==================================================================== --> 
      6.   <!-- Mail Connection Factory                                              --> 
      7.   <!-- ==================================================================== --> 
      8.  
      9.   <mbean code="org.jboss.mail.MailService" name="jboss:service=Mail"> 
      10.     <attribute name="JNDIName">java:/Mail</attribute> 
      11.     <attribute name="User">nobody</attribute> 
      12.     <attribute name="Password">password</attribute> 
      13.     <attribute name="Configuration"> 
      14.       <!-- A test configuration --> 
      15.       <configuration> 
      16.         <!-- Change to your mail server prototocol --> 
      17.         <property name="mail.store.protocol" value="pop3"/> 
      18.         <property name="mail.transport.protocol" value="smtp"/> 
      19.  
      20.         <!-- Change to the user who will receive mail  --> 
      21.         <property name="mail.user" value="nobody"/> 
      22.  
      23.         <!-- Change to the mail server  --> 
      24.         <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/> 
      25.  
      26.         <!-- Change to the SMTP gateway server --> 
      27.         <property name="mail.smtp.host" value="HOST_1"/> 
      28.           
      29.         <!-- The mail server port --> 
      30.         <property name="mail.smtp.port" value="25"/> 
      31.           
      32.         <!-- Change to the address mail will be from  --> 
      33.         <property name="mail.from" value="nobody@abc.com"/> 
      34.  
      35.         <!-- Enable debugging output from the javamail classes --> 
      36.         <property name="mail.debug" value="true"/> 
      37.         <property name="mail.smtp.auth" value="false"/> 
      38.         <property name="mail.smtp.starttls.enable" value="false"/> 
      39.  
      40.  
      41.       </configuration> 
      42.     </attribute> 
      43.     <depends>jboss:service=Naming</depends> 
      44.   </mbean> 
      45.  
      46.   <mbean code="org.jboss.mail.MailService" name="jboss:service=Mail"> 
      47.     <attribute name="JNDIName">java:/Mail1</attribute> 
      48.     <attribute name="User">nobody</attribute> 
      49.     <attribute name="Password">password</attribute> 
      50.     <attribute name="Configuration"> 
      51.       <!-- A test configuration --> 
      52.       <configuration> 
      53.         <!-- Change to your mail server prototocol --> 
      54.         <property name="mail.store.protocol" value="pop3"/> 
      55.         <property name="mail.transport.protocol" value="smtp"/> 
      56.  
      57.         <!-- Change to the user who will receive mail  --> 
      58.         <property name="mail.user" value="nobody"/> 
      59.  
      60.         <!-- Change to the mail server  --> 
      61.         <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/> 
      62.  
      63.         <!-- Change to the SMTP gateway server --> 
      64.         <property name="mail.smtp.host" value="HOST_2"/> 
      65.           
      66.         <!-- The mail server port --> 
      67.         <property name="mail.smtp.port" value="25"/> 
      68.           
      69.         <!-- Change to the address mail will be from  --> 
      70.         <property name="mail.from" value="nobody@abc.com"/> 
      71.  
      72.         <!-- Enable debugging output from the javamail classes --> 
      73.         <property name="mail.debug" value="true"/> 
      74.         <property name="mail.smtp.auth" value="false"/> 
      75.         <property name="mail.smtp.starttls.enable" value="false"/> 
      76.  
      77.  
      78.       </configuration> 
      79.     </attribute> 
      80.     <depends>jboss:service=Naming</depends> 
      81.   </mbean> 
      82. </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