Apache camel 阿帕奇骆驼到波乔的路线
我有一个帐户实例的格式与我需要的格式不同。我在试骆驼 但就是没有得到 基本认识。我已成功导入未格式化的实例,并将其显示在日志中。 我曾尝试使用处理器从身体中提取数据,并将其直接发送到POJO。 POJO使用固定长度的定义。这是将数据传递到大型机数据库所需要的。请给我指个方向 收到消息:12 xzz200zzzzzApache camel 阿帕奇骆驼到波乔的路线,apache-camel,Apache Camel,我有一个帐户实例的格式与我需要的格式不同。我在试骆驼 但就是没有得到 基本认识。我已成功导入未格式化的实例,并将其显示在日志中。 我曾尝试使用处理器从身体中提取数据,并将其直接发送到POJO。 POJO使用固定长度的定义。这是将数据传递到大型机数据库所需要的。请给我指个方向 收到消息:12 xzz200zzzzz public class AccountAddRoute extends RouteBuilder{ public void configure() throws Except
public class AccountAddRoute extends RouteBuilder{
public void configure() throws Exception {
DataFormat bindy = new BindyFixedLengthDataFormat(AccountAddData.class);
from("direct:input")
.log(" In AccountAddRoute ")
.marshal(bindy)
.log("Got message:${body}");
.to(???????_)
My Apologies. Not a good explanation of what I am trying to do.
I have An Account POJO that is being built thru FORM. I need to save
it in 2 different formats. Incoming just the way it is and in a
fixed format to be sent to Mainframe. This is what I get from the form
Code1=12 x , Code2=200
I initiate rout by sending body of form in accountAddData Instance
producerTemplate.sendBody("direct:input", accountAddData);
public class AccountAddRoute extends RouteBuilder{
public void configure() throws Exception {
DataFormat bindy = new BindyFixedLengthDataFormat(AccountAddData.class);
from("direct:input")
.log(" In AccountAddRoute ")
.marshal(bindy)
.log("Got message:${body}");
.to(???????_)
Just for Testing purposes my Account Bindy Pojo is below
@DataField(pos =1, length=15, paddingChar='Z', trim=true, align="L")
private String Code1;
@DataField(pos =2, length=10, paddingChar='Z', align="L")
private String Code2;
When I log Body, I get >>
Got message:12 xZZ200ZZZZZZZ
However, my question is how do I create the new Instance in the
BINDY Format SO I can use it
==========
I did add processor and when I do display of body in processor >>
log.info(" In MyProcessor = " + exchange.getIn().getBody());
In MyProcessor = [B@3338b2b9
I was expecting to have the getter/setters available after getBody for the
accoountAddData instance. But obviously I don’t have a good understanding
of camel
exchange.getIn().getBody().????
您正在尝试解组传入的数据吗?如果是这种情况,那么您需要使用以下代码
from("direct:input")
.log(" In AccountAddRoute ")
.unmarshal(new BindyFixedLengthDataFormat(AccountAddData.class))
.log("Got message:${body}");
.to(???????_)