【问题标题】:SimpleParserException: Unknown function: property.fileNameSimpleParserException:未知函数:property.fileName
【发布时间】:2020-04-30 00:00:44
【问题描述】:

我使用的是 Apache Camel 3.0,在解析文件时出现此错误:

    from("file:" + filePath)
            .routeId("create-ticket")
            .unmarshal(ticketCsv)
            .to("jpa:Ticket")
            .log("Created new ticket with id ${body.id}")
            .convertBodyTo(String.class)
            .setProperty("fileName", simple("${header.CamelFileAbsolutePath}"))
            .setProperty("fileContents", body())
            .to("sql:INSERT INTO DOCUMENT(document_name, document_contents) VALUES(:#${property.fileName}, :#${property.fileContents})");

例外:

org.apache.camel.language.simple.types.SimpleIllegalSyntaxException: 未知函数:位置 0 ${property.fileName}

处的 property.fileName

【问题讨论】:

    标签: apache-camel camel-sql


    【解决方案1】:

    ${property.xxx} 在 2.x 中已弃用。使用${exchangeProperty.xxx},这是函数的正确名称。

    更多变化可以发现in the migration guide

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-28
      • 2013-03-03
      • 2012-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多