awips2/edexOsgi/com.raytheon.edex.plugin.grib/res/spring/grib-decode.xml
2017-06-16 09:49:09 -06:00

159 lines
7.6 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-3.1.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="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.LiftedIndexPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.RTMAGribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.RAP13GribPostProcessor</value>
<value>com.raytheon.edex.plugin.grib.decoderpostprocessors.RAP40GribPostProcessor</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"/>
<bean id="gridPersister" class="com.raytheon.edex.plugin.grib.GridPersister" depends-on="gridRegistered">
<constructor-arg value="grid"/>
<constructor-arg value="${GRID_PERSIST_THREADS}"/>
<constructor-arg value="${GRID_MAX_PERSIST_MEMORY_IN_MB}"/>
<constructor-arg value="${GRID_MAX_GRIDS_PER_PERSIST}"/>
<constructor-arg value="${GRID_MAX_MEMORY_IN_MB_PER_PERSIST}"/>
</bean>
<bean factory-bean="contextManager" factory-method="registerContextStateProcessor">
<constructor-arg ref="grib-decode"/>
<constructor-arg ref="gridPersister"/>
</bean>
<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 ref="gribSplitJmsEndpoint" />
<doTry>
<pipeline>
<setHeader headerName="pluginName">
<constant>grid</constant>
</setHeader>
<bean ref="stringToFile" />
<split streaming="true">
<method bean="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 ref="gribDecodeJmsEndpoint" />
<doTry>
<pipeline>
<bean ref="gribGridPointLock" method="reserve"/>
<bean ref="gribDecoder" />
<!-- send for processing -->
<bean ref="gribPostProcessor" method="process" />
<bean ref="gridPersister" method="persist"/>
</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 a callback to GridPersister for logging.
-->
<route id="gridPersistIndexAlert">
<from uri="direct-vm:gridPersistIndexAlert"/>
<bean ref="persist" method="persist"/>
<multicast>
<pipeline>
<!-- Separate index and logging as index needs to
eliminate duplicates for the case of stitched grids -->
<bean ref="gridPersister" method="eliminateDuplicates"/>
<bean ref="index" method="index"/>
<to uri="direct-vm:stageNotification"/>
</pipeline>
<split>
<simple>${body}</simple>
<bean ref="gridPersister" method="updateLogHeader"/>
<bean ref="processUtil" method="log"/>
</split>
</multicast>
</route>
<!--
Does a second round of post processing to generate new records
derived from recently persisted records.
-->
<route id="gridPostProcessRoute">
<from ref="gridPostProcessesJmsEndpoint" />
<doTry>
<pipeline>
<bean ref="serializationUtil" method="transformFromThrift" />
<!-- send for processing -->
<bean ref="gribPostProcessor" method="processPersisted" />
<bean ref="gridPersister" method="persist"/>
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:grib?level=ERROR"/>
</doCatch>
</doTry>
</route>
</camelContext>
</beans>