Bindy question about quoting

2020-07-03 Thread Mikael Andersson Wigander
Hi

In Bindy when marshalling from object to CSV you can state that it should use 
“quoting” by two options: quote and quoting.
But there’s a third in the factory: quotingEscaped

How should this be interpreted in the context of the other two options?

Also in the documentation there’s an automatic detection when reading CSV data 
to handle the situation where data includes the same character as the separator 
character.
Is there an option to do this when marshalling as well, where data contains the 
same character as used for separation, automatically enclose the column in 
double quotes or something?

Using camel 2.25.1

Thx

M



ApacheCon@Home

2020-07-03 Thread Zoran Regvart
Hi Cameleers,

We are pleased to announce that ApacheCon 2020[1] will be held online,
September 29th through October 1st, 2020.

If you wish to present at the event please submit your talk proposal
for the Camel/Integration track when at ApacheCon 2020 website no
later than Monday, July 13th by noon in the UTC timezone. Please do
not wait for the last minute to submit.

We are most interested to see talks that offer a learning experience
to the attendees, so talks that present new parts of the Camel
ecosystem (Camel K, Camel Quarkus, Camel Kafka Connector), talks
showing off lessons learned, use cases, and visions on where software
integration is heading in the future. We also welcome talk proposals
on other projects in the software integration space.

Attend for free or a small donation to the Apache Software Foundation,
to register, go to the Hopin registration page. Here are some of the
reasons why you should attend:

 - learn about the latest in Apache Camel and the software integration space,
 - get a chance to interact, ask questions and influence roadmaps in
the participant lead discussions, or at the panel on the future of
software integration
 - you can, if you wish to do so, present a 10-minute lightning talk
(no need to submit one now as we will gather lightning talks at the
conference)
 - the conference is free to attend and online, no need for pesky
traveling or expense reimbursements
 - celebrate the Apache Camel and the wider Apache Software Foundation community

If you prefer to read this online we have a blog post[2], or on Twitter[3]

See you there!

[1] https://www.apachecon.com/acna2020/index.html
[2] https://camel.apache.org/blog/2020/07/ApacheCon-2020-at-home/
[3] https://twitter.com/ApacheCamel/status/1278755888346562560
-- 
Zoran Regvart


Merging paths after multicast EIP // Strange Behavior

2020-07-03 Thread Reji Mathews
Am just trying to understand the nature of multicast EIP and its further
processing down.

I have a route as follows

@Override
public void configure() throws Exception {
from("jetty:http://0.0.0.0:8081/testagg?httpMethodRestrict=GET";)
.convertBodyTo(String.class)

.multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
.log("MultiCast Completed body = ${body}")
.setBody(constant("data3"))
.log("After setting new body => ${body}")
.transform(constant("data4"))
.end();

from("direct:a")
.transform(simple("data1")) // instead you can have http
client call here
.delayer(5000)
.end();

from("direct:b")
.transform(simple("data2")) // instead you can have http
client call here
.end();
}



I poked the flow using an http client and I see the following log
being printed even before the http call returns.

