4 Replies Latest reply on Mar 24, 2011 12:50 AM by Sohan Agate

    Email Router Problem in ESB 4.7

    Sohan Agate Newbie

      Hi I am using the ESB 4.7 bundled along with Jboss SOA server 5 and want to send Email through the EmaiLRouter Action that the ESB service provides. But nothing happens.There is no exception on the console also.Attached are all the fies that I am using:-

      Can anyone give a working example with this configuration or some different configuration or suggest changes in what I have done??Thanks in advance.

       

       

       

        • 1. Email Router Problem in ESB 4.7
          Tom Cunningham Master

          Could you enable DEBUG logging for org.jboss.soa.esb?     Additionally, if you have a support contract (you mentioned you are using SOA-P), I'd suggest opening a support case.

          • 2. Email Router Problem in ESB 4.7
            joe_boy12 Novice

            dont know about 4.7 though but I got it working in 5.0 and 5.1 in 1st shot - please fill in appropriate values below (from jboss-esb.xml)

             

            <service category="ScheduledServices" name="MyFirstScheduledService" description="Demonstrates a basic scheduled service">

            <listeners>

              <scheduled-listener name="my_scheduled_listener" scheduleidref="1-min-trigger" event-processor="com.xyz.esb.poc.action.MyScheduledActionMsgComposer">

               <property name="jmx_location" value="jboss.esb:service=MessageAlerts"/>

              </scheduled-listener>

            </listeners>

            <actions mep="OneWay">

              <action name="send-email" class="org.jboss.soa.esb.actions.routing.email.EmailWiretap">

               <property name="auth" value="false" />

               <property name="host" value="mailhost.xyz.com" />

               <property name="port" value="25" />

               <property name="username" value="smtpUser" />

               <property name="password" value="smtpPassword" />

                  <property name="from" value="fName.lName@xyz.com" />

                  <property name="sendTo" value="fName.lName@xyz.com" />

                  <property name="ccTo" value="fName.lName@xyz.com" />

               <property name="subject" value="ESB Sample Alerts" />

              </action>

            </actions>

            </service>

             

            and the scheduler implementation class, you can remove the alert count logic to test the email. this was a poc to probe Alert mbean and send notification to sys admin. Hope this helps

             

            package com.xyz.esb.poc.action;

            import java.util.Vector;

            import javax.management.MBeanServer;
            import javax.management.ObjectName;

            import org.jboss.mx.util.MBeanServerLocator;
            import org.jboss.soa.esb.ConfigurationException;
            import org.jboss.soa.esb.helpers.ConfigTree;
            import org.jboss.soa.esb.listeners.ScheduledEventMessageComposer;
            import org.jboss.soa.esb.message.Message;
            import org.jboss.soa.esb.message.format.MessageFactory;
            import org.jboss.soa.esb.schedule.SchedulingException;

            public class MyScheduledActionMsgComposer implements ScheduledEventMessageComposer {
            private ConfigTree _configTree = null;
            public final static String JMX_LOCATION = "jmx_location";

            @Override
            public Message composeMessage() throws SchedulingException {
               Message message = null;
             
              // Probe the MBean to get the Alerts
              MBeanServer mbs = MBeanServerLocator.locateJBoss();
              String jmxLocation = _configTree.getAttribute(JMX_LOCATION); // jboss.esb:service=MessageAlerts
             
              try {
               ObjectName objectName = new ObjectName(jmxLocation);
               Vector v = (Vector)mbs.getAttribute(objectName, "Alerts");
              
               if( v != null && v.size() > 0 )
               {
                System.out.println("MyScheduledActionMsgComposer Alerts Count :: " + v.size());
               
                message = MessageFactory.getInstance().getMessage();
                message.getBody().add(v);
               }
              } catch (Exception e) {
               e.printStackTrace();
               throw new SchedulingException(e.getMessage(), e);
              }
              return message;
            }
            }

            • 3. Email Router Problem in ESB 4.7
              joe_boy12 Novice

              sorry I used Wire Tap there - instead of Router

              • 4. Email Router Problem in ESB 4.7
                Sohan Agate Newbie

                First of all I want to thank all the people who posted here, but I got my Email Router working with my example itself.It seems there was some problem with the Microsoft Outlook because of which the emails were not popping up immediately.Now the original example which I posted with attachments is working fine.So if anybody wants a working Email Router he can just download my attachments.Thanks Joe,Tom for painstakingly replying for me!!!!