Espresso
Espresso

Reputation: 5739

camel bindy csv with field concatination?

I'm trying to parse a log file that has csv separated recs. All lines are to be separated to 8 fields. In some lines the last field, Field8 ,has extra commas which has to be ignored (should not be separated). Problem line lines are like below(note Field8):

Test, Field2,5731960,Field4,,4,32,Field8 MyOp ( abc,def  )

I can't ask the log format to be changed. Is there a way in bindy to say from pos 8 to pos 100, put it in pos 8? I prefer spring dsl. I want to avoid custom parser if one exist already.

@CsvRecord(separator = ",")
public class SysActivity{
    ....
    @DataField(pos = 8, required = true) // is there a way I can mention pos8 till end of line
    protected String logMessage;
}

Using camel 10.0

Upvotes: 1

Views: 328

Answers (2)

Claus Ibsen
Claus Ibsen

Reputation: 55750

No this is not possible. But I think its maybe a valid use-case that I think a few others in the past has asked about.

I have logged a ticket to have this improved in the future https://issues.apache.org/jira/browse/CAMEL-6381

Upvotes: 1

0x41ndrea
0x41ndrea

Reputation: 385

In camel you can use the splitter in order to split a message body. In this case you can use a regular expression in the splitter as described in the splitter doc.

Upvotes: 0

Related Questions