Re: IllegalStateException: Current exchange has not been set for ExpressionMapper while converting a CXF object

2016-11-07 Thread Tomohisa Igarashi

Hi,

There're some testcases demonstrating expression mapping like this:
https://github.com/apache/camel/blob/master/components/camel-dozer/src/test/resources/org/apache/camel/component/dozer/ExpressionMappingTest-context.xml
https://github.com/apache/camel/blob/master/components/camel-dozer/src/test/resources/org/apache/camel/component/dozer/expressionMappingFile.xml

Would you take a look at these and see what is different from yours?
Also you may want to try with latest 2.17.3 or 2.18.0.

Thanks,
Tomo

On 11/08/2016 03:03 AM, adie wrote:

Hi!
I was trying to use camel-dozer component to translate a POJO generated by
CXF.

1. First I started with simple mapping of two fields 1:1 and URI with
targetModel and mappingFile. Which actually failed, because POJO was wrapped
in some object.
2. Then I've added sourceModel and it worked using following URI.

3. Then I was trying to use Camel expressions like this


... but it failed with error


I was trying to debug the error and it seems that thread local variable does
not contain current Exchange.

I am using Camel 2.17 (including all dependencies - Dozer 5.5.1) plus I am
running this in a test using camel-test-blueprint


Is there any dependency or declaration I need to make to use expression
mapping?

Let me know if you need more details.

Many thanks,
   Marcin



--
View this message in context: 
http://camel.465427.n5.nabble.com/IllegalStateException-Current-exchange-has-not-been-set-for-ExpressionMapper-while-converting-a-CXF-t-tp5789866.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Camel-Maven-Plugin, Felix.Connect, and configAdminFileName

2016-11-07 Thread Ryan Colwell
I've written a few Camel routes in 2.15.2 using blueprint and property
placeholders for configuration values. I'm targeting Karaf as my production
environment and using the Camel-Maven-Plugin for running locally. For my
example I'm using the route generated by (camel-archetype-blueprint) that
logs "The messages contains ${body}" every 5 seconds but I removed the
default value from the property-placeholder.

Blueprint File Snippet(based on camel-archetype-blueprint):
  
  
  
  

Pom:
 
   org.apache.camel
camel-maven-plugin
2.15.2

 com.ds.configstest

config/com.ds.configstest.cfg



config/com.ds.configstest.cfg properties file:
greeting=Hello from config file

The above works great in Camel 2.15.2. When it ran locally or in Karaf(4) it
printed "The message contains Hello from config file." It allowed me to do
local testing with a config file for and then my deployments dropped QA/PROD
specific configs in $KARAF_HOME/etc/com.ds.configstest.cfg.

When I tried with today with a new project from camel-archetype-blueprint
using version 2.18.0 of Camel and I run locally with camel-maven-plugin the
log statement just prints the literal "The message contains ${greeting}" as
if the com.ds.configstest is not being picked up and applied. When I run it
in Karaf(4) it picks up the com.ds.configstest and correctly prints "The
message contains Hello from config file" in the log statement.

Does configAdminFileName work differently with the change from PojoSR to
Felix Connect as discussed in the Running OSGI Blueprint section of this
page? Can you no longer load configs to the registry this way for local
testing? https://camel.apache.org/camel-run-maven-goal.html. 

Thanks,

Ryan




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Maven-Plugin-Felix-Connect-and-configAdminFileName-tp5789878.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: netty4(-http) producer workerGroup and producerPool

2016-11-07 Thread Avnish Pundir

Found it from source code, the example for netty4 should be following:


class="org.apache.camel.component.netty4.NettyWorkerPoolBuilder">

  



  factory-bean="poolBuilder" factory-method="build" 
destroy-method="destroy">



Then in the Camel routes we can refer to this worker pools by 
configuring the workerGroup option in the URI as shown below:


  

  
  ...


Thanks,
Avnish Pundir

On 07-11-2016 14:44, Avnish Pundir wrote:

