0

我使用 sql 端点从骆驼运行查询。但是,当我再次调用 CamelSqlRowCount 时,它并没有改变:

@Component
public class TestSQLRowCount  extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("timer://testsql?fixedRate=true&period=5000")
            .to("sql:select 1 from dual_seq?dataSource=#dataSource&outputHeader=TEST_ROW_COUNT&outputType=SelectOne")
            .log("OLD_AUDIT_DATA ${headers.TEST_ROW_COUNT} - ROW_COUNT ${headers.CamelSqlRowCount}")
            .to("sql:select 1 from dual_seq where 0 = 1?dataSource=#dataSource&outputHeader=TEST_ROW_COUNT2&outputType=SelectOne")
            .log("OLD_AUDIT_DATA ${headers.TEST_ROW_COUNT2} - ROW_COUNT ${headers.CamelSqlRowCount}")
            .end();
    }
}

输出:2021-12-01 14:20:02.880 INFO OLD_AUDIT_DATA 1 - ROW_COUNT 1
2021-12-01 14:20:02.944 INFO OLD_AUDIT_DATA - ROW_COUNT 1

当我切换语句时:

@Component
public class TestSQLRowCount  extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("timer://testsql?fixedRate=true&period=5000")
            .to("sql:select 1 from dual_seq where 0 = 1?dataSource=#dataSource&outputHeader=TEST_ROW_COUNT2&outputType=SelectOne")
            .log("OLD_AUDIT_DATA ${headers.TEST_ROW_COUNT2} - ROW_COUNT ${headers.CamelSqlRowCount}")
            .to("sql:select 1 from dual_seq?dataSource=#dataSource&outputHeader=TEST_ROW_COUNT&outputType=SelectOne")
            .log("OLD_AUDIT_DATA ${headers.TEST_ROW_COUNT} - ROW_COUNT ${headers.CamelSqlRowCount}")
            .end();
    }
}

输出:2021-12-01 14:22:25.021 INFO OLD_AUDIT_DATA - ROW_COUNT 0
2021-12-01 14:22:25.076 INFO OLD_AUDIT_DATA 1 - ROW_COUNT 0

如何重置标题?

提前致谢

巴特

4

0 回答 0