Not getting the newest information from a table (recipientList)

别说谁变了你拦得住时间么 提交于 2020-06-28 06:34:19

问题


I am using Apache Camel with different routes running inside a CONTAINER.

I am having trouble with this route: getSalesNumber that obtains the sale number for a specific person. The problem is that this route reads the content of a table called TABLE_AGENT_MAIL and if i inserted a new row inside that table the route wont read it and i have to restart the container in order to make it work.

This is the route:

<route id="getSalesNumber">
    <from uri="direct:getSalesNumber"/>
    <setHeader headerName="AGENT_ID">
        <simple>${body.agent_id}</simple>
    </setHeader>
    <log message="Searching agent code for order #${headers.WEB_ORDER.increment_id} - agent_id: ${headers.AGENT_ID}"/>
    <recipientList>
        <simple>sqlServer:SELECT AGENT_CODE FROM TABLE_AGENT_MAIL WHERE EMAIL=:#AGENT_ID?outputType=SelectOne</simple>
    </recipientList>
    <setHeader headerName="SALES_REP_NUM">
        <simple>${body}</simple>
    </setHeader>
    <log message="Sales Representative number: ${body}" loggingLevel="DEBUG" />
</route>

The route is called in here:

 <route autoStartup="true" id="TaxCalculator">
        <from uri="direct:calculateTAXEBSOrder"/>
        <doTry>
            <to uri="direct:getSalesNumber" />
            <to uri="direct:getPriceListName" />
            <to uri="spCreateProcessor"/>
            <log message="${body}" />
            <to uri="spTaxParametersProcessor"/>
            <log message="${body}" />
            <to uri="mybatis:calcOrderTax?statementType=SelectOne"/>
            <log message="${body}" />
            <doCatch>
                <exception>java.lang.Exception</exception>
                <log message="${exception.message}" />
                <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
                    <constant>500</constant>
                </setHeader>
                <setHeader headerName="exception.message">
                    <simple>${exception.message}</simple>
                </setHeader>
            </doCatch>
        </doTry>
        <to uri="spEbsTaxResponseProcessor"/>
        <setHeader headerName="correlationId">
            <constant>ORDER</constant>
        </setHeader>
    </route>

Why is this happening? Why do i need to restart the container?

I was thinking about making a Dynamic recipientList but i failed.

Could you please help me to fix it? This is annoying.

来源:https://stackoverflow.com/questions/60696037/not-getting-the-newest-information-from-a-table-recipientlist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!