Hi Willem,
I just tried sharing the workerpool as per docs of netty4
(http://camel.apache.org/netty4.html) however the class mentioned in
example (org.jboss.netty.channel.socket.nio.WorkerPool) for sharing of
worker pools doesn't exist in netty4. I have camel-netty4 as a
dependency in maven and "netty-all(4.0.34.FINAL)" is present on my
project classpath as a transitive dependency. The mentioned class exists
in netty3 as far as I can tell from googling around.

Looks to me docs for netty4 are still pointing to camel-netty
documentation for example section at least, as the example mention "boss
and worker thread pools" whereas the options mention bossGroup and
workerGroup (not pools). You did mentioned that you have updated wiki
doc, if it's relevant can you please share updated doc link or point me
in right direction for sharing workerGroup with netty4?

Thanks,
Avnish Pundir


On 03-11-2016 15:14, Willem Jiang wrote:

Hi,

I just checked the code of camel-netty4, the workerGroup can be share
between the consumers and producers if the option is specified
otherwise camel creates a new workerGroup per consumer or producer.
The wiki doc is updated, I will commit a quick fix to the camel netty
component.

--
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem



On November 3, 2016 at 12:55:34 PM, Pundir Avnish
(avnish.pun...@tekmindz.com) wrote:

Hi Everyone,
I am trying to use netty4-http (in producer mode) to connect to remote
services. Apparently in my use case there are number of different remote
services (more than 30 in total) I have to talk to. To keep the threads
management under direct control, I was hoping to use same thread pool
for all these endpoints. At a glance it looked like sharing workerGroup
will do the trick. However from the documentation it feels like this
option is for consumer (at least from the examples in
http://camel.apache.org/netty4.html) whereas for producer we should be
using producerPool* properties. I need guidance on following from the
community experts -
1. Is the above understanding correct, i.e. workerGroup can be used ONLY
with consumer? If not what impact will it have if used with producer and
more importantly how does it impact/influence producerPool.
2. Is it possible to use single executor across all my netty4-http
producers? I don't see usual option of setting executorServiceRef option
with either netty4 or nett4-http.


--
Thanks,
*Avnish Pundir*


--





--

--
Disclaimer: The information contained in this communication is 
confidential, private, proprietary, or otherwise privileged and is intended 
only for the use of the addressee.Unauthorized use, disclosure, 
distribution or copying is strictly prohibited and may be unlawful. If you 
have received this communication in error, please delete this message and 
notify the sender immediately - Samin TekMindz India Pvt.Ltd. 
--


Re: Cache api call result

2016-11-07 Thread lsantos
 

Thanks, will try that. 

On 07/11/2016 12:25, taariq [via Camel] wrote: 

> Hi, 
> You can use camel-ehcache, something like this example from the old 
> camel-cache; 
> 
> from("direct:start") 
> // Prepare headers 
> .setHeader(CacheConstants.CACHE_OPERATION, 
> constant(CacheConstants.CACHE_OPERATION_GET)) 
> .setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson")). 
> .to("cache://TestCache1"). 
> // Check if entry was not found 
> .choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull()). 
> // If not found, get the payload and put it to cache 
> .to("cxf:bean:someHeavyweightOperation"). 
> .setHeader(CacheConstants.CACHE_OPERATION, 
> constant(CacheConstants.CACHE_OPERATION_ADD)) 
> .setHeader(CacheConstants.CACHE_KEY, 
> constant("Ralph_Waldo_Emerson")) 
> .to("cache://TestCache1") 
> .end() 
> .to("direct:nextPhase"); 
> 
> http://camel.apache.org/ehcache.html [1]
> 
> Try modify the route to encapsulate your firstEnrichEndpoint. 
> 
> Cheers 
> 
> On 07 Nov 2016 17:06, "lsantos" <[hidden email]> wrote: 
> 
>> Hi there, 
>> 
>> I am working on a command-line camel application that polls a directory for 
>> a file, reads it, process each line, modifies a piece of information on the 
>> line and rewrites it in new file. 
>> 
>> I have to make 2 http calls as part of the msg enrichment process, the 
>> first 
>> call is as authorization call that gets a json web token that is sent in 
>> the 
>> headers of the second http call. 
>> 
>> My route dsl looks something like this: 
>> 
>> from("{{consumerEndpoint}}") 
>> .validate(body().regex(FILE_HEADER_PATTERN)) 
>> .split(body().tokenize()) 
>> .choice() 
>> .when(body().regex(RECORD_LINE_PATTERN)) 
>> .process(pluckOutTokenRecordProcessor()) 
>> .setHeader(Exchange.HTTP_METHOD, constant("POST")) 
>> // call that I want its result cached for reuse 
>> .enrich("{{firstEnrichEndpoint}}", 
>> getFirstAggregationStrategy()) .setHeader(Exchange.HTTP_METHOD, 
>> constant("GET")) 
>> 
>> .enrich().simple("{{sndEnrichEndpoint}}").aggregationStrategy( 
>> getSndAggregationStrategy()) 
>> .process(recordUpdaterProcessor()) 
>> .end() //end choice 
>> .aggregate(header(FILE_NAME_ONLY), 
>> stringBodyAggregator()) 
>> .convertBodyTo(String.class) 
>> .to("{{transferEndpoint}}") 
>> .end(); 
>> 
>> 
>> It is all good and working, however, the file that gets processed in 
>> production has millions of lines and I do not want to have to make an extra 
>> authorization http call for each record that is processed, as the json web 
>> token is valid for 20 minutes before it expires which is less than what 
>> takes to process one entire file. 
>> 
>> I would like to keep the jwt auth token cached in memory for let's say 15 
>> minutes and refresh it periodically. 
>> 
>> I was wondering how is the best approach to achieve this goal. I know that 
>> camel ships with a timer component, but I never worked with it. 
>> 
>> 
>> 
>> 
>> 
>> -- 
>> View this message in context: http://camel.465427.n5.nabble [2]. 
>> com/Cache-api-call-result-tp5789849.html 
>> Sent from the Camel - Users mailing list archive at Nabble.com. 
>> 
> 
> -
> 
> If you reply to this email, your message will be added to the discussion 
> below: 
> http://camel.465427.n5.nabble.com/Cache-api-call-result-tp5789849p5789864.html
>  [3] 
> To unsubscribe from Cache api call result, click here [4].
> NAML [5]
 

Links:
--
[1] http://camel.apache.org/ehcache.html
[2] http://camel.465427.n5.nabble
[3]
http://camel.465427.n5.nabble.com/Cache-api-call-result-tp5789849p5789864.html
[4]
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5789849code=bGVhbmRyby5idWVub0BnbG9iby5jb218NTc4OTg0OXw4MDMyMzU2MzQ=
[5]
http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cache-api-call-result-tp5789849p5789867.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to change came throttler constant value in MBean

2016-11-07 Thread ramchris
Any replies on this will be greatly appreciated...



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-change-came-throttler-constant-value-in-MBean-tp5789670p5789865.html
Sent from the Camel - Users mailing list archive at Nabble.com.


IllegalStateException: Current exchange has not been set for ExpressionMapper while converting a CXF object

2016-11-07 Thread adie
Hi!
I was trying to use camel-dozer component to translate a POJO generated by
CXF. 

1. First I started with simple mapping of two fields 1:1 and URI with
targetModel and mappingFile. Which actually failed, because POJO was wrapped
in some object. 
2. Then I've added sourceModel and it worked using following URI.

3. Then I was trying to use Camel expressions like this 


... but it failed with error 


I was trying to debug the error and it seems that thread local variable does
not contain current Exchange.

I am using Camel 2.17 (including all dependencies - Dozer 5.5.1) plus I am
running this in a test using camel-test-blueprint 


Is there any dependency or declaration I need to make to use expression
mapping?

Let me know if you need more details.

Many thanks,
   Marcin



--
View this message in context: 
http://camel.465427.n5.nabble.com/IllegalStateException-Current-exchange-has-not-been-set-for-ExpressionMapper-while-converting-a-CXF-t-tp5789866.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Cache api call result

2016-11-07 Thread Taariq Levack
Hi,
You can use camel-ehcache,  something like this example from the old
camel-cache;

from("direct:start")
// Prepare headers
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_GET))
.setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson")).
.to("cache://TestCache1").
// Check if entry was not found
.choice().when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull()).
// If not found, get the payload and put it to cache
.to("cxf:bean:someHeavyweightOperation").
.setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
.setHeader(CacheConstants.CACHE_KEY,
constant("Ralph_Waldo_Emerson"))
.to("cache://TestCache1")
.end()
.to("direct:nextPhase");

