0

I am trying to fetch the data from the file(size of 70 KB) and aggregate the data at the same time but it is getting delayed by 2 seconds for all the requests to finish the process. Below is the code. Camel context file:

<route>
    <from uri="http://localhost:6612/Services/EquationAdapter"/>
    <log message="Request xml"/>
    <enrich strategyRef="equationAdapterEnricher">
        <constant>direct:loadEquationAdapterRulesXML</constant>
    </enrich>
    <convertBodyTo type="java.lang.String"/>
    <log message="After enrich"/>
</route>

<route>
    <from  uri="direct:loadEquationAdapterRulesXML"/>
    <to uri="language:simple:file:/tmp/test.xml"/>
</route>

Java code:

public class EquationAdapterConfigRulesEnricher implements AggregationStrategy {

    
    Log logger = LogFactory.getLog(EquationAdapterConfigRulesEnricher.class);

    public void enRichEquationConfigRules(Exchange exchg) {

    }

    
    @Override
    public Exchange aggregate(Exchange oldExchg, Exchange newExchg) {

        logger.info("Entering Equation Adapter Config Rules Enricher");
        
        -----
        written logic here
        
        ---

        return oldExchg;
    }

}

Below are the logs for the same.

12 Feb 2023 13:32:08,085 [               qtp797795250-29] -genericoperation-cxf-withxslt INFO  ACTR  -DPS-DPS-24113526-DI01            -4010-220724113526596  Request xml
12 Feb 2023 13:32:10,156 [               qtp797795250-29] tionAdapterConfigRulesEnricher INFO  Entering Equation Adapter Config Rules Enricher

As we can see in the logs, we received the request at 13:32:08 and log in Java code printed after 2 seconds. It's the same issue for all the requests.

Can anyone please help here to rectify the issue and eliminate that 2 sec delay and also let me know how can we store the file in cache, so that will not poll the file everytime we get the request.

Kiran
  • 13
  • 5

0 Answers0