2020-07-03 14:31:40.291  INFO 363488 --- [#10 - Multicast] route1
 : MultiCast Completed body =
2020-07-03 14:31:40.291  INFO 363488 --- [ #5 - Multicast] route1
 : After setting new body =>



And strangely, the response received by http client is as follows

=> data1data2data3data4

Am just trying to understand how the flow works. Isn't the 2 logs supposed
to be printed after the multicast aggregator is finished executing? And how
come setBody and Transform EIP isn't replacing the output from the
aggregator "stringConcatStrategy"?


Am using camel v 2.24.0 for this experiment.

Cheers

Reji Mathews


Re: Merging paths after multicast EIP // Strange Behavior

2020-07-03 Thread Claus Ibsen
Hi

You need to end the multicat assuming you only want to call a and b

  
.multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")

should be

  .multicast(stringConcatStrategy).parallelProcessing(true)
  .to("direct:a","direct:b")
   .end()

On Fri, Jul 3, 2020 at 8:37 PM Reji Mathews  wrote:
>
> Am just trying to understand the nature of multicast EIP and its further
> processing down.
>
> I have a route as follows
>
> @Override
> public void configure() throws Exception {
> from("jetty:http://0.0.0.0:8081/testagg?httpMethodRestrict=GET";)
> .convertBodyTo(String.class)
> 
> .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
> .log("MultiCast Completed body = ${body}")
> .setBody(constant("data3"))
> .log("After setting new body => ${body}")
> .transform(constant("data4"))
> .end();
>
> from("direct:a")
> .transform(simple("data1")) // instead you can have http
> client call here
> .delayer(5000)
> .end();
>
> from("direct:b")
> .transform(simple("data2")) // instead you can have http
> client call here
> .end();
> }
>
>
>
> I poked the flow using an http client and I see the following log
> being printed even before the http call returns.
>
> 2020-07-03 14:31:40.291  INFO 363488 --- [#10 - Multicast] route1
>  : MultiCast Completed body =
> 2020-07-03 14:31:40.291  INFO 363488 --- [ #5 - Multicast] route1
>  : After setting new body =>
>
>
>
> And strangely, the response received by http client is as follows
>
> => data1data2data3data4
>
> Am just trying to understand how the flow works. Isn't the 2 logs supposed
> to be printed after the multicast aggregator is finished executing? And how
> come setBody and Transform EIP isn't replacing the output from the
> aggregator "stringConcatStrategy"?
>
>
> Am using camel v 2.24.0 for this experiment.
>
> Cheers
>
> Reji Mathews



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: RoutesBuilder example in camel 3.2

2020-07-03 Thread Claus Ibsen
Hi

context.addRoutes(new RouteBuilder() {

Automatic adds the route, so you dont need to do anything else.
This is what 99,9% of users do.

What you did in 2.x is not common with using the xxxDefinition
classes. That is more for Camel internally.
Use the RouteBuilder classes with the DSL in the configure method.

On Wed, Jul 1, 2020 at 12:28 AM Amol Amlapure
 wrote:
>
> Hello,
>
> We are trying to upgrade to camel from 2.23.2 to 3.2.
> We have a code which adds Routes to CamelContex.
>
> CamelContext cxt = _context.getBean(CamelContext.class);
> if (cxt.getRoute(routeid) == null) {
> RouteDefinition rtDef = new RouteDefinition();
> rtDef.setId(routeid);
> rtDef.from("activemq:topic:" + from).beanRef(beanref, methodname);
> if (to != null)
> rtDef.to(to);
>
> cxt.addRouteDefinition(rtDef);
> }
>
> We were exploring the option to use RoutesBuilder to create and add routes
> to camelContext. but all the examples have implementation like below:
> context.addRoutes(new RouteBuilder() {
> @Override
> public void configure() throws Exception {
> from("direct:start").to("mock:result");
> }
> });
> and RoutesBuilder class has only one abstract method:
> addRoutesToCamelContext
> 
> (CamelContext
> 
>  context)
>
> Could you please help with this?
>
> Thanks,
> Amol



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Making copy of ObjectMapper in JacksonDataFormat in Camel 2.25

2020-07-03 Thread Claus Ibsen
Hi

I think there may be an option to turn off the auto configuration of
the ObjectMapper in Camel.

On Mon, Jun 29, 2020 at 3:52 PM Yifan Wu  wrote:
>
> Dear Camel team,
>
> We have a question about the JacksonDataFormat in Camel 2.25. In 
> JacksonDataFormat class doStart() method, it looks for the single 
> ObjectMapper in the registry. If found, the single ObjectMapper instance 
> would be used and be applied with properties in the JacksonDataFormat 
> instance.
>
> This behavior creates a couple of problems:
>
>   1.  If Camel is used with Spring boot, spring boot would auto config a 
> ObjectMapper with Spring boot namespace properties. By default, Camel 
> JacksonDataFormat would use it and override the Spring boot configuration 
> with Camel's properties.
>   2.  If Camel has multiple steps of "marshal" or "unmarshal" in the routes 
> and they have confliting settings, the last "marshal" or "unmarshal" step 
> setting would take precedence.
>
> I believe those are unexpected behaviors. The question is why 
> JacksonDataFormat does not make a copy of the single ObjectMapper in the 
> registry. In that way, each of them are configured independently.
>
> Thanks
> Yifan
>


-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Camel Help

2020-07-03 Thread Claus Ibsen
Hi

Maybe try to package your apps separated as two .war files with their
own JARs so you dont use shared libs in Tomcat - as that is not a good
practice.

On Mon, Jun 15, 2020 at 7:35 PM Arthur Rubin  wrote:
>
> Hi
> I don't have super, deep experience with Camel but I've been using it very 
> successfully for years.  I have a very simple route that is failing.  The 
> problem below seems to be occurring at the very last step when the message is 
> being written to an MQ.
>
> I have another route running in a separate .war file on the same box and same 
> Tomcat installation which successfully writes to this exact same MQ.  I made 
> sure the pom files are identical so that all the versions of SW are 
> identical.  I checked the two libs folder down under /opt/tomcat/webapps and 
> all the lib versions are the same.  The MQ libs are up in /opt/tomcat/lib and 
> should be shared between the two .war files.  I suspect some sort of 
> classloader issue but I don't know how that could be different across the two 
> .war files.
>
> Any help or insights would be extremely greatly appreciated.
>
> Thanks in advance,
> Arthur.
>
> Here is my version info:
>
> Camel version: 2.15.3
> MQ version: WebSphere MQ 7.5.0.2
> Tomcat version: Apache Tomcat/8.5.9
> Spring version: 5.0.4.RELEASE
> OS:  64 Bit CentOS 7.3
>
> Here is my output and error stack trace:
>
> 2020-06-15 11:15:20,138 INFO  zzzFllRouterForx -  encoding="UTF-8"?> 
>   
> 1
> 414d5120504443353050485331202020135b555eeccf3523
> ZZZ
> ZZZ_PF
> 2020-06-03T15:07:44
> 2020-02-27T19:36:59
>   
>   031507
>   
> 
>   
> XX
>   
>   XX
>   KDTW
>   22R
> 
>   
>   
> Nx 
>   
>   
> 
> 
>   
> 
> 2020-06-15 11:15:20,199 INFO  zzzFllRouterForx - Message has 
> CARRIER_ICAO Header = XXL
> 2020-06-15 11:15:20,209 INFO  zzzFllRouterForx - About to send 
> message to 
> jms:queue:ZZZ.ACARS.UPLINK?connectionFactory=xx1AcarsConnectionFactory
> 2020-06-15 11:15:20,548 INFO  error - Exchange[ExchangePattern: InOnly, 
> BodyType: String, Body:  encoding="UTF-8"?>  1
>
> 414d5120504443353050485331202020135b555eeccf3523
> ZZZZZZ_PF
> 2020-06-03T15:07:442020-02
>
> -27T19:36:59031507  
>   XX  
>   XX  KDTW
>
> 22RNx 
>   ,
>
> CaughtExceptionType: org.springframework.aop.AopInvocationException, 
> CaughtExceptionMessage: AOP configuration seems to be invalid: tried calling 
> method [public abstract javax.jms.Connection
>
> javax.jms.ConnectionFactory.createConnection() throws javax.jms.JMSException] 
> on target [|   com.ibm.mq.jms.MQQueueConnectionFactory  :-
> |   |   XMSC_ADMIN_OBJECT_TYPE :-  17
> |   |   XMSC_ASYNC_EXCEPTIONS  :-  -1
> |   |   XMSC_CLIENT_ID :-  
> |   |   XMSC_CONNECTION_TYPE   :-  1
> |   |   XMSC_CONNECTION_TYPE_NAME  :-  com.ibm.msg.client.wmq
> |   |   XMSC_RTT_DIRECT_AUTH   :-  0
> |   |   XMSC_RTT_PROXY_HOSTNAME:-  
> |   |   XMSC_RTT_PROXY_PORT:-  443
> |   |   XMSC_WMQ_BROKER_CC_SUBQ:-  
> SYSTEM.JMS.ND.CC.SUBSCRIBER.QUEUE
> |   |   XMSC_WMQ_BROKER_CONTROLQ   :-  SYSTEM.BROKER.CONTROL.QUEUE
> |   |   XMSC_WMQ_BROKER_PUBQ   :-  SYSTEM.BROKER.DEFAULT.STREAM
> |   |   XMSC_WMQ_BROKER_QMGR   :-
> |   |   XMSC_WMQ_BROKER_SUBQ   :-  SYSTEM.JMS.ND.SUBSCRIBER.QUEUE
> |   |   XMSC_WMQ_CCDTURL   :-  
> |   |   XMSC_WMQ_CF_DESCRIPTION:-  
> |   |   XMSC_WMQ_CHANNEL   :-  AST.SVRCONN
> |   |   XMSC_WMQ_CLEANUP_INTERVAL  :-  360
> |   |   XMSC_WMQ_CLEANUP_LEVEL :-  1
> |   |   XMSC_WMQ_CLIENT_RECONNECT_OPTIONS  :-  0
> |   |   XMSC_WMQ_CLIENT_RECONNECT_TIMEOUT  :-  1800
> |   |   XMSC_WMQ_CLONE_SUPPORT :-  0
> |   |   XMSC_WMQ_CONNECTION_MODE   :-  1
> |   |   XMSC_WMQ_CONNECTION_NAME_LIST_INT  :-
> |   |   |   0  :-  144.9.57.94(5120)
> |   |   XMSC_WMQ_CONNECTION_TAG:-  [B@33eaacb0
> |   |   XMSC_WMQ_CONNECT_OPTIONS   :-  0
> |   |   XMSC_WMQ_HEADER_COMP   :-
> |   |   |   0  :-  0
> |   |   XMSC_WMQ_LOCAL_ADDRESS :-
> |   |   XMSC_WMQ_MAP_NAME_STYLE:-  true
> |   |   XMSC_WMQ_MAX_BUFFER_SIZE   :-  1000
> |   |   XMSC_WMQ_MESSAGE_RETENTION :-  1
> |   |   XMSC_WMQ_MESSAGE_SELECTION :-  0
> |   |   XMSC_WMQ_MSG_BATCH_SIZE:-  10
> |   |   XMSC_WMQ_MSG_COMP  :-
> |   |   |   0  :-  0
> |   |   XMSC_WMQ_OPT_PUB   :-  false
> |   |   XMSC_WMQ_OUTCOME_NOTIFICATION  :-  true
> |   |   XMSC_WMQ_POLLING_INTERVAL  :-  5000
> |   |   XMSC_WMQ_PROCESS_DURATION  :-  0
> |   |   XMSC_WMQ_PROVIDER_VERSION  :-  unspecified
> |   |   XMSC_WMQ_PUB_ACK_INTERVAL  :-  25
> |   |   XMSC_WMQ_QMGR_CC

Re: Error in camel-http4 after update version from 2.20.2 to 2.25.1

2020-07-03 Thread Claus Ibsen
Hi

That smells like you have mixed versions of Camel JARs on your classpath.
Make sure your upgrade use only 1 version of Camel and its the same version.

On Thu, May 28, 2020 at 7:36 AM Mikhail Lukyanov 
wrote:

> Hello, everyone
>
> I updated the Camel version and ran into a problem with the *http4*
> component.
>
> When I send a message using this component, I get the following error
>
> [image: image.png]
> An error occurs at this location.
> [image: image.png]
> full error in attached file.
>
> Please tell me how I can deal with this error?
> --
> *With best regards, Lukyanov Mikhail*
> *Tel: **+7-909-69-71-547*
>


-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Unit Test with @producer endpoints

2020-07-03 Thread Michael Rambichler
Dear Camel Specialists,

I have an EventNotifier where I send a message to another camel endpoint
(JMS Queue) from a POJO.
This works fine.

But I cannot test this Notifier because of this @Producer Endpoint.

*My EventNotifier:*

public class TrackingEventNotifier extends EventNotifierSupport {
   private static final Logger LOG =
LoggerFactory.getLogger(TrackingEventNotifier.class);

   @Produce("jms:queue:" + TRACKING_QUEUE)
   private JmsProducer trackingProducer;
.

*My Unit Test Route is quite simple:*

@SpringBootTest
@RunWith(CamelSpringBootRunner.class)
@ActiveProfiles("test")
@ContextConfiguration(classes = {
TrackingTestSpring.ContextConfig.class,
TrackingEventNotifier.class, JmsConfiguration.class,
JmsProducer.class, JmsEndpoint.class,
EventMessageBuilderFactory.class, TrackingFileMessageBuilder.class,
TrackingDefaultMessageBuilder.class})
@MockEndpointsAndSkip("jms")
public class TrackingTestSpring

...

@Configuration
public static class ContextConfig extends SingleRouteCamelConfiguration
{

@Bean
public RouteBuilder route() {
return new RouteBuilder() {
public void configure() {

interceptSendToEndpoint("jms:queue")
.log("INTERCEPTED");

from("direct:start")
.routeId("TestRoute")
.log("Content: ${body}")


*Within the UnitTest* I tried to intercept this endpoint. But this does not
work because Camel tries to send to this endpoint which is not configured
during the Unit Tests Run.
Any suggestions how i can avoid this?

20:57:03.221 [main] WARN org.apache.camel.support.EventHelper - Error
notifying event ID-atcw-033195-1593802621850-0-1 exchange
Exchange[ID-atcw-033195-1593802621850-0-1] sent to: file://data took: 12
ms.. This exception will be ignored.
java.lang.IllegalArgumentException: *connectionFactory must be specified*
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:152)
at
org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1629)

Thank you so much for any help


Re: Merging paths after multicast EIP // Strange Behavior

2020-07-03 Thread Reji Mathews
Thanks for that quick response. What if I need to have more processing
after the multi-cast eip? Suppose I want to use the aggregated output and
perform some massaging and push it into another remote service endpoint?

Is that possible?

On Fri, Jul 3, 2020 at 2:56 PM Claus Ibsen  wrote:

> Hi
>
> You need to end the multicat assuming you only want to call a and b
>
>
> .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
>
> should be
>
>   .multicast(stringConcatStrategy).parallelProcessing(true)
>   .to("direct:a","direct:b")
>.end()
>
> On Fri, Jul 3, 2020 at 8:37 PM Reji Mathews  wrote:
> >
> > Am just trying to understand the nature of multicast EIP and its further
> > processing down.
> >
> > I have a route as follows
> >
> > @Override
> > public void configure() throws Exception {
> > from("jetty:http://0.0.0.0:8081/testagg?httpMethodRestrict=GET";)
> > .convertBodyTo(String.class)
> >
>  
> .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
> > .log("MultiCast Completed body = ${body}")
> > .setBody(constant("data3"))
> > .log("After setting new body => ${body}")
> > .transform(constant("data4"))
> > .end();
> >
> > from("direct:a")
> > .transform(simple("data1")) // instead you can have http
> > client call here
> > .delayer(5000)
> > .end();
> >
> > from("direct:b")
> > .transform(simple("data2")) // instead you can have http
> > client call here
> > .end();
> > }
> >
> >
> >
> > I poked the flow using an http client and I see the following log
> > being printed even before the http call returns.
> >
> > 2020-07-03 14:31:40.291  INFO 363488 --- [#10 - Multicast] route1
> >  : MultiCast Completed body =
> > 2020-07-03 14:31:40.291  INFO 363488 --- [ #5 - Multicast] route1
> >  : After setting new body =>
> >
> >
> >
> > And strangely, the response received by http client is as follows
> >
> > => data1data2data3data4
> >
> > Am just trying to understand how the flow works. Isn't the 2 logs
> supposed
> > to be printed after the multicast aggregator is finished executing? And
> how
> > come setBody and Transform EIP isn't replacing the output from the
> > aggregator "stringConcatStrategy"?
> >
> >
> > Am using camel v 2.24.0 for this experiment.
> >
> > Cheers
> >
> > Reji Mathews
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Merging paths after multicast EIP // Strange Behavior

2020-07-03 Thread Claus Ibsen
On Fri, Jul 3, 2020 at 9:13 PM Reji Mathews  wrote:
>
> Thanks for that quick response. What if I need to have more processing
> after the multi-cast eip? Suppose I want to use the aggregated output and
> perform some massaging and push it into another remote service endpoint?
>

Yeah thats the point what comes after end is the output of the multicast



> Is that possible?
>
> On Fri, Jul 3, 2020 at 2:56 PM Claus Ibsen  wrote:
>
> > Hi
> >
> > You need to end the multicat assuming you only want to call a and b
> >
> >
> > .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
> >
> > should be
> >
> >   .multicast(stringConcatStrategy).parallelProcessing(true)
> >   .to("direct:a","direct:b")
> >.end()
> >
> > On Fri, Jul 3, 2020 at 8:37 PM Reji Mathews  wrote:
> > >
> > > Am just trying to understand the nature of multicast EIP and its further
> > > processing down.
> > >
> > > I have a route as follows
> > >
> > > @Override
> > > public void configure() throws Exception {
> > > from("jetty:http://0.0.0.0:8081/testagg?httpMethodRestrict=GET";)
> > > .convertBodyTo(String.class)
> > >
> >  
> > .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
> > > .log("MultiCast Completed body = ${body}")
> > > .setBody(constant("data3"))
> > > .log("After setting new body => ${body}")
> > > .transform(constant("data4"))
> > > .end();
> > >
> > > from("direct:a")
> > > .transform(simple("data1")) // instead you can have http
> > > client call here
> > > .delayer(5000)
> > > .end();
> > >
> > > from("direct:b")
> > > .transform(simple("data2")) // instead you can have http
> > > client call here
> > > .end();
> > > }
> > >
> > >
> > >
> > > I poked the flow using an http client and I see the following log
> > > being printed even before the http call returns.
> > >
> > > 2020-07-03 14:31:40.291  INFO 363488 --- [#10 - Multicast] route1
> > >  : MultiCast Completed body =
> > > 2020-07-03 14:31:40.291  INFO 363488 --- [ #5 - Multicast] route1
> > >  : After setting new body =>
> > >
> > >
> > >
> > > And strangely, the response received by http client is as follows
> > >
> > > => data1data2data3data4
> > >
> > > Am just trying to understand how the flow works. Isn't the 2 logs
> > supposed
> > > to be printed after the multicast aggregator is finished executing? And
> > how
> > > come setBody and Transform EIP isn't replacing the output from the
> > > aggregator "stringConcatStrategy"?
> > >
> > >
> > > Am using camel v 2.24.0 for this experiment.
> > >
> > > Cheers
> > >
> > > Reji Mathews
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Unit Test with @producer endpoints

2020-07-03 Thread Claus Ibsen
You need to mark to skip also for intercept send to endpoint.

On Fri, Jul 3, 2020 at 9:09 PM Michael Rambichler  wrote:
>
> Dear Camel Specialists,
>
> I have an EventNotifier where I send a message to another camel endpoint
> (JMS Queue) from a POJO.
> This works fine.
>
> But I cannot test this Notifier because of this @Producer Endpoint.
>
> *My EventNotifier:*
>
> public class TrackingEventNotifier extends EventNotifierSupport {
>private static final Logger LOG =
> LoggerFactory.getLogger(TrackingEventNotifier.class);
>
>@Produce("jms:queue:" + TRACKING_QUEUE)
>private JmsProducer trackingProducer;
> .
>
> *My Unit Test Route is quite simple:*
>
> @SpringBootTest
> @RunWith(CamelSpringBootRunner.class)
> @ActiveProfiles("test")
> @ContextConfiguration(classes = {
> TrackingTestSpring.ContextConfig.class,
> TrackingEventNotifier.class, JmsConfiguration.class,
> JmsProducer.class, JmsEndpoint.class,
> EventMessageBuilderFactory.class, TrackingFileMessageBuilder.class,
> TrackingDefaultMessageBuilder.class})
> @MockEndpointsAndSkip("jms")
> public class TrackingTestSpring
>
> ...
>
> @Configuration
> public static class ContextConfig extends SingleRouteCamelConfiguration
> {
>
> @Bean
> public RouteBuilder route() {
> return new RouteBuilder() {
> public void configure() {
>
> interceptSendToEndpoint("jms:queue")
> .log("INTERCEPTED");
>
> from("direct:start")
> .routeId("TestRoute")
> .log("Content: ${body}")
>
>
> *Within the UnitTest* I tried to intercept this endpoint. But this does not
> work because Camel tries to send to this endpoint which is not configured
> during the Unit Tests Run.
> Any suggestions how i can avoid this?
>
> 20:57:03.221 [main] WARN org.apache.camel.support.EventHelper - Error
> notifying event ID-atcw-033195-1593802621850-0-1 exchange
> Exchange[ID-atcw-033195-1593802621850-0-1] sent to: file://data took: 12
> ms.. This exception will be ignored.
> java.lang.IllegalArgumentException: *connectionFactory must be specified*
> at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:152)
> at
> org.apache.camel.component.jms.JmsConfiguration.createConnectionFactory(JmsConfiguration.java:1629)
>
> Thank you so much for any help



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Merging paths after multicast EIP // Strange Behavior

2020-07-03 Thread Reji Mathews
Oh i see what you mean! thank you Claus.

On Fri, Jul 3, 2020 at 3:32 PM Claus Ibsen  wrote:

> On Fri, Jul 3, 2020 at 9:13 PM Reji Mathews  wrote:
> >
> > Thanks for that quick response. What if I need to have more processing
> > after the multi-cast eip? Suppose I want to use the aggregated output and
> > perform some massaging and push it into another remote service endpoint?
> >
>
> Yeah thats the point what comes after end is the output of the multicast
>
>
>
> > Is that possible?
> >
> > On Fri, Jul 3, 2020 at 2:56 PM Claus Ibsen 
> wrote:
> >
> > > Hi
> > >
> > > You need to end the multicat assuming you only want to call a and b
> > >
> > >
> > >
> .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
> > >
> > > should be
> > >
> > >   .multicast(stringConcatStrategy).parallelProcessing(true)
> > >   .to("direct:a","direct:b")
> > >.end()
> > >
> > > On Fri, Jul 3, 2020 at 8:37 PM Reji Mathews 
> wrote:
> > > >
> > > > Am just trying to understand the nature of multicast EIP and its
> further
> > > > processing down.
> > > >
> > > > I have a route as follows
> > > >
> > > > @Override
> > > > public void configure() throws Exception {
> > > > from("jetty:http://0.0.0.0:8081/testagg?httpMethodRestrict=GET";)
> > > > .convertBodyTo(String.class)
> > > >
> > >
> .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
> > > > .log("MultiCast Completed body = ${body}")
> > > > .setBody(constant("data3"))
> > > > .log("After setting new body => ${body}")
> > > > .transform(constant("data4"))
> > > > .end();
> > > >
> > > > from("direct:a")
> > > > .transform(simple("data1")) // instead you can have http
> > > > client call here
> > > > .delayer(5000)
> > > > .end();
> > > >
> > > > from("direct:b")
> > > > .transform(simple("data2")) // instead you can have http
> > > > client call here
> > > > .end();
> > > > }
> > > >
> > > >
> > > >
> > > > I poked the flow using an http client and I see the following log
> > > > being printed even before the http call returns.
> > > >
> > > > 2020-07-03 14:31:40.291  INFO 363488 --- [#10 - Multicast] route1
> > > >  : MultiCast Completed body =
> > > > 2020-07-03 14:31:40.291  INFO 363488 --- [ #5 - Multicast] route1
> > > >  : After setting new body =>
> > > >
> > > >
> > > >
> > > > And strangely, the response received by http client is as follows
> > > >
> > > > => data1data2data3data4
> > > >
> > > > Am just trying to understand how the flow works. Isn't the 2 logs
> > > supposed
> > > > to be printed after the multicast aggregator is finished executing?
> And
> > > how
> > > > come setBody and Transform EIP isn't replacing the output from the
> > > > aggregator "stringConcatStrategy"?
> > > >
> > > >
> > > > Am using camel v 2.24.0 for this experiment.
> > > >
> > > > Cheers
> > > >
> > > > Reji Mathews
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -
> > > http://davsclaus.com @davsclaus
> > > Camel in Action 2: https://www.manning.com/ibsen2
> > >
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Error in camel-http4 after update version from 2.20.2 to 2.25.1

2020-07-03 Thread Mikhail Lukyanov
Hi, Claus. Yes, you are right, I found old Camel version in maven
dependensies.

пт, 3 июл. 2020 г., 22:03 Claus Ibsen :

> Hi
>
> That smells like you have mixed versions of Camel JARs on your classpath.
> Make sure your upgrade use only 1 version of Camel and its the same version.
>
> On Thu, May 28, 2020 at 7:36 AM Mikhail Lukyanov 
> wrote:
>
>> Hello, everyone
>>
>> I updated the Camel version and ran into a problem with the *http4*
>> component.
>>
>> When I send a message using this component, I get the following error
>>
>> [image: image.png]
>> An error occurs at this location.
>> [image: image.png]
>> full error in attached file.
>>
>> Please tell me how I can deal with this error?
>> --
>> *With best regards, Lukyanov Mikhail*
>> *Tel: **+7-909-69-71-547*
>>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Spring Boot Starters - how to use them

2020-07-03 Thread Corneliu Chitic
Hi,

I've opened by mistake a Jira ticket for my question: 
https://issues.apache.org/jira/browse/CAMEL-15273
I need your help to understand better Claus's answer:

  *   What is auto-configuration and how is this achieved versus using the 
camel-spring-boot-starter plus the regular components?
  *   I see the definition of camel-http-starter for example which depends on 
camel-spring-boot-starter and spring-boot-starter; isn't the latter redundant 
as the first already defines it as a dependency and actually creates the issue 
I mention?

Thank you, Corneliu
This email is subject to Computaris email terms of use: 
https://www.computaris.com/email-terms-use/


Spring Boot Starters - how to use them

2020-07-03 Thread Corneliu Chitic
Hi,

I've opened by mistake a Jira ticket for my question: 
https://issues.apache.org/jira/browse/CAMEL-15273
I need your help to understand better Claus's answer:
- What is auto-configuration and how is this achieved versus using the 
camel-spring-boot-starter plus the regular components?
- I see the definition of camel-http-starter for example which depends on 
camel-spring-boot-starter and spring-boot-starter; isn't the latter redundant 
as the first already defines it as a dependency and actually creates the issue 
I mention (in the Jira ticket)?

Thank you, Corneliu
This email is subject to Computaris email terms of use: 
https://www.computaris.com/email-terms-use/


Re: Re: Camel to not lookup OSGi services when looking up a bean

2020-07-03 Thread Martin Lichtin

Yes that's the case currently.
OsgiDefaultCamelContext updates the registry and inserts OsgiServiceRegistry as 
the first registry into the list.

It would make more sense to keep the default Camel Bean registry at the head of 
this list.

- Martin

On 01.07.2020 11:48, Jean-Baptiste Onofre wrote:

Ah you mean that Camel OSGi always looking for service first before falling 
back to bean located in the same container as the camel context (spring or 
blueprint) ?

If so, we have to improve camel-core-osgi in the lookup to add an option 
defining the bean resolution order.

Regards
JB


Le 1 juil. 2020 à 11:43, Martin Lichtin  a écrit :

Hi JB

I would, if that was the issue.
However in all the CamelContexts I'm only using regular beans, not calling an 
OSGi service.

Ideally there should be a way to tell Camel to not look into the OSGi registry 
when resolving bean names. But seems hardcoded?

- Martin

On 29.06.2020 09:34, Jean-Baptiste Onofre wrote:

Hi Martin,

What about implementing a caching service as proxy in front of your bean ?
It’s pretty easy with Karaf (and you have a caching service on demand).
So, the Camel Route will always request the bean, but the bean logic can be 
cached.

Thoughts ?

Regards
JB


Le 29 juin 2020 à 09:29, Martin Lichtin  a écrit :

Thanks.
Unfortunately the cache does not seem to kick in.
Also it's supposed to be turned on by default (xsd: "Caches the bean lookup, to 
avoid lookup up bean on every usage. Default value: true".

The bean is called from a REST CamelContext configured such as

 
   
 
   
 
   

I don't see this bean lookup behaviour for "normal" CamelContexts, so caching 
seems to work, but not in this case here.

- Martin

On 27.06.2020 07:59, Claus Ibsen wrote:

You can cache the bean so the lookup is only done once.

to("bean:foo?cache=true")

In Camel 3.x there is a new scope option instead

On Thu, Jun 25, 2020 at 5:09 PM Martin Lichtin
 wrote:

Is there a way to tell Camel to not search OSGi services when looking up a bean?

It seems by default it's continuously looking up the service references, would 
like to turn this off.

Stack TraceSample CountPercentage(%)
java.util.TreeMap.getEntryUsingComparator(Object)173.753
 java.util.TreeMap.getEntry(Object)173.753
java.util.TreeMap.get(Object)173.753
org.apache.felix.framework.ServiceRegistrationImpl.getProperty(String) 11
2.428
org.apache.felix.framework.ServiceRegistrationImpl$ServiceReferenceMap.get(Object)
 112.428
org.apache.felix.framework.capabilityset.CapabilitySet.match(Set, SimpleFilter) 
   112.428
org.apache.felix.framework.capabilityset.CapabilitySet.match(SimpleFilter, 
boolean)91.987
org.apache.felix.framework.ServiceRegistry.getServiceReferences(String, 
SimpleFilter)91.987
org.apache.felix.framework.Felix.getServiceReferences(BundleImpl, String, 
String, boolean)91.987
org.apache.felix.framework.Felix.getAllowedServiceReferences(BundleImpl, 
String, String, boolean)91.987
org.apache.felix.framework.BundleContextImpl.getServiceReferences(String, 
String)91.987
org.apache.camel.core.osgi.OsgiServiceRegistry.lookupByName(String) 91.987
org.apache.camel.impl.CompositeRegistry.lookupByName(String)9 1.987
org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByName(String) 
91.987
org.apache.camel.component.bean.RegistryBean.lookupBean()9 1.987
org.apache.camel.component.bean.RegistryBean.getBean()91.987
org.apache.camel.component.bean.AbstractBeanProcessor.process(Exchange, 
AsyncCallback)91.987
org.apache.camel.component.bean.BeanProcessor.process(Exchange, AsyncCallback)  
  91.987
org.apache.camel.component.bean.BeanProducer.process(Exchange, AsyncCallback)   
 91.987
org.apache.camel.processor.SendProcessor.process(Exchange, AsyncCallback)9  
  1.987
org.apache.camel.processor.RedeliveryErrorHandler.process(Exchange, 
AsyncCallback)91.987
org.apache.camel.processor.CamelInternalProcessor.process(Exchange, 
AsyncCallback)91.987
org.apache.camel.processor.CamelInternalProcessor.process(Exchange, 
AsyncCallback)91.987
org.apache.camel.processor.DelegateAsyncProcessor.process(Exchange) 91.987
org.apache.camel.http.common.CamelServlet.doService(HttpServletRequest, 
HttpServletResponse)91.987

- Martin