awips2/edexOsgi/com.raytheon.edex.plugin.grib/res/spring/grib-decode.xml
2022-05-05 12:34:50 -05:00

154 lines
7.4 KiB
XML

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="gribDecoder" class="com.raytheon.edex.plugin.grib.GribDecoder" />
<bean id="gridPersistUtils" class="com.raytheon.edex.plugin.grib.util.GridPersistUtils" />
<bean id="gribGridPointLock" class="com.raytheon.edex.plugin.grib.GribGridPointLock">
<constructor-arg value="${GRIB_MAX_GRID_POINTS}"/>
<constructor-arg value="${GRIB_DECODE_THREADS}"/>
</bean>
<bean id="gribSplitter" class="com.raytheon.edex.plugin.grib.GribSplitter" />
<bean id="useLatestAggregationStrategy" class="org.apache.camel.processor.aggregate.UseLatestAggregationStrategy" />
<bean id="gribPostProcessor"
class="com.raytheon.edex.plugin.grib.decoderpostprocessors.GribPostProcessor"
factory-method="getInstance" />
<bean id="postProcessorsRegistered" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="gribPostProcessor"/>
<property name="targetMethod" value="register"/>
<property name="arguments">
<list>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.CPCoutlookGribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.ECMWFHiResProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.EnsembleGridAssembler</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.FFGGribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.HPCqpfPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.HWRFPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.LapsPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.LiftedIndexPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.MSASPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.OverwriteGribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.RTMAGribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.RUC130GribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.RUC236GribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.TemperatureCorrectionPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.precipitation.PrecipAccumPostProcessor</value>
</list>
</property>
</bean>
<bean id="gribTableLookup" class="com.raytheon.uf.common.grib.tables.GribTableLookup"
factory-method="getInstance" depends-on="gridRegistered, queryDataRegistered, levelFactoryInitialized" />
<bean id="gribModelLookup"
class="com.raytheon.uf.common.grib.GribModelLookup"
factory-method="getInstance" >
<property name="coverageNameLookup" ref="gribSpatialCache"/>
</bean>
<bean id="gribSpatialCache"
class="com.raytheon.edex.plugin.grib.spatial.GribSpatialCache"
factory-method="getInstance" depends-on="gridcoveragelookup"/>
<camelContext id="grib-decode" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler">
<endpoint id="gribSplitJmsEndpoint" uri="jms-durable:queue:Ingest.GribSplit?concurrentConsumers=${GRIB_SPLIT_THREADS}"/>
<endpoint id="gribDecodeJmsEndpoint" uri="jms-durable:queue:Ingest.GribDecode?concurrentConsumers=${GRIB_DECODE_THREADS}"/>
<endpoint id="gridPostProcessesJmsEndpoint" uri="jms-durable:queue:Grid.PostProcess?concurrentConsumers=${GRID_POSTPROCESS_THREADS}"/>
<!-- Begin Grib Decode Route -->
<route id="gribSplitIngestRoute">
<from uri="gribSplitJmsEndpoint" />
<doTry>
<pipeline>
<setHeader name="pluginName">
<constant>grid</constant>
</setHeader>
<bean ref="stringToFile" />
<split streaming="true">
<method ref="gribSplitter" method="split" />
<to uri="jms-durable:queue:Ingest.GribDecode" />
</split>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:grib?level=ERROR"/>
</doCatch>
</doTry>
</route>
<route id="gribDecodeIngestRoute">
<from uri="gribDecodeJmsEndpoint" />
<doTry>
<pipeline>
<bean ref="gribGridPointLock" method="reserve"/>
<bean ref="gribDecoder" />
<!-- send for processing -->
<bean ref="gribPostProcessor" method="process" />
<to uri="direct-vm:gridPersistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:grib?level=ERROR"/>
</doCatch>
<doFinally>
<bean ref="gribGridPointLock" method="release"/>
</doFinally>
</doTry>
</route>
<!--
Copy of persist route with special grid duplicate elimination.
-->
<route id="gridPersistIndexAlert">
<from uri="direct-vm:gridPersistIndexAlert"/>
<bean ref="persist" method="persist"/>
<!-- Eliminate duplicates for the case of stitched grids -->
<bean ref="gridPersistUtils" method="eliminateAndAuditDuplicates"/>
<bean ref="index" method="index"/>
<bean ref="processUtil" method="log"/>
<to uri="direct-vm:stageNotification"/>
</route>
<!--
Does a second round of post processing to generate new records
derived from recently persisted records.
-->
<route id="gridPostProcessRoute">
<from uri="gridPostProcessesJmsEndpoint" />
<doTry>
<pipeline>
<bean ref="serializationUtil" method="transformFromThrift" />
<!-- send for processing -->
<bean ref="gribPostProcessor" method="processPersisted" />
<to uri="direct-vm:gridPersistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:grib?level=ERROR"/>
</doCatch>
</doTry>
</route>
<!--
Handles purging from the gridcoverage caches in local instance of
GridCoverageLookup
-->
<route id="purgeGridCoverageCaches">
<from uri="jms-generic:topic:purgeGridCoverageCaches" />
<bean ref="gribSpatialCache" method="purgeCaches" />
</route>
</camelContext>
</beans>