[jboss-svn-commits] JBL Code SVN: r5245 - in labs/jbossesb/branches/refactor/ESBCore: listeners/src/org/jboss/soa/esb/listeners processors/src/org/jboss/soa/esb/processors

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Jul 22 07:07:02 EDT 2006


Author: arvinder
Date: 2006-07-22 07:06:58 -0400 (Sat, 22 Jul 2006)
New Revision: 5245

Added:
   labs/jbossesb/branches/refactor/ESBCore/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
Modified:
   labs/jbossesb/branches/refactor/ESBCore/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
Log:
Merge with trunk, for some reason the merge did not pull down EsbMsgProcessor, so this has ben added manually

Modified: labs/jbossesb/branches/refactor/ESBCore/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java	2006-07-22 10:58:11 UTC (rev 5244)
+++ labs/jbossesb/branches/refactor/ESBCore/listeners/src/org/jboss/soa/esb/listeners/JmsQueueListener.java	2006-07-22 11:06:58 UTC (rev 5245)
@@ -12,6 +12,7 @@
 import javax.naming.*;
 import javax.jms.*;
 
+//import org.jboss.soa.esb.samples.loanbroker.domain.LoanBrokerConstants;
 import org.jboss.soa.esb.services.*;
 import org.jboss.soa.esb.util.*;
 import org.jboss.soa.esb.common.*;
@@ -28,6 +29,7 @@
   											 // parameter reloading
   ;
   
+  //attributes that need to be set in the xml parameter file for the service
   public static final String PARM_ACTION_CLASS		= "actionClass";
 
   public static final String PARM_RELOAD_LTCY 		= "parmsReloadSecs";
@@ -257,6 +259,8 @@
     protected QueueSession	m_oQsess;
     protected Queue			m_oQueue;
     
+    protected String		m_sSelectorService;
+    
     protected GroupOfChilds(ThreadGroup p_oThrGrp) throws Exception
     {
       m_oThrGrp = p_oThrGrp;
@@ -338,6 +342,11 @@
 		
 		obtainAtt(p_oP,LISTEN_QUEUE,null);
 		
+		m_sSelectorService = obtainAtt(p_oP,LISTEN_MSG_SELECTOR,null);
+		
+		
+		
+		
 		String sClass = obtainAtt(p_oP,PARM_ACTION_CLASS,null);
 		if (EsbUtil.isNullString(sClass))
 			throw new Exception(formatLogMsg("Missing value for "+PARM_ACTION_CLASS));
@@ -387,8 +396,8 @@
           	continue;
 		  }
 		  obtainQueue(p_oP);
-	      String sSelector	= m_oParms.getAttr(LISTEN_MSG_SELECTOR);
-		  MessageConsumer oReader = m_oQsess.createReceiver(m_oQueue, sSelector);
+	      //String sSelector	= m_oParms.getAttr(LISTEN_MSG_SELECTOR);
+		  MessageConsumer oReader = m_oQsess.createReceiver(m_oQueue, m_sSelectorService);
 	      Message oMsg = (null==oReader) ? null
 	    		  : oReader.receiveNoWait();
 	      if (null==oMsg)

Added: labs/jbossesb/branches/refactor/ESBCore/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java	2006-07-22 10:58:11 UTC (rev 5244)
+++ labs/jbossesb/branches/refactor/ESBCore/processors/src/org/jboss/soa/esb/processors/EsbMsgProcessor.java	2006-07-22 11:06:58 UTC (rev 5245)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.processors;
+
+import org.jboss.soa.esb.helpers.DomElement;
+
+import javax.jms.Message;
+import javax.jms.TextMessage;
+import java.lang.reflect.Constructor;
+
+public class EsbMsgProcessor extends EsbAbstractProcessor
+{
+  public EsbMsgProcessor(DomElement p_oP) throws Exception
+  { super(p_oP,false);
+  } //__________________________________
+
+  protected void checkParms() throws Exception {}
+  public void execute() throws Exception {}
+
+  public void processMessage(Message p_oMsg) throws Exception
+  {
+    String sPrc = this.getClass().getName();
+    sPrc = sPrc.substring(1+sPrc.lastIndexOf("."));
+
+    StringBuffer sb = new StringBuffer("Message ");
+    if (p_oMsg instanceof TextMessage)
+      sb.append("<").append(((TextMessage)p_oMsg).getText()).append("> ");
+    String sNotifMsg = sb.toString();
+
+    sb.setLength(0);
+    try
+    {
+      try
+      { Class oCls =  Class.forName(m_oParms.getAttr("actionClass"));
+        Constructor oCns = oCls.getConstructor(new Class[] {Message.class,EsbAbstractProcessor.class});
+        oCns.newInstance(new Object[] {p_oMsg,this});
+
+        super.postProcess();
+
+        sb.append(sPrc).append(" processed ").append(sNotifMsg).append(" successfully");
+        super.notifyOK(sb.toString());
+      }
+      catch (Exception e)
+      { m_oLogger.fatal("Message processor FAILED",e);
+        throw e;
+      }
+      finally { super.release(); }
+    }
+
+    catch (Exception eGen)
+    {
+        System.out.println("test catch for rollback here..");
+        super.notifyError(eGen," " + sPrc+" PROBLEMS processing "+sNotifMsg);
+        throw eGen;
+    }
+ }//_________________________
+
+} //____________________________________________________________________________




More information about the jboss-svn-commits mailing list