Hi

Thanks but it doesn't work.

Same issue:

Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter 
for property: header as there isn't a setter method with same type: 
java.lang.String nor type conversion possible: No type converter available to 
convert from type: java.lang.String to the required type: java.lang.String[] 
with value 
status,trade_date,sec_settle_date,fund_name,client_account,trade_reference,uti,broker_id,security_code,isin,fee,quantity,currency,market_price,loan_value,trade_time,trade_venue


/M

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Monday, September 20th, 2021 at 06:38, Claus Ibsen <claus.ib...@gmail.com> 
wrote:

> Hi
>
> > in.setHeader("ColumnNames", new ArrayList<>(headers));
>
> Store that header as a single string with comma separated values,
>
> On Sun, Sep 19, 2021 at 5:37 PM Mikael Andersson Wigander
>
> mikael.andersson.wigan...@pm.me.invalid wrote:
>
> > HI
> >
> > I'm converting a route from Camel 2.25.0 Spring Boot to latest Quarkus.
> >
> > The route parses a CSV file, splits it and use either headers if exist or 
> > creates headers if not, sends it to a bean for further processing ending up 
> > as amessage in a JMS.
> >
> > This was working fine but now when I run it in Quarkus I receive the 
> > following Exception:
> >
> > Caused by: java.lang.IllegalArgumentException: Could not find a suitable 
> > setter for property: header as there isn't a setter method with same type: 
> > java.lang.String nor type conversion possible: No type converter available 
> > to convert from type: java.lang.String to the required type: 
> > java.lang.String[] with value [status, trade_date, sec_settle_date, 
> > fund_name, client_account, trade_reference, uti, broker_id, security_code, 
> > isin, fee, quantity, currency, market_price, loan_value, trade_time, 
> > trade_venue]
> >
> > Route:
> >
> > from(seda("textImporter"))
> >
> > .description("DATA-IMPORTER-TEXT",
> >
> > "Imports data from text files such as .txt, .csv, .tab",
> >
> > "en")
> >
> > .toD("dataformat:csv:unmarshal?delimiter=${header.FileSplitter}&useOrderedMaps=${header.UseHeader}")
> >
> > .split()
> >
> > .body()
> >
> > .streaming()
> >
> > .parallelProcessing(false)
> >
> > .process(exchange -> {
> >
> > final Message in = exchange.getIn();
> >
> > final Map<String, Object> body = new LinkedHashMap<>();
> >
> > if (!in.getHeader("UseHeader", Boolean.class)) {
> >
> > final List list = in.getBody(List.class);
> >
> > IntStream.range(0, list.size())
> >
> > .forEach(i -> body.put(i + "", list.get(i)));
> >
> > } else {
> >
> > body.putAll(in.getBody(Map.class));
> >
> > }
> >
> > final Set<String> headers = body.keySet();
> >
> > in.setHeader("ColumnNames", new ArrayList<>(headers));
> >
> > final String idPath = in.getHeader("IdPath", String.class);
> >
> > in.setHeader("InternalReference", body.get(idPath));
> >
> > final List<Map<String, Object>> newList = new ArrayList<>(Set.of(body));
> >
> > in.setBody(newList, List.class);
> >
> > })
> >
> > .toD("dataformat:csv:marshal?header=${header.ColumnNames}")
> >
> > .convertBodyTo(String.class)
> >
> > .log(LoggingLevel.DEBUG, "${body}")
> >
> > .bean(XSDMapping.class, "create")
> >
> > .marshal(jaxbDataFormat)
> >
> > .convertBodyTo(String.class)
> >
> > .to("{{jms.queue.outgoing}}")
> >
> > .to(log("FILE-IMPORTER-TEXT").level("DEBUG")
> >
> > .groupInterval(5000L)
> >
> > .groupActiveOnly(true))
> >
> > .choice()
> >
> > .when(simple("${header.CamelSplitComplete} == true"))
> >
> > .log("Number of records split: ${header.CamelSplitSize}")
> >
> > .log("Importing complete: ${header.CamelFileName}")
> >
> > .endChoice()
> >
> > .end();
> >
> > Using Quarkus 2.2.3.Final on Java 11, Camel 3.11.1
> >
> > /M
>
> --
>
> Claus Ibsen
> -----------
>
> http://davsclaus.com @davsclaus
>
> Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to