Issue #361: Refactor IscDataRecRequest handler to execute iscDataRec

asynchronously.

Former-commit-id: 5ddf8c9fdd [formerly b8acb1912c] [formerly 8d2ea4cfba] [formerly 8d2ea4cfba [formerly ff231f33f4]] [formerly 5ddf8c9fdd [formerly b8acb1912c] [formerly 8d2ea4cfba] [formerly 8d2ea4cfba [formerly ff231f33f4]] [formerly 1d69867594 [formerly 8d2ea4cfba [formerly ff231f33f4] [formerly 1d69867594 [formerly 26161f9fd457f02b4df8780750064aeb27fc7ba1]]]]]
Former-commit-id: 1d69867594
Former-commit-id: 3c8992ad46 [formerly 8bf167bc15] [formerly 000ca27db9] [formerly 23c953615551c2c79367dff4a8723977e6841365 [formerly 2c7dd92ec610e80343c37fb794682b682556ef19] [formerly 000ca27db9 [formerly 8c0b121cbc]]]
Former-commit-id: 9c3f969b183d1e0cc84073fe8792598715f4e56b [formerly 0e62e1016f98b0289b90c4259c26ce541cf534be] [formerly f67e4bc8c2 [formerly 773b6c7af6]]
Former-commit-id: f67e4bc8c2
Former-commit-id: c2dedd3c7c
This commit is contained in:
David Gillingham 2012-03-05 16:49:23 -06:00
parent 3f464abe04
commit 4f55e3aea4
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;
}