http://camel.apache.org/ehcache.html

Try modify the route to encapsulate your firstEnrichEndpoint.

Cheers

On 07 Nov 2016 17:06, "lsantos"  wrote:

> Hi there,
>
> I am working on a command-line camel application that polls a directory for
> a file, reads it, process each line, modifies a piece of information on the
> line and rewrites it in new file.
>
> I have to make 2 http calls as part of the msg enrichment process, the
> first
> call is as authorization call that gets a json web token that is sent in
> the
> headers of the second http call.
>
> My route dsl looks something like this:
>
> from("{{consumerEndpoint}}")
> .validate(body().regex(FILE_HEADER_PATTERN))
> .split(body().tokenize())
> .choice()
> .when(body().regex(RECORD_LINE_PATTERN))
> .process(pluckOutTokenRecordProcessor())
> .setHeader(Exchange.HTTP_METHOD, constant("POST"))
> // call that I want its result cached for reuse
> .enrich("{{firstEnrichEndpoint}}",
> getFirstAggregationStrategy()) .setHeader(Exchange.HTTP_METHOD,
> constant("GET"))
>
> .enrich().simple("{{sndEnrichEndpoint}}").aggregationStrategy(
> getSndAggregationStrategy())
> .process(recordUpdaterProcessor())
> .end() //end choice
> .aggregate(header(FILE_NAME_ONLY),
> stringBodyAggregator())
> .convertBodyTo(String.class)
> .to("{{transferEndpoint}}")
> .end();
>
>
> It is all good and working, however, the file that gets processed in
> production has millions of lines and I do not want to have to make an extra
> authorization http call for each record that is processed, as the json web
> token is valid for 20 minutes before it expires which is less than what
> takes to process one entire file.
>
> I would like to keep the jwt auth token cached in memory for let's say 15
> minutes and refresh it periodically.
>
> I was wondering how is the best approach to achieve this goal. I know that
> camel ships with a timer component, but I never worked with it.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Cache-api-call-result-tp5789849.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


