camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gowtham <>
Subject REG: @Link annotation not writing the data for the linked records
Date Sat, 13 May 2017 17:35:03 GMT
I'm using a @Link annotation of camel-bindy to Link some of the records in my
class to another class.
It works fine with the headers part. But the data is not written in the file
for the rest of the records.
I'm using a camel-bindy version of 2.8.3.

This is my csv file contents,

gowtham.alaguraj,Gowtham Alaguraj,11149466,9442320741

This is my Input Pojo

@CsvRecord(separator = ",", skipFirstLine = true)
public class PersonInput {

	@DataField(pos = 1) private String id;
	@DataField(pos = 2) private String name;
	@DataField(pos = 3) private String number;
	@DataField(pos = 4) private String mobile;
	//  Getters and
	//               Setters

These are my output pojos

@CsvRecord(separator = "`", generateHeaderColumns = true)
public class PersonOutput {

	@DataField(pos = 0,columnName = "Employee ID") private String empId;
	@DataField(pos = 1,columnName = "Employee Name") private String empName;
	@DataField(pos = 2,columnName = "Employee Number") private String
	@DataField(pos = 3,columnName = "Employee Contact Number") private String
	@Link Person person;
	//  Getters and
	//               Setters


public class Person {
	@DataField(pos = 4, columnName="Employee Designation") private String
	@DataField(pos = 5, columnName="Employee Role") private String empRole;
	//  Getters and
	//               Setters


The Final output I got was,

Employee ID,Employee Name,Employee Number,Employee Contact Number,Employee
Designation,Employee Role
gowtham.alaguraj,Gowtham Alaguraj,11149466,9442320741

But I don't get the point why only the headers of the linked classes are
written in the file not the data. Even I have set the data too for that in
my processor.

This is my logic i have written in my Processor,

I get the exchange body as List<PersonInput>. And iterate it using Java 8
Streams and,
call a transform for each PersonInput so that I get a List<PersonOutput>.

public PersonOutput transform(PersonInput csvInput) {
		PersonOutput csvOutput=new PersonOutput();
		Person person=new Person();
		person.setEmpDesignation("Application Development Analyst");
		return csvOutput;

Then finally I set the exchange body as the List<PersonOutput> object formed
as above.

I'm using a camel-bindy of version 2.8.3. And I can't use a higher version
than that. Can you tell me If I'm wrong at any point or just missed anything

If I'm right, then it's a just problem with the camel version, suggest me an
alternate way to achieve this.

Gowtham Alaguraj
View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message