Re: AW: MDC logging for different route

2016-12-20 Thread intelccdodemo
Is there a way to define custom threadpool that will be used by Seda based
route and EIP (Splitter). Then i may need to customize that threadpool to
copy context with custom information ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/MDC-logging-for-different-route-tp5791730p5791755.html
Sent from the Camel - Users mailing list archive at Nabble.com.


how to change the logging level dynamically

2016-12-20 Thread mkrishnap
Hi,

   i want to change the logging level dynamically by another java class.

step1:
  we have written a logger, in this class. we are using the
log4j.properties for logger configuration
(http://camel.apache.org/how-do-i-use-log4j.html)

 public class MyLoggingSentEventNotifer extends
EventNotifierSupport {
 
public void notify(EventObject event) throws Exception {
 
if (event instanceof ExchangeSentEvent) {

ExchangeSentEvent sent = (ExchangeSentEvent) event;
String endpoint = sent.getEndpoint() +"";
if(endpoint.startsWith("Endpoint[cxf")){
log.info("Operation name : "+ ((ExchangeSentEvent)
event).getExchange().getProperty("OPERATION_NAME") + "  Took " +
sent.getTimeTaken() + " millis to send to: " + sent.getEndpoint() );
} else {
log.debug("Operation name : "+ ((ExchangeSentEvent)
event).getExchange().getProperty("OPERATION_NAME") + " Took " +
sent.getTimeTaken() + " millis to send to: " + sent.getEndpoint() );
}
}
}

public boolean isEnabled(EventObject event) {
// we only want the sent events
return event instanceof ExchangeSentEvent;
}
 
protected void doStart() throws Exception {
// noop
}
 
protected void doStop() throws Exception {
// noop
}
}

  step2:  we want to change the logging mechanism dynamically by another
interface. 

can anyone please explain me, what are ways to achieve it?

Thanks,
Murali
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/how-to-change-the-logging-level-dynamically-tp5791782.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel-bindy issue with header and missing locale

2016-12-20 Thread dabby11
Hi,

  I'm developing a route with Camel 2.16.1 that uses Bindy to process a file
with fixed length records. The file consists of a header and many rows.
I'm unmarshalling the stream with the following data format:

BindyFixedLengthDataFormat bindy = new
BindyFixedLengthDataFormat(DocumentRow.class);
bindy.setLocale("default");

and my model classes are something like:

@FixedLengthRecord(header = DocumentHeader.class)
public class DocumentRow {

...
   
@DataField(pos = 10, pattern="+0.00;-0.00",
precision = 2, length = 13, decimalSeparator = ",")
private BigDecimal value;

...
}

@FixedLengthRecord
public class DocumentHeader {

...

@DataField(pos = 365, pattern="+.00;-.00",
precision = 2,  length = 16, decimalSeparator = ",")
private BigDecimal total;

...

}

Bindy fails to parse the DocumentHeader.total field with a
java.lang.NumberFormatException.

It seems the locale specified with bindy.setLocale("default") is not passed
to the inner headerFactory in the BindyFixedLengthDataFormat and Bindy tries
to parse the number calling BigDecimal constructor, instead of parsing it
with DecimalFormat.
Indeed, if I execute the following (ugly!) code before creating the route:

  bindy.getFactory();
   
  Field field =
BindyFixedLengthDataFormat.class.getDeclaredField("headerFactory");
  field.setAccessible(true);
  BindyFixedLengthFactory headerFactory =
(BindyFixedLengthFactory)field.get(bindy);
   
  headerFactory.setLocale(bindy.getLocale());

to force the locale, everything's fine.

So I think that in BindyFixedLengthDataFormat.createModelFactory() after
headerFactory creation there should be a call to

headerFactory.setLocale(getLocale())

or something like that (and a similar line for footerFactory).

I checked 2.17.x and 2.18.x branches of BindyFixedLengthDataFormat.java and
there's not something like this.

So the question is: is this really an issue with Bindy or should I achieve
this result in a different way ?

Regards,
  Marco 



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-bindy-issue-with-header-and-missing-locale-tp5791754.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AW: MDC logging for different route

2016-12-20 Thread intelccdodemo
When i override CustomUnitOfWork then able to add an extra key-value pair but
what i wanted to know how would i make it persistent through mdc from one
route to 2nd to 3rd and so on .. as long as request is valid ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/MDC-logging-for-different-route-tp5791730p5791750.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-quartz failed camel route creation when database is unreachable

2016-12-20 Thread Rachid KRAIEM
Hello,

Yes, it's my message

Cordialement,

*Rachid KRAIEM*




2016-12-20 17:45 GMT+01:00 Rachid KRAIEM [via Camel] <
ml-node+s465427n5791747...@n5.nabble.com>:

> Hi,
>
> Given the best practice is not to change the APIs, can you raise a JIRA
> that contain this solution and include him in the next release of
> camel-quartz ?
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-
> route-creation-when-database-is-unreachable-tp5789552p5791747.html
> To unsubscribe from camel-quartz failed camel route creation when database
> is unreachable, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552p5791749.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-quartz failed camel route creation when database is unreachable

2016-12-20 Thread Rachid KRAIEM
Hi,

Given the best practice is not to change the APIs, can you raise a JIRA that
contain this solution and include him in the next release of camel-quartz ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-quartz-failed-camel-route-creation-when-database-is-unreachable-tp5789552p5791747.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel-bindy issue with header and missing locale

2016-12-20 Thread dabby11
Hi,

  I'm developing a route with Camel 2.16.1 that uses Bindy to process a file
with fixed length records. The file consists of a header and many rows.
I'm unmarshalling the stream with the following data format:

BindyFixedLengthDataFormat bindy = new
BindyFixedLengthDataFormat(DocumentRow.class);
bindy.setLocale("default");

and my model classes are something like:

@FixedLengthRecord(header = DocumentHeader.class)
public class DocumentRow {

...

@DataField(pos = 10, pattern="+0.00;-0.00", precision = 
2,
length = 13, decimalSeparator = ",")
private BigDecimal value;

...
}

@FixedLengthRecord
public class DocumentHeader {

...

@DataField(pos = 365, pattern="+.00;-.00",
precision = 2,  length = 16, decimalSeparator = ",")
private BigDecimal total;

...

}

Bindy fails to parse the DocumentHeader.total field with a
java.lang.NumberFormatException.

It seems the locale specified with bindy.setLocale("default") is not passed
to the inner headerFactory in the BindyFixedLengthDataFormat and Bindy tries
to parse the number calling BigDecimal constructor, instead of parsing it
with DecimalFormat.
Indeed, if I execute the following (ugly!) code before creating the route:

  bindy.getFactory();

  Field field =
BindyFixedLengthDataFormat.class.getDeclaredField("headerFactory");
  field.setAccessible(true);
  BindyFixedLengthFactory headerFactory =
(BindyFixedLengthFactory)field.get(bindy);

  headerFactory.setLocale(bindy.getLocale());

to force the locale, everything's fine.

So I think that in BindyFixedLengthDataFormat.createModelFactory() after
headerFactory creation there should be a call to

headerFactory.setLocale(getLocale())

or something like that (and a similar line for footerFactory).

I checked 2.17.x and 2.18.x branches of BindyFixedLengthDataFormat.java and
there's not something like this.

So the question is: is this really an issue with Bindy or should I achieve
this result in a different way ?

Regards,
  Marco



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-bindy-issue-with-header-and-missing-locale-tp5791746.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-core not detecting converters on bundle restart in karaf4

2016-12-20 Thread yogu13
Is this a defect should i raise a JIRA ?


Regards,
-Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-core-not-detecting-converters-on-bundle-restart-in-karaf4-tp5791503p5791744.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Json format disturbed // Rest DSL + Jackson

2016-12-20 Thread yogu13
Hello Reji,

I suspect the postman httpclient is removing the doublequotes before it
posts the message. You can confirm by checking the httprequest sent using
any tunnel of your choice, I have used nettool in past and work for me.

Regards,
-Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/Json-format-disturbed-Rest-DSL-Jackson-tp5791716p5791743.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel High CPU Usages

2016-12-20 Thread Claus Ibsen
Are all those routes consuming from files?

That is a lot of file consumers to have in one JVM. By default they
get 1 private thread each, instead you can share a thread pool among
them so they reuse threads. And set a sensitive number of threads in
that pool.



On Tue, Dec 20, 2016 at 10:24 AM, sanjaykumargupta007
 wrote:
> I have a java+camel bases application which is consuming huge amount of CPU.
> it various from 40-90% of CPU in production. I tried to replicate the issue
> in my local environment and started 700 routes (file endpoints) and it is
> consistently taking 70-80% CPU.
>
> I want to know is there any way I can reduce the CPU utilization by
> configuring some setting while starting up the routes?
>
> regards
> sanjay
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-High-CPU-Usages-tp5791734.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Camel High CPU Usages

2016-12-20 Thread sanjaykumargupta007
I have a java+camel bases application which is consuming huge amount of CPU.
it various from 40-90% of CPU in production. I tried to replicate the issue
in my local environment and started 700 routes (file endpoints) and it is
consistently taking 70-80% CPU.

I want to know is there any way I can reduce the CPU utilization by
configuring some setting while starting up the routes?

regards
sanjay



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-High-CPU-Usages-tp5791734.html
Sent from the Camel - Users mailing list archive at Nabble.com.


AW: MDC logging for different route

2016-12-20 Thread Oliver Wulff
As far as I understand your use case, the following JIRA addresses your 
requirement as well:

https://issues.apache.org/jira/browse/CAMEL-10624


Von: intelccdodemo 
Gesendet: Dienstag, 20. Dezember 2016 09:10:08
An: users@camel.apache.org
Betreff: MDC logging for different route

In my project there are different routes based on seda and EIP, what i want
to achieve for each request log common identifier for trace-ability and
debugging.

I tried using MdcUnitOfWork  like CustomUnitOfWork extends MdcUnitOfWork
implements UnitOfWork and that gets created by CustomUnitOfWorkFactory. But,
still not able to persist common id across different route and processor
started from one route.

Any suggestion and help?



--
View this message in context: 
http://camel.465427.n5.nabble.com/MDC-logging-for-different-route-tp5791730.html
Sent from the Camel - Users mailing list archive at Nabble.com.


AW: Custom MDC property per exchange

2016-12-20 Thread Oliver Wulff
I've created the following JIRA:
https://issues.apache.org/jira/browse/CAMEL-10624


Von: Oliver Wulff 
Gesendet: Freitag, 16. Dezember 2016 13:44:08
An: users@camel.apache.org
Betreff: AW: Custom MDC property per exchange

Maybe something like




this will end up in the MDC property ("camel.foo")


Within the MDCUnitOfWork, we could remove "camel.*".


Von: Claus Ibsen 
Gesendet: Freitag, 16. Dezember 2016 12:30:33
An: users@camel.apache.org
Betreff: Re: Custom MDC property per exchange

Hmm its more a

   

Where you can set a value from any expression, eg a simple

   ${body.callMe}

The trick is to keep track of these custom MDC headers and ensure they
are all cleared on thread context switches etc, which is what the
MDCUnitOfWork ensures for the OOTB provided.



On Fri, Dec 16, 2016 at 10:14 AM, Oliver Wulff  wrote:
> Hi Claus
>
>
> Thanks for the feedback. I've read this as well but I got the opinion that 
> it's not a fit for me. As far as I understand from the interface UnitOfWork 
> it looks to me to allow only a hook before the route starts and after. I'm 
> more looking for an option where during processing time to add an MDC value 
> whose value is read from the body.
>
> I also think we should have an easier option instead of extending 
> MDCUnitOfWork.
>
>
> Wouldn't it be worth a feature request to provide an option to store a header 
> also as an MDC value. Something like:
>
>
> 
>
>
> WDYT?
>
>
> Thanks
>
> Oli
>
>
>
> 
> Von: Claus Ibsen 
> Gesendet: Donnerstag, 15. Dezember 2016 20:13:45
> An: users@camel.apache.org
> Betreff: Re: Custom MDC property per exchange
>
> You would need to create a custom MDC unit of work. You may be able to
> extend the existing MDCUnitOfWork from camel-core. And then there is a
> UnitOfWorkFactory you need to create and setup which creates your
> custom one.
>
> And yes you need to cleanup stuff with thread context switches and
> whatnot, see how the existing does that, and you can do similar thing.
>
> On Thu, Dec 15, 2016 at 6:50 PM, Oliver Wulff  wrote:
>> Hi there
>>
>>
>> Camel has already support for MDC logging. I also saw some discussion about 
>> adding static(!) MDC values when the context starts. I'd like to enhance it 
>> and add some application specific context information to every new exchange 
>> like. First I parse the message and set some headers but would also like to 
>> add the header to the MDC like:
>>
>>
>> MDC.put("AppMsgId", headers.get("AppMsgId"))
>>
>>
>> Is there some out-of-the-box support or do I have to create a custom bean to 
>> handle that?
>>
>>
>> Is there anything I have to consider like cleaning the MDC's finally or will 
>> Camel handle that?
>>
>>
>> Thanks a lot for your feedback
>>
>> Oli
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Claus Ibsen (@davsclaus) riding the Apache Camel
> davsclaus.com
> A blog about Apache Camel, by Claus Ibsen, the leading contributor, and 
> author of the Camel in Action book.
>
>
> Camel in Action 2: https://www.manning.com/ibsen2
> Manning | Camel in Action, Second Edition
> www.manning.com
> Apache Camel is a Java library that lets you implement the standard 
> enterprise integration patterns in a few lines of code. With a concise but 
> sophisticated DSL, you ...
>
>



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


Re: Camel High CPU Usages

2016-12-20 Thread souciance
Why do you have one camel app with 700 routes?

On Tue, Dec 20, 2016 at 10:24 AM, sanjaykumargupta007 [via Camel] <
ml-node+s465427n5791734...@n5.nabble.com> wrote:

> I have a java+camel bases application which is consuming huge amount of
> CPU. it various from 40-90% of CPU in production. I tried to replicate the
> issue in my local environment and started 700 routes (file endpoints) and
> it is consistently taking 70-80% CPU.
>
> I want to know is there any way I can reduce the CPU utilization by
> configuring some setting while starting up the routes?
>
> regards
> sanjay
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-High-CPU-Usages-tp5791734.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428...@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-High-CPU-Usages-tp5791734p5791735.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unzip huge single entry file throws OutOfMemory

2016-12-20 Thread adalfovo
Thank you very much!
Now it's working



--
View this message in context: 
http://camel.465427.n5.nabble.com/Unzip-huge-single-entry-file-throws-OutOfMemory-tp5790404p5791731.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Json format disturbed // Rest DSL + Jackson

2016-12-20 Thread yogu13
How are you sending the JSON data using httpclient ? 

Regards,
-Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/Json-format-disturbed-Rest-DSL-Jackson-tp5791716p5791727.html
Sent from the Camel - Users mailing list archive at Nabble.com.


MDC logging for different route

2016-12-20 Thread intelccdodemo
In my project there are different routes based on seda and EIP, what i want
to achieve for each request log common identifier for trace-ability and
debugging. 

I tried using MdcUnitOfWork  like CustomUnitOfWork extends MdcUnitOfWork
implements UnitOfWork and that gets created by CustomUnitOfWorkFactory. But,
still not able to persist common id across different route and processor
started from one route.

Any suggestion and help?



--
View this message in context: 
http://camel.465427.n5.nabble.com/MDC-logging-for-different-route-tp5791730.html
Sent from the Camel - Users mailing list archive at Nabble.com.