camel-shiro and caching

2016-11-07 Thread AOladipupo
Hi Team,

I use camel on jBoss Fuse ESB for integration/middleware projects. In
addition to other security implementations on the esb, i have set up route
security using camel-shiro and its iniRealm. However, due to the static
nature of the iniRealm (bundle restart is needed for changes to reflect/get
applied)... i have had to rethink my approach to route security. i changed
the realm being used to a jdbcRealm from the shiro.ini file and migrated the
users, roles and permissions details to a database. This allows changes to
the underlying user details to get applied and reflect immediately on the
esb.

However, there is a concern on the trips being made to the database to
retrieve users' roles/permissions. This prompted me to enable the shiro
caching support. Having done this, what i noticed was that the users'
details, roles and permissions were not being cached. Can someone please
help review the attached demo project files to see if I am doing something
wrong OR advise if the came-shiro component has caching capabilities or not?

Thanks and kind regards
Dipo. shiro-demo.zip
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-shiro-and-caching-tp5789853.html
Sent from the Camel - Users mailing list archive at Nabble.com.


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

2016-11-07 Thread Rachid KRAIEM
Thanks Claus,

Can you raise a JIRA that contain this solution ?



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


Re: Camel - Hystrix

2016-11-07 Thread r_karthik1
Thanks...Sure will try it out.



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


Cache api call result

2016-11-07 Thread lsantos
Hi there,

I am working on a command-line camel application that polls a directory for
a file, reads it, process each line, modifies a piece of information on the
line and rewrites it in new file.

I have to make 2 http calls as part of the msg enrichment process, the first
call is as authorization call that gets a json web token that is sent in the
headers of the second http call.

My route dsl looks something like this:

from("{{consumerEndpoint}}")
.validate(body().regex(FILE_HEADER_PATTERN))
.split(body().tokenize())
.choice()
.when(body().regex(RECORD_LINE_PATTERN))
.process(pluckOutTokenRecordProcessor())
.setHeader(Exchange.HTTP_METHOD, constant("POST")) 
// call that I want its result cached for reuse
.enrich("{{firstEnrichEndpoint}}",
getFirstAggregationStrategy()) .setHeader(Exchange.HTTP_METHOD,
constant("GET"))
   
.enrich().simple("{{sndEnrichEndpoint}}").aggregationStrategy(getSndAggregationStrategy())
.process(recordUpdaterProcessor())
.end() //end choice
.aggregate(header(FILE_NAME_ONLY),
stringBodyAggregator())
.convertBodyTo(String.class) 
.to("{{transferEndpoint}}")
.end();


It is all good and working, however, the file that gets processed in
production has millions of lines and I do not want to have to make an extra
authorization http call for each record that is processed, as the json web
token is valid for 20 minutes before it expires which is less than what
takes to process one entire file.

