Data corrupting in multicast EIP

2020-08-04 Thread Reji Mathews
Hello community

I am just playing around with multicast EIP. I have a route like follows


http://camel.apache.org/schema/spring;>

http://0.0.0.0:8081/emptybranch?httpMethodRestrict=GET"/>

java.lang.Exception















language[simple:json]











java.lang.Exception







language[simple:${body}]


select * from myschema.address






   


java.lang.Exception







language[simple:${body}]














I use an aggregator as follows to stack up output from each path.
Aggregator is as follows

public class FlowMergeAggregator implements AggregationStrategy {
 @Override
 public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
 if(oldExchange == null) {
 Map aggregatedBody = new HashMap<>();
 aggregatedBody.put(newExchange.getExchangeId(),
newExchange.getIn().getBody());
 newExchange.getIn().setBody(aggregatedBody);
 return newExchange;
 }

 Map collectedData = (Map)
oldExchange.getIn().getBody();
 collectedData.put(newExchange.getExchangeId(),
 newExchange.getIn().getBody());
 oldExchange.getIn().setBody(collectedData);
 return oldExchange;
 }
}

On testing this integration, my output looks a bit weird for one of the
branches.
 
{"ID-company-staging-1596055243765-59-12":[{"id":207,"countryname":"canada","cityname":"markham","postalcode":"L3R5A4"},{"id":208,"countryname":"uk","cityname":"london","postalcode":"N5V
0A4"},{"id":209,"countryname":"uk","cityname":"london","postalcode":"N5V
0A4"},{"id":210,"countryname":"uk","cityname":"london","postalcode":"N5V
0A4"},{"id":211,"countryname":"uk","cityname":"london","postalcode":"N5V
0A4"},{"id":212,"countryname":"uk","cityname":"london","postalcode":"N5V

Re: Unmarshal Map to POJO with Jackson data format

2020-08-04 Thread Mark Nuttall
you could add an inline processor and specifically call the ObjectMapper
method you need. Or some variant of that. While it is not an OOTB camel
component, it is one less conversion.

On Mon, Aug 3, 2020 at 9:49 PM Jeremy Ross  wrote:

> Hey Sneharghya,
>
> Thanks, that is my workaround. Just hoping for something a little more
> efficient.
>
> On Mon, Aug 3, 2020 at 2:36 PM Sneharghya Pathak 
> wrote:
>
> > Hi Jeremy,
> >
> > The way I fixed it was to first convert it to json and then to a pojo,
> like
> > so:
> >
> > .marshal().json(JsonLibrary.Jackson)
> .unmarshal().json(JsonLibrary.Jackson,
> > MyClass.class)
> >
> > Regards,
> > Sneharghya
> >
> >
> > On Mon, 3 Aug 2020, 10:25 pm Jeremy Ross, 
> wrote:
> >
> > > Howdy,
> > >
> > > Is it possible to unmarshal from a Map to POJO with the Jackson data
> > > format? When I pass it a map, I get:
> > >
> > > org.apache.camel.InvalidPayloadException: No body available of type:
> > > java.io.InputStream but has value...
> > >
> > > ObjectMapper#convertValue supports this, but I'm not sure how to play
> > nice
> > > with the data format. Any tips are appreciated!
> > >
> > > Jeremy
> > >
> >
>


Re: camel-undertow in Camel > 3.2

2020-08-04 Thread Gerald Kallas
Tx, Andrea. A pity :-/

A reason more that the servlet consumer basic auth gets working again, see 
https://issues.apache.org/jira/browse/KARAF-6772

>From Karaf 4.2.9 this doesn't work any longer due to some reasons.

> Andrea Cosentino  hat am 04.08.2020 12:06 geschrieben:
> 
>  
> Hello,
> 
> Yes. The reason is here: https://issues.apache.org/jira/browse/CAMEL-14939
> 
> From 2.1.0 they won't support OSGi anymore and more and more third party
> libraries are doing the same thing.
> 
> Il giorno mar 4 ago 2020 alle ore 12:04 Gerald Kallas
>  ha scritto:
> 
> > Hi folks,
> >
> > I was trying to setup a Blueprint route with undertow. In the
> > documentation I saw
> >
> > "The following components is no longer supported in OSGi and has been
> > removed from the Camel Karaf features file: camel-undertow, ... ."
> >
> > Does that finally mean that undertow could no longer be used in Camel
> > Blueprint? Several things seem to be much easier with undertow than jetty ..
> >
> > Best
> > - Gerald
> >


Re: camel-undertow in Camel > 3.2

2020-08-04 Thread Andrea Cosentino
Hello,

Yes. The reason is here: https://issues.apache.org/jira/browse/CAMEL-14939

>From 2.1.0 they won't support OSGi anymore and more and more third party
libraries are doing the same thing.

Il giorno mar 4 ago 2020 alle ore 12:04 Gerald Kallas
 ha scritto:

> Hi folks,
>
> I was trying to setup a Blueprint route with undertow. In the
> documentation I saw
>
> "The following components is no longer supported in OSGi and has been
> removed from the Camel Karaf features file: camel-undertow, ... ."
>
> Does that finally mean that undertow could no longer be used in Camel
> Blueprint? Several things seem to be much easier with undertow than jetty ..
>
> Best
> - Gerald
>


camel-undertow in Camel > 3.2

2020-08-04 Thread Gerald Kallas
Hi folks,

I was trying to setup a Blueprint route with undertow. In the documentation I 
saw

"The following components is no longer supported in OSGi and has been removed 
from the Camel Karaf features file: camel-undertow, ... ."

Does that finally mean that undertow could no longer be used in Camel 
Blueprint? Several things seem to be much easier with undertow than jetty ..

Best
- Gerald