最近刚学了camle,写了几个接口,把用到的一些关键的组件记录一下
(此篇博客仅作为个人笔记)
1、from("quartz2:10m/40mEverySundayandMonday?cron=0+10,40+*+?+*+1,2")//每周日周一的每小时的10分、40分触发
cron=0+0+20+*+*+?每天晚上8点触发
关于quartz触发时间的设置,可参考
https://www.cnblogs.com/superman66/p/4565723.html
http://www.bejson.com/othertools/cron/
POM:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz2</artifactId>
</dependency>
其他时间设置:from("timer://foo?period=10000s")
2、@Value("${set.duns}")
private String duns;
从properities里面读取参数 /F179
3、把数据放入mq(F179)
.to("jms:queue:DSM.EDI.OUT")
4、把数据放入rocketmq(F192)
直接通过bean(.class)获取插入
properity配置信息:
5、unmarshal与marshal
JAXBContext jaxbContext01 = JAXBContext.newInstance(com.***.esb.messagebody.WdfList.class);
JaxbDataFormat jaxbDataFormat01 = new JaxbDataFormat(jaxbContext01);
.unmarshal(jaxbDataFormat01)//转成java对象
.marshal(jaxbDataFormat01)//转成xml
6、加参数
.toD("sql:select POSITION_KEY,SUBJECT_CODE,AMOUNT,SPECIAL_G,Tax_Code,Cost_Center,Assignment,sap_Text,CO_CODE from TI_OUTPUTCLAIM_SUBJECT where INVOICE_ID = '${body[ID]}' ORDER BY ID")
7、.split(body())//分割
.setProperty("body01", simple("${body}"))//暂存body *****F167
.setProperty("filename", simple("${body[FILE_NAME]}"))获取想要的body并暂存
//.setBody(simple("${body[ID]}"))//设置body,继续路由
exchange.getProperty("body01")//取出body
8、设置数据库主键:UUID与sequence等