I would like to keep the jwt auth token cached in memory for let's say 15
minutes and refresh it periodically.

I was wondering how is the best approach to achieve this goal. I know that
camel ships with a timer component, but I never worked with it.





--
View this message in context: 
http://camel.465427.n5.nabble.com/Cache-api-call-result-tp5789849.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Large message handling

2016-11-07 Thread James Green
That's pretty much what we were describing.

I see there is no DSL for this so beyond it being a known algorithm it
remains a "write-your-own-implementation". I guess therefore it's a
relatively narrow use-case...


On 4 November 2016 at 16:50, Quinn Stevenson 
wrote:

> I think the EIP you’re referring to is the “Claim Check” pattern (
> http://www.enterpriseintegrationpatterns.com/patterns/messaging/
> StoreInLibrary.html  com/patterns/messaging/StoreInLibrary.html> ), and Camel does support
> that EIP ( http://camel.apache.org/claim-check.html <
> http://camel.apache.org/claim-check.html> )
>
> HTH
>
>
> > On Nov 4, 2016, at 8:53 AM, James Green 
> wrote:
> >
> > Hi,
> >
> > We are preparing to start handling very large messages. Currently we have
> > small (<1k) messages arriving from message queues and being processed,
> but
> > these new messages could be several mb each.
> >
> > Each message is basically a JSON formatted payload with metadata and a
> > content-body. It's this content-body that may end up being much larger in
> > some cases.
> >
> > We have speculated that this may be best handled by recognising a
> reference
> > within the message meta-data to a URI that actually has the content-body.
> > This feels like a pattern that may have already been invented. Not unlike
> > SOAP where references to files sent separately can be achieved.
> >
> > Anyone know of such a system or even terms to hit Google with? And might
> > there be something in the Camel-sphere that loads external references
> > already?
> >
> > Thanks,
> >
> > James
>
>


Re: Aggregator + (LevelDB or HawtDB for persistency) incorrect behavior

2016-11-07 Thread onders
btw, i tried both leveldb and hawtdb as aggregationrepository.

  
  






  


or














--
View this message in context: 
http://camel.465427.n5.nabble.com/Aggregator-LevelDB-or-HawtDB-for-persistency-incorrect-behavior-tp5765524p5789837.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Incorrect context path in camel-swagger-java swagger servlet?

2016-11-07 Thread Jonas Koperdraat
Hi Claus,

Because of the environment our application is deployed to, we are stuck at
JDK 7, and therefore at camel 2.17.x.

I will test locally if this problem still exists in camel 2.18.0, though,
and will let you know the result.

Kind regards,

Joans

Op ma 7 nov. 2016 om 12:31 schreef Claus Ibsen :

Hi

Can you try with Camel 2.18.0 release.

On Wed, Nov 2, 2016 at 1:37 PM, Jonas Koperdraat
 wrote:
> Hi,
>
> I have an application deployed at
> "http://server:port/some/context/path;, with a REST api at
> "http://server:port/some/context/path/rest;.
>
> According to http://camel.apache.org/swagger-java.html, I should
> configure the 'base.path' and 'api.path' relative to the context path.
> However, I find that I have to include the final part of the context
> path in 'base.path' and 'api.path' for the swagger servlet to work,
> like so:
>
> 
>   base.path
>   path/rest
> 
> 
>   api.path
>   path/rest-docs
> 
>
> Debugging the code, I noticed in
> org.apache.camel.swagger.servlet.RestSwaggerServlet#translateContextPath,
> that the context path being returned is stripped from the last
> segment. The responsible piece of code is:
>
> /**
>  * We do only want the base context-path and not sub paths
>  */
> private String translateContextPath(HttpServletRequest request) {
>   String path = request.getContextPath();
>   if (path.isEmpty() || path.equals("/")) {
> return "";
>   } else {
> int idx = path.lastIndexOf("/");
> if (idx > 0) {
>   return path.substring(0, idx);
> }
>   }
>   return path;
> }
>
> When debugging I can see that 'path' contains the entire context path:
> "/some/context/path", which gets reduced to "/some/context". This
> results in an incorrect basePath and non-working swagger servlet if I
> don't add the "path" in the servlet configuration for 'api.path' and
> 'base.path'
>
> Is this a bug or a feature? And in the latter case, how should I then
> configure my application, such that I can configure the swagger
> servlet independent of the context path (e.g. without "path" in
> 'api.path' and 'base.path')?
>
> Im using java 7, camel(-swagger-java) v2.17.0, serlvet spec v3.0 and
> am deploying to tomcat 7
>
> Kind regards,
>
> Jonas



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


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

2016-11-07 Thread Claus Ibsen
Yes there is no re-connection or the likes when starting a quartz route.

You can do as you did with your own custom component.

Its a bit tricky to do re-connection as it would entail a background
thread keep running and trying to startup the route until its
succesful, and then you need ways to configure how often it should
try, and whatnot.

Camel 3.x will introduce async startup of routes and as well a way of
configuring retry strategies etc. that would work generic for all
routes/consumers.


On Tue, Nov 1, 2016 at 11:49 AM, Rachid KRAIEM  wrote:
> Hi Everyone:
>
> My bundle osgi installed into karaf container 4.0.7, that use
> camel-quartz2-2.17.3 In camelContext I have many routes such as "myRoute",
> it call a job quatrz (using camel-quartz2) configured in postgresql
> database:
>
> 
> Camel route
> 
>
>
>   xmlns="http://camel.apache.org/schema/blueprint;>
>
> 
> 
> uri="quartz2://statGroup/startupTimer?cron={{stat.purge.wan.volume.daily.dc}}"
> />
> 
> 
>
>  
>
> 
> Bean quartz2
> 
>
>   class="org.apache.camel.component.quartz2.QuartzComponent">
>  value="file:etc/stat_quartz.cfg" />
>  
>
> 
> quartz2 configuration : stat_quartz.cfg
> 
>
>
> #
> # Configure Main Scheduler Properties
> #
> org.quartz.scheduler.instanceName=Scheduler
> org.quartz.scheduler.instanceId=AUTO
> org.quartz.scheduler.skipUpdateCheck=true
> org.quartz.scheduler.jobFactory.class=org.quartz.simpl.SimpleJobFactory
> #
> # Configure ThreadPool
> #
> org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
> org.quartz.threadPool.threadCount=10
> #
> # Configure JobStore
> #
> org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
> org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
> org.quartz.jobStore.dataSource=statQuartzDS
> org.quartz.jobStore.tablePrefix=stat_qrtz_
> org.quartz.jobStore.isClustered=true
> org.quartz.jobStore.clusterCheckinInterval=2
> org.quartz.jobStore.useProperties=false
> #
> # Configure Datasources
> #
> org.quartz.dataSource.statQuartzDS.jndiURL=osgi:service/statQuartzDS
>
>
> 
> Problem
> 
>
>
> My issue is when I try to starting the karaf container and postgresql is
> stopped, I have the log problem below and the camelContext "myCamelContext"
> will be shutdown.
>
>
> 2016-10-14 17:21:40,201 | ERROR | FelixStartLevel  | BlueprintCamelContext
> | 80 - org.apache.camel.camel-blueprint - 2.17.3 | Error occurred during
> starting Camel: CamelContext(statisticsContext) due Failed to create route
> myRoute: Route(myRoute)[[From[quartz2://stat... because of Failed to resolve
> endpoint:
> quartz2://statGroup/startupTimer?trigger.repeatCount=0=1
> due to: Failed to obtain DB connection from data source 'statQuartzDS':
> java.sql.SQLException: Could not retrieve datasource via JNDI url
> 'osgi:service/statQuartzDS' java.sql.SQLException: Unable to acquire a new
> connection from the pool
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> myRoute: Route(myRoute)[[From[quartz2://stat... because of Failed to resolve
> endpoint:
> quartz2://statGroup/startupTimer?trigger.repeatCount=0=1
> due to: Failed to obtain DB connection from data source 'statQuartzDS':
> java.sql.SQLException: Could not retrieve datasource via JNDI url
> 'osgi:service/statQuartzDS' java.sql.SQLException: Unable to acquire a new
> connection from the pool
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
> at
> 

Re: Incorrect context path in camel-swagger-java swagger servlet?

2016-11-07 Thread Claus Ibsen
Hi

Can you try with Camel 2.18.0 release.

On Wed, Nov 2, 2016 at 1:37 PM, Jonas Koperdraat
 wrote:
> Hi,
>
> I have an application deployed at
> "http://server:port/some/context/path;, with a REST api at
> "http://server:port/some/context/path/rest;.
>
> According to http://camel.apache.org/swagger-java.html, I should
> configure the 'base.path' and 'api.path' relative to the context path.
> However, I find that I have to include the final part of the context
> path in 'base.path' and 'api.path' for the swagger servlet to work,
> like so:
>
> 
>   base.path
>   path/rest
> 
> 
>   api.path
>   path/rest-docs
> 
>
> Debugging the code, I noticed in
> org.apache.camel.swagger.servlet.RestSwaggerServlet#translateContextPath,
> that the context path being returned is stripped from the last
> segment. The responsible piece of code is:
>
> /**
>  * We do only want the base context-path and not sub paths
>  */
> private String translateContextPath(HttpServletRequest request) {
>   String path = request.getContextPath();
>   if (path.isEmpty() || path.equals("/")) {
> return "";
>   } else {
> int idx = path.lastIndexOf("/");
> if (idx > 0) {
>   return path.substring(0, idx);
> }
>   }
>   return path;
> }
>
> When debugging I can see that 'path' contains the entire context path:
> "/some/context/path", which gets reduced to "/some/context". This
> results in an incorrect basePath and non-working swagger servlet if I
> don't add the "path" in the servlet configuration for 'api.path' and
> 'base.path'
>
> Is this a bug or a feature? And in the latter case, how should I then
> configure my application, such that I can configure the swagger
> servlet independent of the context path (e.g. without "path" in
> 'api.path' and 'base.path')?
>
> Im using java 7, camel(-swagger-java) v2.17.0, serlvet spec v3.0 and
> am deploying to tomcat 7
>
> Kind regards,
>
> Jonas



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


Re: Camel archetype 2.17.0 onwards

2016-11-07 Thread Claus Ibsen
The logging should be on test scope if anything as running on karaf
has its own osgi logging ,and you should not have those at compile
scope.

I guess its because you may run it outside osgi from a camel main or
something. Then you need to change the scopes if you want to see
logging there.



On Mon, Nov 7, 2016 at 11:17 AM, souciance
 wrote:
> Hello,
>
> I did not have this issue with Camel blueprint archetype 2.15.0 but in
> 2.17.0 it has appeared. I simply create a new project in intellij based on
> camel-blueprint archetype for version 2.17.0.
>
> Everything is created but when running the project it gives me the error:
>
> [INFO] --- camel-maven-plugin:2.17.0:run (default-cli) @ email-bibsent ---
> [INFO] camel-blueprint detected on classpath
> [INFO] OSGi Blueprint XML files detected in directory
> C:\Work\repo\LSP\integration-platform\integrations\PollEmailFromBibsent\src\main\resources\OSGI-INF\blueprint
> [INFO] Using org.apache.camel.test.blueprint.Main to initiate a CamelContext
> [INFO] Starting Camel ...
> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
> SLF4J: Defaulting to no-operation (NOP) logger implementation
> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
> details.
>
> Afterwards I have to change the dependency to add slf4j-simple. Is this the
> correct procedure?
>
>
> 
>   org.slf4j
>   slf4j-api
>   ${slf4j-version}
> 
> 
>   org.slf4j
>   slf4j-simple
>   ${slf4j-version}
> 
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-archetype-2-17-0-onwards-tp5789819.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


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

2016-11-07 Thread souciance
I cannot comment on the code for starting the route when the database is
unavailable but why  not add some default properties to use when the
database is not available. Then you catch the exception and use those
properties instead.



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


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

2016-11-07 Thread Rachid KRAIEM
Hi Everyone,

Can you validate this proposal



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


Camel archetype 2.17.0 onwards

2016-11-07 Thread souciance
Hello,

I did not have this issue with Camel blueprint archetype 2.15.0 but in
2.17.0 it has appeared. I simply create a new project in intellij based on
camel-blueprint archetype for version 2.17.0.

Everything is created but when running the project it gives me the error:

[INFO] --- camel-maven-plugin:2.17.0:run (default-cli) @ email-bibsent ---
[INFO] camel-blueprint detected on classpath
[INFO] OSGi Blueprint XML files detected in directory
C:\Work\repo\LSP\integration-platform\integrations\PollEmailFromBibsent\src\main\resources\OSGI-INF\blueprint
[INFO] Using org.apache.camel.test.blueprint.Main to initiate a CamelContext
[INFO] Starting Camel ...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details.

Afterwards I have to change the dependency to add slf4j-simple. Is this the
correct procedure?



  org.slf4j
  slf4j-api
  ${slf4j-version}


  org.slf4j
  slf4j-simple
  ${slf4j-version}




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-archetype-2-17-0-onwards-tp5789819.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: netty4(-http) producer workerGroup and producerPool

2016-11-07 Thread Avnish Pundir

Hi Willem,
I just tried sharing the workerpool as per docs of netty4 
(http://camel.apache.org/netty4.html) however the class mentioned in 
example (org.jboss.netty.channel.socket.nio.WorkerPool) for sharing of 
worker pools doesn't exist in netty4. I have camel-netty4 as a 
dependency in maven and "netty-all(4.0.34.FINAL)" is present on my 
project classpath as a transitive dependency. The mentioned class exists 
in netty3 as far as I can tell from googling around.


Looks to me docs for netty4 are still pointing to camel-netty 
documentation for example section at least, as the example mention "boss 
and worker thread pools" whereas the options mention bossGroup and 
workerGroup (not pools). You did mentioned that you have updated wiki 
doc, if it's relevant can you please share updated doc link or point me 
in right direction for sharing workerGroup with netty4?


Thanks,
Avnish Pundir


On 03-11-2016 15:14, Willem Jiang wrote:

Hi,

I just checked the code of camel-netty4, the workerGroup can be share between 
the consumers and producers if the option is specified otherwise camel creates 
a new workerGroup per consumer or producer.
The wiki doc is updated, I will commit a quick fix to the camel netty component.

--
Willem Jiang


Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem



On November 3, 2016 at 12:55:34 PM, Pundir Avnish (avnish.pun...@tekmindz.com) 
wrote:

Hi Everyone,
I am trying to use netty4-http (in producer mode) to connect to remote
services. Apparently in my use case there are number of different remote
services (more than 30 in total) I have to talk to. To keep the threads
management under direct control, I was hoping to use same thread pool
for all these endpoints. At a glance it looked like sharing workerGroup
will do the trick. However from the documentation it feels like this
option is for consumer (at least from the examples in
http://camel.apache.org/netty4.html) whereas for producer we should be
using producerPool* properties. I need guidance on following from the
community experts -
1. Is the above understanding correct, i.e. workerGroup can be used ONLY
with consumer? If not what impact will it have if used with producer and
more importantly how does it impact/influence producerPool.
2. Is it possible to use single executor across all my netty4-http
producers? I don't see usual option of setting executorServiceRef option
with either netty4 or nett4-http.


--
Thanks,
*Avnish Pundir*


--



--

--
Disclaimer: The information contained in this communication is 
confidential, private, proprietary, or otherwise privileged and is intended 
only for the use of the addressee.Unauthorized use, disclosure, 
distribution or copying is strictly prohibited and may be unlawful. If you 
have received this communication in error, please delete this message and 
notify the sender immediately - Samin TekMindz India Pvt.Ltd. 
--


Re: Aggregator + (LevelDB or HawtDB for persistency) incorrect behavior

2016-11-07 Thread onders
Hi,

I am usign all camel core and components as of 2.17.3.
This issue seems to be still up.

Under examples/camel-example-aggregator i can test it is working.

as of route below; aggregation is not completed and not output file is
getting generated. (btw, if i do aggregate without persistence, it is
working.)

from("amq:queue:jms.myqueue")
.startupOrder(initialStartupOrder)
.shutdownRoute(ShutdownRoute.Defer)

.aggregate(simple(myId.toString()),
new AggregationStrategy() {

@Override
public Exchange 
aggregate(Exchange oldExchange, Exchange
newExchange) {
if (oldExchange 
== null) {

newExchange.getIn().setBody(new
StringBuilder(newExchange.getIn().getBody(MyObject.class).asLine("|")));
return 
newExchange;
}

oldExchange.getIn().getBody(StringBuilder.class).append(newExchange.getIn().getBody(MyObject.class).asLine("|"));
return 
oldExchange;
}
})
.eagerCheckCompletion()
.forceCompletionOnStop()
.completeAllOnStop()
.completionSize(500)
.completionInterval(6)
.parallelProcessing(true)
.aggregationRepository(myRepo)
.to("file:myfile");



--
View this message in context: 
http://camel.465427.n5.nabble.com/Aggregator-LevelDB-or-HawtDB-for-persistency-incorrect-behavior-tp5765524p5789810.html
Sent from the Camel - Users mailing list archive at Nabble.com.