Issue #361: Refactor IscDataRecRequest handler to execute iscDataRec

asynchronously.

Former-commit-id: 1d69867594 [formerly 8d2ea4cfba [formerly ff231f33f4] [formerly 1d69867594 [formerly 26161f9fd457f02b4df8780750064aeb27fc7ba1]]]
Former-commit-id: 8d2ea4cfba [formerly ff231f33f4]
Former-commit-id: 8d2ea4cfba
Former-commit-id: b8acb1912c
This commit is contained in:
David Gillingham 2012-03-05 16:49:23 -06:00
parent c209eab132
commit 5ddf8c9fdd
3 changed files with 96 additions and 10 deletions

View file

@ -451,6 +451,22 @@
<constructor-arg ref="iscSendSrvCfg" />
</bean>
<!-- End ISC Send Beans -->
<!-- ISC Receive Beans -->
<bean id="jms-iscrec" class="org.apache.camel.component.jms.JmsComponent">
<constructor-arg ref="jmsIscReceiveConfig" />
<property name="taskExecutor" ref="iscReceiveThreadPool" />
</bean>
<bean id="jmsIscReceiveConfig" class="org.apache.camel.component.jms.JmsConfiguration"
factory-bean="jmsConfig" factory-method="copy" />
<bean id="iscReceiveThreadPool"
class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor">
<property name="corePoolSize" value="2" />
<property name="maxPoolSize" value="2" />
</bean>
<bean id="IscReceiveSrv" class="com.raytheon.edex.plugin.gfe.isc.IscReceiveSrv" />
<!-- End ISC Receive Beans -->
<bean id="logPurger" class="com.raytheon.edex.plugin.gfe.log.LogPurger" />
@ -503,6 +519,21 @@
</doCatch>
</doTry>
</route>
<!-- ISC Data Receive route -->
<route id="iscReceiveRoute">
<from uri="jms-iscrec:queue:gfeIscDataReceive?concurrentConsumers=2&amp;destinationResolver=#qpidDurableResolver" />
<doTry>
<pipeline>
<bean ref="serializationUtil" method="transformFromThrift" />
<bean ref="IscReceiveSrv" method="processRequest"/>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:iscDataRec?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</route>
</camelContext>
<!-- ISC Send Routes -->

View file

@ -0,0 +1,57 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.isc;
import com.raytheon.uf.common.dataplugin.gfe.request.IscDataRecRequest;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
/**
* ISC data receive service. Takes incoming request and executes iscDataRec
* script using provided parameters.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 5, 2012 #361 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class IscReceiveSrv {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(IscReceiveSrv.class);
public static void processRequest(IscDataRecRequest request) {
GfeScriptExecutor scriptRunner = new GfeScriptExecutor();
String retVal = scriptRunner.execute("iscDataRec "
+ request.getArgString());
if (!retVal.equals(GfeScriptExecutor.SUCCESS)) {
statusHandler.error("Error encountered executing iscDataRec: "
+ retVal);
}
}
}

View file

@ -19,13 +19,15 @@
**/
package com.raytheon.edex.plugin.gfe.server.handler;
import com.raytheon.edex.plugin.gfe.isc.GfeScriptExecutor;
import com.raytheon.uf.common.dataplugin.gfe.request.IscDataRecRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.edex.core.EDEXUtil;
/**
* TODO Add Description
* Thrift request handler for <code>IscDataRecRequest</code>. Takes request and
* places it on a queue to be executed by <code>IscReceiveSrv</code>.
*
* <pre>
*
@ -34,6 +36,8 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 26, 2010 dgilling Initial creation
* Mar 05, 2012 #361 dgilling Make call to iscDataRec
* asynchronous.
*
* </pre>
*
@ -55,15 +59,9 @@ public class IscDataRecRequestHandler implements
public ServerResponse<String> handleRequest(IscDataRecRequest request)
throws Exception {
ServerResponse<String> sr = new ServerResponse<String>();
GfeScriptExecutor scriptRunner = new GfeScriptExecutor();
String retVal = scriptRunner.execute("iscDataRec "
+ request.getArgString());
if (!retVal.equals(GfeScriptExecutor.SUCCESS)) {
sr.addMessage(retVal);
}
byte[] message = SerializationUtil.transformToThrift(request);
EDEXUtil.getMessageProducer().sendAsync("iscReceiveRoute", message);
return sr;
}