Apache camel 带正则表达式的Apache Camel拦截器
这是我的路线。我想向Azure blob发送一个文件。我想将blob的名称设置为不带扩展名的文件名。我还想从文件名中过滤掉空白。我正在考虑使用拦截器Apache camel 带正则表达式的Apache Camel拦截器,apache-camel,Apache Camel,这是我的路线。我想向Azure blob发送一个文件。我想将blob的名称设置为不带扩展名的文件名。我还想从文件名中过滤掉空白。我正在考虑使用拦截器 from("file://C:/camel/source1").recipientList(simple("azure-blob://datastorage/container1/${header.fileName}?credentials=#credentials&operation=updateBlockBlob")) 我只想为upd
from("file://C:/camel/source1").recipientList(simple("azure-blob://datastorage/container1/${header.fileName}?credentials=#credentials&operation=updateBlockBlob"))
我只想为updateBlockBlob操作调用拦截器
interceptSendToEndpoint("^(azure-blob:).+(operation=updateBlockBlob)").setHeader("fileName",simple("${file:onlyname.noext}")).convertBodyTo(File.class)
上述代码与interceptFrom()一起使用
我尝试用类似azure*的通配符替换正则表达式,即interceptSendToEndpoint(“azure*”)。它不起作用
上面的代码有什么问题?是因为收件人名单吗
simple还有哪些功能可以删除空白?
是否有更好的方法动态生成blob名称?这是来自camel on interceptors的文档
- 截取路由中的传入交换
- interceptSendToEndpoint,在Exchange即将启动时进行拦截 被发送到给定的端点
interceptSendToEndpoint("^(azure-blob:).+(operation=updateBlockBlob)").convertBodyTo(File.class)
interceptFrom().setHeader("fileName",simple("${file:onlyname.noext}".replaceAll("[^a-zA-Z\d]")))
也设法消除了空白这是来自camel on interceptors的文档
- 截取路由中的传入交换
- interceptSendToEndpoint,在Exchange即将启动时进行拦截 被发送到给定的端点
interceptSendToEndpoint("^(azure-blob:).+(operation=updateBlockBlob)").convertBodyTo(File.class)
interceptFrom().setHeader("fileName",simple("${file:onlyname.noext}".replaceAll("[^a-zA-Z\d]")))
也设法去掉了空白