Re: Camel HTTP component vs. Apache HTTP client

2013-07-21 Thread Raul Kripalani
Hi,

Can you also post your other version with the Apache HTTP client only?

I'd like to compare them to know where the performance hit is coming from.

Thanks,
Raúl.
On 21 Jul 2013 06:10, "humayun0156"  wrote:

> from("direct:npGet")
> .setHeader(Exchange.HTTP_METHOD, constant("GET"))
> .setProperty("url", simple("${body}"))
> .recipientList(simple("${body}?" + npAuthenticationString))
> .convertBodyTo(Document.class)
> .bean(HelperBean.class, "setUrlETagMapping")
> .process(new ObjectCreationProcess(xmlToObjectMapping));
>
>
>
> stopWatch.start();
> Exchange ex = producerTemplate.request("direct:npGet", new
> StringBodyProcessor(resourceURI.toString()));
> stopWatch.stop();
>
>
> The StringBodyProcessor is simply to set the url in the exchange body.
> The ObjectCreationgProcess is simply to create a new Object of the
> downloaded xml.
>
> My producer template is in a recursive loop.
>
> and my resourceURI is looks like : http://mysite.com/users/{id}
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735954.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: New Instance of CamelContext from Spring

2013-07-21 Thread Raul Kripalani
What exactly is your use case?

Thanks,
Raúl.
On 21 Jul 2013 02:27, "SyedBhai"  wrote:

> Hi Guys,
>   I have configured camel context in a spring file.
>   Sample configuration is
> http://camel.apache.org/schema/spring";>
>  
>   
>uri="http://localhost:8080/AirpostDSP1/webresources/getAd/airportAd"/>
>  
> 
>
>   But I have noticed that if I invoke getBean("c1") method of spring
> application context, I am getting the same object for every call.  I mean
> the hashcode is same.
>
>   I actually want to have a new instance of camel context everytime I
> invoke
> the getBean("c1") method.
>
>   Is it possible?  If yes, how?
>
> Thanks,
> Syed.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: How to recover corrupted HawtDB files

2013-07-21 Thread Raul Kripalani
> After all I use the great Camel framework to
avoid building general-purpose functionality like this by myself.

At Apache Camel we only offer a component to interact with HawtDB, but
we're not responsible for the development nor tooling around that project.
Sorry.

Regards,
Raúl.
On 18 Jul 2013 08:48, "Stefan Burkard"  wrote:

> Hi Claus
>
> I'm using camel-hawtdb 2.9.6 and (according to the classpath) hawtdb 1.6.
> The fact that hawtdb has no recovery tools but I need to build them by
> myself is bad news to me. After all I use the great Camel framework to
> avoid building general-purpose functionality like this by myself.
>
> How about LevelDB? Has it better tool support? And can I already use
> leveldb with a Camel 2.x release? I stumbled over LevelDB while searching
> for recovery options for HawtDB, but I didn't find an example how to use it
> with the aggregator. Is there a unittest or similar I can look at?
>
> Thanks
> Stefan
>
>
>
>
> 
> Von "aabändle" bis "zwüsche" - das umfangreichste Berndeutsch-Wörterbuch
> im Internet: http://www.berndeutsch.ch
> Ausserdem: Das Blog zur Website unter http://blog.berndeutsch.ch
> Facebook-Seite unter https://www.facebook.com/berndeutsch
> Google+ Seite unter http://www.google.com/+berndeutsch
>
>
> On Wed, Jul 17, 2013 at 10:10 AM, Claus Ibsen 
> wrote:
>
> > What version of Camel and HawtDB are you using?
> >
> > To try to recover you would possible need to write some java code with
> > the HawtDB API to load the corrupted file(s) and peak inside.
> >
> > Down the road we recommend using camel-leveldb instead of
> > camel-hawtdb. This uses LevelDB as the store instead which is a much
> > more mature and widespread used store.
> > https://code.google.com/p/leveldb/
> >
> > Apache ActiveMQ 5.9 offers leveldb out of the box, and is being
> > considered as the recommended/default store over its KahaDB store.
> >
> > The camel-leveldb has the same functionality as camel-hawtdb and is
> > very similar to setup.
> >
> >
> > On Tue, Jul 16, 2013 at 10:12 AM, Stefan Burkard 
> > wrote:
> > > Hi Camel users
> > >
> > > I have a component with 2 persistent aggregators. One receives all
> > messages,
> > > one only a part of them. After a lot of test runs without problems I
> had
> > > yesterday a serious problem with the aggregator persistence (hawtdb).
> > >
> > > I don't know yet what causes the problems, but however, problems can
> > occur.
> > > My problem is that I cannot recover the data from the hawtdb-files.
> > >
> > > Im my logs, I got first of all about 8 stacktraces like the attached
> > > "stacktrace1.txt". The number in the error message "The requested page
> > was
> > > not an extent: 35" is growing from stacktrace to stacktrace from 35 to
> > 1163.
> > >
> > > Then, I got some stacktraces like the attached "stacktrace2.txt".
> > >
> > > Finally I got A LOT of stacktraces like the attached "stacktrace3.txt".
> > >
> > > After shutting down the component gracefully, I tried to restart it,
> but
> > > this throws stacktraces like the attached "stacktrace-startup.txt".
> > >
> > > I can only start the component again if I rename the hawtdb-files so
> they
> > > are ignored and new hawtdb-files are created.
> > >
> > > This leaves me with the question: how can I recover the corrupted
> > > hawtdb-files? I didn't found anything about this subject and if this is
> > not
> > > possible, this would be a real show-stopper.
> > >
> > > Thanks for any help
> > > Stefan
> > >
> >
> >
> >
> > --
> > Claus Ibsen
> > -
> > Red Hat, Inc.
> > Email: cib...@redhat.com
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
> >
>


Re: Camel HTTP component vs. Apache HTTP client

2013-07-21 Thread humayun0156
Here is my Apache HTTP client version to download a URL. all three files are
here
Resource.java   
DefaultHTTPClient.java   
XMLEntityParser   

Performance issue is very imporntat. we should decide whether we should port
our project to camel or not.

Thanks




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735960.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel HTTP component vs. Apache HTTP client

2013-07-21 Thread Raul Kripalani
Many thanks.

As a first step, can you switch to the Camel HTTP4 component?

With the current setup, you're comparing v3 vs. v4.

Thanks,
Raúl.
On 21 Jul 2013 13:24, "humayun0156"  wrote:

> Here is my Apache HTTP client version to download a URL. all three files
> are
> here
> Resource.java 
> DefaultHTTPClient.java 
> XMLEntityParser 
>
> Performance issue is very imporntat. we should decide whether we should
> port
> our project to camel or not.
>
> Thanks
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735960.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Why cannot do a graceful shutdown?

2013-07-21 Thread bonnahu
Hey guys,
I need to shutdown the camelcontext in a Processor. Here is what I am doing:


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

  
  
  /order[@test]
  
  
  

  

Here is the DownloadLogger Processor:

public class DownloadLogger implements Processor {

//private Logger log = new Logger(DownloadLogger.class);
public void process(Exchange exchange) throws Exception {
System.out.println("We just downloaded:  " 
+ exchange.getIn().getHeader("CamelFileName"));
System.out.println("before camel context stop");
/exchange.getContext().getShutdownStrategy().setTimeout(5);
exchange.getContext().stop();/
System.out.println("after camel context stop");
}
}


When I run it, I got the following information. Can someone tell me why I
can't perform a graceful shutdown 
here?


[  main] MainSupportINFO  Apache
Camel 2.11.0 starting
[  main] SpringCamelContext INFO  Apache
Camel 2.11.0 (CamelContext: testingContext) is starting
[  main] ManagementStrategyFactory  INFO  JMX
enabled.
[  main] DefaultTypeConverter   INFO  Loaded
175 type converters
[  main] FileEndpoint   INFO 
Endpoint is configured with noop=true so forcing endpoint to be idempotent
as well
[  main] FileEndpoint   INFO  Using
default memory based idempotent repository with cache max size: 1000
[  main] XPathBuilder   INFO 
Created default XPathFactory
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@31e4c806
[  main] SpringCamelContext INFO  Route:
route1 started and consuming from: Endpoint[file://src/data?noop=true]
[  main] ultManagementLifecycleStrategy INFO  Load
performance statistics enabled.
[  main] SpringCamelContext INFO  Total
1 routes, of which 1 is started.
[  main] SpringCamelContext INFO  Apache
Camel 2.11.0 (CamelContext: testingContext) started in 0.431 seconds
[t) thread #0 - file://src/data] rFileExclusiveReadLockStrategy WARN 
Deleting orphaned lock file: src\data\message1.xml.camelLock
We just downloaded:  message1.xml
before camel context stop
[t) thread #0 - file://src/data] SpringCamelContext INFO  Apache
Camel 2.11.0 (CamelContext: testingContext) is shutting down
*[t) thread #0 - file://src/data] DefaultShutdownStrategyINFO 
Starting to graceful shutdown 1 routes (timeout 5 seconds)
[text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO 
Waiting as there are still 2 inflight and pending exchanges to complete,
timeout in 5 seconds.
[text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO 
Waiting as there are still 2 inflight and pending exchanges to complete,
timeout in 4 seconds.
[text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO 
Waiting as there are still 2 inflight and pending exchanges to complete,
timeout in 3 seconds.
[text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO 
Waiting as there are still 2 inflight and pending exchanges to complete,
timeout in 2 seconds.
[text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO 
Waiting as there are still 2 inflight and pending exchanges to complete,
timeout in 1 seconds.
[t) thread #0 - file://src/data] DefaultShutdownStrategyWARN 
Timeout occurred. Now forcing the routes to be shutdown now.
[text) thread #2 - ShutdownTask] DefaultShutdownStrategyWARN 
Interrupted while waiting during graceful shutdown, will force shutdown
now.*
[text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO  Route:
route1 shutdown complete, was consuming from:
Endpoint[file://src/data?noop=true]
[t) thread #0 - file://src/data] DefaultShutdownStrategyINFO 
Graceful shutdown of 1 routes completed in 5 seconds
[t) thread #0 - file://src/data] DefaultInflightRepository  WARN 
Shutting down while there are still 1 in flight exchanges.
[t) thread #0 - file://src/data] SpringCamelContext INFO  Uptime
6.521 seconds
[t) thread #0 - file://src/data] SpringCamelContext INFO  Apache
Camel 2.11.0 (CamelContext: testingContext) is shutdown in 5.016 seconds
after camel context stop
[t) thread #0 - file://src/data] GenericFileOnCompletionWARN 
Rollback file strategy:
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy@2d57f820
for file: GenericFile[message1.xml]





--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-cannot-do-a-graceful-shutdown-tp5735962.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Why cannot do a graceful shutdown?

2013-07-21 Thread Bilgin Ibryam
Hi,

Have a look here

http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

and use separate thread in your processor to shutdown the Camel

HTH
Bilgin



On 21 July 2013 15:29, bonnahu  wrote:
> Hey guys,
> I need to shutdown the camelcontext in a Processor. Here is what I am doing:
>
> 
>  xmlns="http://camel.apache.org/schema/spring";>
>
> 
>   
>   
>   /order[@test]
>   
>   
>   
> 
>   
>
> Here is the DownloadLogger Processor:
>
> public class DownloadLogger implements Processor {
>
> //private Logger log = new Logger(DownloadLogger.class);
> public void process(Exchange exchange) throws Exception {
> System.out.println("We just downloaded:  "
> + exchange.getIn().getHeader("CamelFileName"));
> System.out.println("before camel context stop");
> /exchange.getContext().getShutdownStrategy().setTimeout(5);
> exchange.getContext().stop();/
> System.out.println("after camel context stop");
> }
> }
>
>
> When I run it, I got the following information. Can someone tell me why I
> can't perform a graceful shutdown
> here?
>
>
> [  main] MainSupportINFO  Apache
> Camel 2.11.0 starting
> [  main] SpringCamelContext INFO  Apache
> Camel 2.11.0 (CamelContext: testingContext) is starting
> [  main] ManagementStrategyFactory  INFO  JMX
> enabled.
> [  main] DefaultTypeConverter   INFO  Loaded
> 175 type converters
> [  main] FileEndpoint   INFO
> Endpoint is configured with noop=true so forcing endpoint to be idempotent
> as well
> [  main] FileEndpoint   INFO  Using
> default memory based idempotent repository with cache max size: 1000
> [  main] XPathBuilder   INFO
> Created default XPathFactory
> com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@31e4c806
> [  main] SpringCamelContext INFO  Route:
> route1 started and consuming from: Endpoint[file://src/data?noop=true]
> [  main] ultManagementLifecycleStrategy INFO  Load
> performance statistics enabled.
> [  main] SpringCamelContext INFO  Total
> 1 routes, of which 1 is started.
> [  main] SpringCamelContext INFO  Apache
> Camel 2.11.0 (CamelContext: testingContext) started in 0.431 seconds
> [t) thread #0 - file://src/data] rFileExclusiveReadLockStrategy WARN
> Deleting orphaned lock file: src\data\message1.xml.camelLock
> We just downloaded:  message1.xml
> before camel context stop
> [t) thread #0 - file://src/data] SpringCamelContext INFO  Apache
> Camel 2.11.0 (CamelContext: testingContext) is shutting down
> *[t) thread #0 - file://src/data] DefaultShutdownStrategyINFO
> Starting to graceful shutdown 1 routes (timeout 5 seconds)
> [text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO
> Waiting as there are still 2 inflight and pending exchanges to complete,
> timeout in 5 seconds.
> [text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO
> Waiting as there are still 2 inflight and pending exchanges to complete,
> timeout in 4 seconds.
> [text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO
> Waiting as there are still 2 inflight and pending exchanges to complete,
> timeout in 3 seconds.
> [text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO
> Waiting as there are still 2 inflight and pending exchanges to complete,
> timeout in 2 seconds.
> [text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO
> Waiting as there are still 2 inflight and pending exchanges to complete,
> timeout in 1 seconds.
> [t) thread #0 - file://src/data] DefaultShutdownStrategyWARN
> Timeout occurred. Now forcing the routes to be shutdown now.
> [text) thread #2 - ShutdownTask] DefaultShutdownStrategyWARN
> Interrupted while waiting during graceful shutdown, will force shutdown
> now.*
> [text) thread #2 - ShutdownTask] DefaultShutdownStrategyINFO  Route:
> route1 shutdown complete, was consuming from:
> Endpoint[file://src/data?noop=true]
> [t) thread #0 - file://src/data] DefaultShutdownStrategyINFO
> Graceful shutdown of 1 routes completed in 5 seconds
> [t) thread #0 - file://src/data] DefaultInflightRepository  WARN
> Shutting down while there are still 1 in flight exchanges.
> [t) thread #0 - file://src/data] SpringCamelContext INFO  Uptime
> 6.521 seconds
> [t) thread #0 - file://src/data] SpringCamelContext INFO  Apache
> Camel 2.11.0 (CamelContext: testingContext) is shutdown in 5.016 seconds
> after camel context stop
> [t) thread #0 - file://src/data] GenericFileOnCompletionWARN
> Rollback file strategy:

Re: JMSExceptions:045101

2013-07-21 Thread gliesian
I don't have the option to change it... any other ideas?



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


Re: New Instance of CamelContext from Spring

2013-07-21 Thread SyedBhai
Nope, it did not help.  Can someone share the answer please if you have?

Thanks,
Syed.



--
View this message in context: 
http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942p5735956.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel HTTP4, not able to use httpContext endpoint option

2013-07-21 Thread lmanchanda75
Hi,

Following is the complete stracktrace:


JBossFuse:karaf@root> org.apache.camel.ResolveEndpointFailedException:
Failed to
 resolve endpoint:
http4://172.16.1.100?authPassword=password&authUsername=username&httpClient.connectionTimeout=4000&httpClient.soTimeout=16000&httpContext=m
essageBrokerAuthContext due to: Found bean: messageBrokerAuthContext in
BlueprintContainer:
org.apache.aries.blueprint.container.BlueprintContainerImpl@c603e7 o
f type: org.apache.http.protocol.BasicHttpContext expected type was:
interface org.apache.http.protocol.HttpContext
at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:488)
at
org.apache.camel.impl.DefaultProducerTemplate.resolveMandatoryEndpoint(DefaultProducerTemplate.java:436)
at
org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:292)
at
org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:329)
at
manchanda.lalit.TryCxfSmooks.IntegrationProcessor.sendHttpRequest(IntegrationProcessor.java:964)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:390)
at
org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:277)
at
org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:250)
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:161)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:81)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:334)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:308)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
at
org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.pro

Re: createTopic "jms.GeneralTopic" is invalid

2013-07-21 Thread Claus Ibsen
Is the topic named "jms.SpecialTopic" or just "SpecialTopic"

If the latter then try with
from("wmq:topic:SpecialTopic").to("file:target/messages/others");

On Sat, Jul 20, 2013 at 2:33 PM, gliesian  wrote:
> And here is my route:
>
> from("wmq:topic:jms.SpecialTopic").to("file:target/messages/others");
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/createTopic-jms-GeneralTopic-is-invalid-tp5735929p5735932.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Camel Consumer in JAX-RS Web Service

2013-07-21 Thread traviskds
I find Camel easy for difficult use cases but hard to simple use cases. Or
maybe I haven't still mastered it.

I have a JAX-RS web service that when executed, will dynamically create a
route that reads mail from an IMAP server and then gets processed via a
bean.

My problem is that I need to add Thread.sleep(1); so that the web
service waits until the route completes. 

My issue is I want a better way to know if the route has completed instead
of setting some arbitrary timer that has the potential for side effects.
(e.g. waiting unnecessarily when the route might have already finished or
even worse existing before the route has time to complete it's work.

I am wondering how others might have done something similar to this
requirement? Any ideas/suggestions are welcome as I have done everything
possible including reading other posts in this forum, looking at the camel
source code and test code without much success.

My main code is below (note I have a JEE6 bootstrap class that starts
CamelContext and which in turn is injected into the below jax-rs service)

@Path("/Mail")
public class ReadMail {

private static final Logger logger = LoggerFactory
.getLogger(ReadMail.class);

@Inject
CdiCamelContext camelContext;

@Path("/read")
@GET
@Produces(MediaType.TEXT_HTML)
public Response getUser(@Context UriInfo uriInfo) {

try {

logger.debug(">>> Reading mail from mail server ..");
MultivaluedMap queryParameters = uriInfo
.getQueryParameters();
String mailProtocol = 
queryParameters.getFirst("mailProtocol").toLowerCase();
String mailHost = 
queryParameters.getFirst("host").toLowerCase();
String userName = queryParameters.getFirst("username");
String password = queryParameters.getFirst("password");

final String MAIL_ENDPOINT_URI = mailProtocol + "://" + 
mailHost
+ "?username="+ userName + "&password=" 
+ password + "&delete=false"
+ 
"&debugMode=true&unseen=true&consumer.delay=5000";

final MailBean mailBean = new MailBean();

camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {

from(MAIL_ENDPOINT_URI).routeId("myRoute")
.bean(mailBean, "processMail");
}
});

Thread.sleep(1);

return
Response.status(Response.Status.OK).entity(mailBean.getMessageBody().toString())
.build();

} catch (Exception e) {
e.printStackTrace();
}
finally {
try {
camelContext.stopRoute("myRoute");
camelContext.removeRoute("myRoute");
} catch (Exception e) {
e.printStackTrace();
}
}

return Response.status(Response.Status.NOT_FOUND)
.entity("Requested search did not return any 
results").build();

}

}

My Bean class is

public class MailBean {

private StringBuilder messageBody = new StringBuilder();

public void processMail(Exchange exchange) throws MessagingException,
IOException {

System.out.println(" Inside MailBean exchangeTest 
");
System.out.println(" Message Id:"+
exchange.getIn().getMessageId());

this.setMessageBody(this.getMessageBody().append("Message Id:"+
exchange.getIn().getMessageId()+ ""));

if (exchange.getIn().getBody() instanceof String) {

this.setMessageBody(this.getMessageBody().append(((String)
exchange.getIn().getBody()).replaceAll("(\r\n|\n)", "")+ ""));

} else if (exchange.getIn().getBody() instanceof Multipart) {


this.setMessageBody(this.getMessageBody().append((Utility.getMultipartText((Multipart)
exchange.getIn().getBody())).replaceAll("(\r\n|\n)","")+ ""));

}   
}

public StringBuilder getMessageBody() {
return messageBody;
}
public void setMessageBody(StringBuilder messageBody) {
this.messageBody = messageBody;
}

}





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Consumer-in-JAX-RS-Web-Service-tp5735968.html
Sent from the Camel - Users mailing

fw: hello

2013-07-21 Thread Jon Anstey
 http://personeelsservice-kwb.nl/tcxfv/hniyxuwxstblt














 janstey















 7/21/2013 5:52:25 PM


Re: New Instance of CamelContext from Spring

2013-07-21 Thread Bilgin Ibryam
CamelContextFactoryBean creates CamelContext as a singleton and its
reference is cached by Spring.

It might be easier for you if you a factory for creating new
CamelContext and you prefer you can still reuse the same route
definitions from Spring XML in each new CamelContext.
Something like this:


public static ModelCamelContext createContext() throws Exception {
ClassPathXmlApplicationContext applicationContext = new
ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");
List routeDefinition =
(List) applicationContext.getBean("routes");
ModelCamelContext camelContext = new
SpringCamelContext(applicationContext);
camelContext.addRouteDefinitions(routeDefinition);
return camelContext;
}

And define the routes in a routeContext


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







HTH
Bilgin

On 21 July 2013 07:13, SyedBhai  wrote:
> Nope, it did not help.  Can someone share the answer please if you have?
>
> Thanks,
> Syed.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942p5735956.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel HTTP component vs. Apache HTTP client

2013-07-21 Thread humayun0156
i've used http4 component and test my code. but it still took 600-800 ms per
request.
my route looks like :
from("direct:npGet")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.setProperty("url", simple("${body}"))
.setHeader(Exchange.HTTP_URI, simple("${body}"))
.to("http4://dummyHost.com?" + npAuthenticationString)
.convertBodyTo(Document.class)
.bean(HelperBean.class, "setUrlETagMapping")
.process(new ObjectCreationProcess(xmlToObjectMapping));




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735974.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Consumer in JAX-RS Web Service

2013-07-21 Thread Sergey Beryozkin
Can you add a final component to that mail route which will simply 
notify this ReadMail resource that the route is done ?


Sergey
On 21/07/13 17:16, traviskds wrote:

I find Camel easy for difficult use cases but hard to simple use cases. Or
maybe I haven't still mastered it.

I have a JAX-RS web service that when executed, will dynamically create a
route that reads mail from an IMAP server and then gets processed via a
bean.

My problem is that I need to add Thread.sleep(1); so that the web
service waits until the route completes.

My issue is I want a better way to know if the route has completed instead
of setting some arbitrary timer that has the potential for side effects.
(e.g. waiting unnecessarily when the route might have already finished or
even worse existing before the route has time to complete it's work.

I am wondering how others might have done something similar to this
requirement? Any ideas/suggestions are welcome as I have done everything
possible including reading other posts in this forum, looking at the camel
source code and test code without much success.

My main code is below (note I have a JEE6 bootstrap class that starts
CamelContext and which in turn is injected into the below jax-rs service)

@Path("/Mail")
public class ReadMail {

private static final Logger logger = LoggerFactory
.getLogger(ReadMail.class);

 @Inject
 CdiCamelContext camelContext;

@Path("/read")
@GET
@Produces(MediaType.TEXT_HTML)
public Response getUser(@Context UriInfo uriInfo) {

try {

logger.debug(">>> Reading mail from mail server ..");
MultivaluedMap queryParameters = uriInfo
.getQueryParameters();
String mailProtocol =
queryParameters.getFirst("mailProtocol").toLowerCase();
String mailHost = 
queryParameters.getFirst("host").toLowerCase();
String userName = queryParameters.getFirst("username");
String password = queryParameters.getFirst("password");

final String MAIL_ENDPOINT_URI = mailProtocol + "://" + 
mailHost
+ "?username="+ userName + "&password=" + password + 
"&delete=false"
+ 
"&debugMode=true&unseen=true&consumer.delay=5000";

final MailBean mailBean = new MailBean();

camelContext.addRoutes(new RouteBuilder() {
public void configure() throws Exception {

from(MAIL_ENDPOINT_URI).routeId("myRoute")
.bean(mailBean, "processMail");
}
});

Thread.sleep(1);

return
Response.status(Response.Status.OK).entity(mailBean.getMessageBody().toString())
.build();

} catch (Exception e) {
e.printStackTrace();
}
finally {
try {
camelContext.stopRoute("myRoute");
camelContext.removeRoute("myRoute");
} catch (Exception e) {
e.printStackTrace();
}
}

return Response.status(Response.Status.NOT_FOUND)
.entity("Requested search did not return any 
results").build();

}

}

My Bean class is

public class MailBean {

private StringBuilder messageBody = new StringBuilder();

public void processMail(Exchange exchange) throws MessagingException,
IOException {

 System.out.println(" Inside MailBean exchangeTest 
");
 System.out.println(" Message Id:"+
exchange.getIn().getMessageId());

 this.setMessageBody(this.getMessageBody().append("Message Id:"+
exchange.getIn().getMessageId()+ ""));

 if (exchange.getIn().getBody() instanceof String) {

this.setMessageBody(this.getMessageBody().append(((String)
exchange.getIn().getBody()).replaceAll("(\r\n|\n)", "")+ ""));

 } else if (exchange.getIn().getBody() instanceof Multipart) {


this.setMessageBody(this.getMessageBody().append((Utility.getMultipartText((Multipart)
exchange.getIn().getBody())).replaceAll("(\r\n|\n)","")+ ""));

 }  
}

public StringBuilder getMessageBody() {
return messageBody;
}
public void setMessageBody(StringBuilder messageBody) {
this.messageBody = messageBody;
   

RE: New Instance of CamelContext from Spring

2013-07-21 Thread SyedBhai
Dear Bilgin,  That really really helped.  Atlast, I found what I wanted.  
Thanks very much.
Syed.

Date: Sun, 21 Jul 2013 09:53:55 -0700
From: ml-node+s465427n5735973...@n5.nabble.com
To: syedahmed.c...@hotmail.com
Subject: Re: New Instance of CamelContext from Spring



CamelContextFactoryBean creates CamelContext as a singleton and its

reference is cached by Spring.


It might be easier for you if you a factory for creating new

CamelContext and you prefer you can still reuse the same route

definitions from Spring XML in each new CamelContext.

Something like this:



public static ModelCamelContext createContext() throws Exception {

ClassPathXmlApplicationContext applicationContext = new

ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml");

List routeDefinition =

(List) applicationContext.getBean("routes");

ModelCamelContext camelContext = new

SpringCamelContext(applicationContext);

camelContext.addRouteDefinitions(routeDefinition);

return camelContext;

}


And define the routes in a routeContext



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













HTH

Bilgin


On 21 July 2013 07:13, SyedBhai <[hidden email]> wrote:

> Nope, it did not help.  Can someone share the answer please if you have?

>

> Thanks,

> Syed.

>

>

>

> --

> View this message in context: 
> http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942p5735956.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/New-Instance-of-CamelContext-from-Spring-tp5735942p5735973.html



To unsubscribe from New Instance of CamelContext from Spring, 
click here.

NAML
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/New-Instance-of-CamelContext-from-Spring-tp5735942p5735976.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Message Processing Performance while splitting

2013-07-21 Thread Viktor Kubinec
Thanks Willem.

I've created custom splitter, which is using BufferedReader, just as you
suggested. It has improved the performance a bit but it is still much slower
(10-20x) than the java code that I posted. I have spent bit more time
investigating this problem. The code (with documentation on how to use it)
is available here :

https://github.com/Viktor-Kubinec/Camel

I am using Apache Camel verison 2.11.1. My test file is ~1Gb large, contains
100M rows with message "Test Line" in each row. I have two testing scenarios
:

1. SplitTest - I just read big file containing short lines, split it line by
line with my custom splitter and logging the process (every 50k-th message)

2. Same as 1. but I've added 10 processors that do nothing (because I
observed that adding processors reduces performance)

Results : 

java code : 1.5-2M lines per second - no profiling done

1. 150k lines per second and here are some hot spots (from VisualVM) :

java.lang.Class.getSimpleName()  (57.3%)
org.apache.camel.processor.MulticastProcessor.doAggregate()  (39.2%)
java.io.BufferedReader.readLine()(3.1%)
...

2. 72k lines per second :

org.apache.camel.processor.MulticastProcessor.doAggregate()   (70.5%)
java.lang.Class.getSimpleName()  (28.8%)
java.io.BufferedReader.readLine()  (0.3%)
...

I have saved snapshots from VisualVM - they are available in the github
repository (link above) : SplitTest.nps, SplitTestWithProcessors.nps. More
details are available there.

This was done on my laptop. I've read that VisualVM has some effect on
performance (~5%). java.lang.Class.getSimpleName() is being called in
constructor of org.apache.camel.impl.DefaultUnitOfWork. In first scenario
only 3.1% of thread time was spent in the readLine() method. In second
scenario it was only 0.3%. That is very low.

Is there a way how I can optimize this?

Thanks,

Viktor





--
View this message in context: 
http://camel.465427.n5.nabble.com/Message-Processing-Performance-while-splitting-tp5735824p5735979.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Mocking consumer endpoints

2013-07-21 Thread Bilgin Ibryam
Then I think I method like the following in CamelTestSupport

public void replaceRouteFromWith(String routeId, String fromEndpoint) {
fromEndpoints.put(routeId, fromEndpoint);
}

and some additions to doSetUp()

for (final Map.Entry entry : fromEndpoints.entrySet()) {
context.getRouteDefinition(entry.getKey()).adviceWith(context,
new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
replaceFromWith(entry.getValue());
}
});
}

would be useful for replacing from endpoints in tests.

I will add that soon if there are no objections.

Bilgin

On 11 July 2013 18:16, Claus Ibsen  wrote:
> No there is not.
>
> On Mon, Jul 1, 2013 at 6:55 PM, Bilgin Ibryam  wrote:
>> Hi,
>>
>> with CamelTestSupport I can use isMockEndpointsAndSkip method to mock
>> existing endpoints, but for mocking the consumer endpoint I still have to
>> use AdviceWithRouteBuilder.
>>
>> Is there a method in CamelTestSupport that I can override and mock the
>> consumer endpoints?
>>
>> Thanks
>> Bilgin
>
>
>
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen


Re: Message Processing Performance while splitting

2013-07-21 Thread Claus Ibsen
Hi

You cant really compare the 2 approaches.
In the pure java code you just have a for loop in a single method
which is as fast as you can go.
When using Camel routes and the EIPs then a lot more goes on under the hood.


On Sun, Jul 21, 2013 at 10:12 PM, Viktor Kubinec  wrote:
> Thanks Willem.
>
> I've created custom splitter, which is using BufferedReader, just as you
> suggested. It has improved the performance a bit but it is still much slower
> (10-20x) than the java code that I posted. I have spent bit more time
> investigating this problem. The code (with documentation on how to use it)
> is available here :
>
> https://github.com/Viktor-Kubinec/Camel
>
> I am using Apache Camel verison 2.11.1. My test file is ~1Gb large, contains
> 100M rows with message "Test Line" in each row. I have two testing scenarios
> :
>
> 1. SplitTest - I just read big file containing short lines, split it line by
> line with my custom splitter and logging the process (every 50k-th message)
>
> 2. Same as 1. but I've added 10 processors that do nothing (because I
> observed that adding processors reduces performance)
>
> Results :
>
> java code : 1.5-2M lines per second - no profiling done
>
> 1. 150k lines per second and here are some hot spots (from VisualVM) :
>
> java.lang.Class.getSimpleName()  (57.3%)
> org.apache.camel.processor.MulticastProcessor.doAggregate()  (39.2%)
> java.io.BufferedReader.readLine()(3.1%)
> ...
>
> 2. 72k lines per second :
>
> org.apache.camel.processor.MulticastProcessor.doAggregate()   (70.5%)
> java.lang.Class.getSimpleName()  (28.8%)
> java.io.BufferedReader.readLine()  (0.3%)
> ...
>
> I have saved snapshots from VisualVM - they are available in the github
> repository (link above) : SplitTest.nps, SplitTestWithProcessors.nps. More
> details are available there.
>
> This was done on my laptop. I've read that VisualVM has some effect on
> performance (~5%). java.lang.Class.getSimpleName() is being called in
> constructor of org.apache.camel.impl.DefaultUnitOfWork. In first scenario
> only 3.1% of thread time was spent in the readLine() method. In second
> scenario it was only 0.3%. That is very low.
>
> Is there a way how I can optimize this?
>
> Thanks,
>
> Viktor
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Message-Processing-Performance-while-splitting-tp5735824p5735979.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Why cannot do a graceful shutdown?

2013-07-21 Thread bonnahu
Hey Bilgin,
Thanks for your reply. It works for me!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-cannot-do-a-graceful-shutdown-tp5735962p5735987.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: fw: hello

2013-07-21 Thread Jon Anstey
Please don't click this link. Some hacker in Belarus hijacked my account
today and sent this out.

Cheers,
Jon
On 2013-07-21 2:23 PM, "Jon Anstey"  wrote:

>  http://personeelsservice-kwb.nl/tcxfv/hniyxuwxstblt
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  janstey
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  7/21/2013 5:52:25 PM
>


Re: Camel HTTP component vs. Apache HTTP client

2013-07-21 Thread Willem Jiang
Do you know what's the size of the XML file?
Camel will try to cache the XML input stream into a file if the input
stream size is big than 64K.
You can set the size bigger to avoid caching the input stream into a file
by setting the properties in CamelContext like
context.getProperties().put(CachedOutputStream.THRESHOLD, "1048576");

You can find more information here[1]

[1]http://camel.apache.org/stream-caching.html



On Mon, Jul 22, 2013 at 1:50 AM, humayun0156  wrote:

> i've used http4 component and test my code. but it still took 600-800 ms
> per
> request.
> my route looks like :
> from("direct:npGet")
> .setHeader(Exchange.HTTP_METHOD, constant("GET"))
> .setProperty("url", simple("${body}"))
> .setHeader(Exchange.HTTP_URI, simple("${body}"))
> .to("http4://dummyHost.com?" + npAuthenticationString)
> .convertBodyTo(Document.class)
> .bean(HelperBean.class, "setUrlETagMapping")
> .process(new ObjectCreationProcess(xmlToObjectMapping));
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735974.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: camel error with simple program with camel-core-2.11.1.jar

2013-07-21 Thread vinay
Hi Claus,

Sorry about the delayed response

I tried, adding "{Exchange it -> .}" but didn't worked.

.process ({ Exchange it -> println "in processor: ${it.in.body}"
it.out.body = it.in.body.toUpperCase()
  } )

following works...

 .process ({ Exchange it -> println "in processor: ${it.in.body}"
 it.out.body = it.in.body.toUpperCase()
   } as org.apache.camel.Processor)



any suggestions..

thanks,
Vinay





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-error-with-simple-program-with-camel-core-2-11-1-jar-tp5735829p5735990.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Message Processing Performance while splitting

2013-07-21 Thread Willem Jiang
When you add more processors into the route, camel need to do lots of
addition work to handle the message.
If you want a good performance, you should use the Java code to do the loop
in a single method.
But it could be good method for us find the hot spots  the performance
those camel introduces.


Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
(English)
  http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem


On Mon, Jul 22, 2013 at 4:29 AM, Claus Ibsen  wrote:

> Hi
>
> You cant really compare the 2 approaches.
> In the pure java code you just have a for loop in a single method
> which is as fast as you can go.
> When using Camel routes and the EIPs then a lot more goes on under the
> hood.
>
>
> On Sun, Jul 21, 2013 at 10:12 PM, Viktor Kubinec 
> wrote:
> > Thanks Willem.
> >
> > I've created custom splitter, which is using BufferedReader, just as you
> > suggested. It has improved the performance a bit but it is still much
> slower
> > (10-20x) than the java code that I posted. I have spent bit more time
> > investigating this problem. The code (with documentation on how to use
> it)
> > is available here :
> >
> > https://github.com/Viktor-Kubinec/Camel
> >
> > I am using Apache Camel verison 2.11.1. My test file is ~1Gb large,
> contains
> > 100M rows with message "Test Line" in each row. I have two testing
> scenarios
> > :
> >
> > 1. SplitTest - I just read big file containing short lines, split it
> line by
> > line with my custom splitter and logging the process (every 50k-th
> message)
> >
> > 2. Same as 1. but I've added 10 processors that do nothing (because I
> > observed that adding processors reduces performance)
> >
> > Results :
> >
> > java code : 1.5-2M lines per second - no profiling done
> >
> > 1. 150k lines per second and here are some hot spots (from VisualVM) :
> >
> > java.lang.Class.getSimpleName()  (57.3%)
> > org.apache.camel.processor.MulticastProcessor.doAggregate()  (39.2%)
> > java.io.BufferedReader.readLine()(3.1%)
> > ...
> >
> > 2. 72k lines per second :
> >
> > org.apache.camel.processor.MulticastProcessor.doAggregate()   (70.5%)
> > java.lang.Class.getSimpleName()  (28.8%)
> > java.io.BufferedReader.readLine()  (0.3%)
> > ...
> >
> > I have saved snapshots from VisualVM - they are available in the github
> > repository (link above) : SplitTest.nps, SplitTestWithProcessors.nps.
> More
> > details are available there.
> >
> > This was done on my laptop. I've read that VisualVM has some effect on
> > performance (~5%). java.lang.Class.getSimpleName() is being called in
> > constructor of org.apache.camel.impl.DefaultUnitOfWork. In first scenario
> > only 3.1% of thread time was spent in the readLine() method. In second
> > scenario it was only 0.3%. That is very low.
> >
> > Is there a way how I can optimize this?
> >
> > Thanks,
> >
> > Viktor
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Message-Processing-Performance-while-splitting-tp5735824p5735979.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>


After camelContext shutdown, is any way to exit the Java main() method?

2013-07-21 Thread bonnahu
Hi guys,
I got another question here. I start my camelContext in the main(), then in
the route, I stop the camelContext 
in a Processor. Now I can see the camelContext is shutdown gracefully.
However, the Java application is still running. My question is that whether
there is a way to exit the Java main() automatically after the camelContext
is shutdown. 


public static void main(String[] args) throws Exception {
String filename = "META-INF/spring/testingcontext.xml";
Main main = new Main();
main.setApplicationContextUri(filename);
main.enableHangupSupport();
main.run();
}


public class DownloadLogger implements Processor {
public void process(final Exchange exchange) throws Exception {
System.out.println("We just downloaded:  " 
+ exchange.getIn().getHeader("CamelFileName"));
Thread stop = new Thread() {
@Override
public void run() {
try {
//exchange.getContext().stopRoute("myRoute");

exchange.getContext().getShutdownStrategy().setTimeout(5);
exchange.getContext().stop();
} catch (Exception e) {
// ignore
}
}
};
stop.start();
System.out.println("after camel context stop");
}
}
I
thansk in advance!

Lei



--
View this message in context: 
http://camel.465427.n5.nabble.com/After-camelContext-shutdown-is-any-way-to-exit-the-Java-main-method-tp5735993.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel HTTP component vs. Apache HTTP client

2013-07-21 Thread humayun0156
my xml files are not more than 5kb and i don't want to cache them.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735995.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: After camelContext shutdown, is any way to exit the Java main() method?

2013-07-21 Thread Willem Jiang
As you are using camel main to start the camel context. You need to call
the System.exit() when the Camel context is stopped.


Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
(English)
  http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem


On Mon, Jul 22, 2013 at 10:40 AM, bonnahu  wrote:

> Hi guys,
> I got another question here. I start my camelContext in the main(), then in
> the route, I stop the camelContext
> in a Processor. Now I can see the camelContext is shutdown gracefully.
> However, the Java application is still running. My question is that whether
> there is a way to exit the Java main() automatically after the camelContext
> is shutdown.
>
>
> public static void main(String[] args) throws Exception {
> String filename = "META-INF/spring/testingcontext.xml";
> Main main = new Main();
> main.setApplicationContextUri(filename);
> main.enableHangupSupport();
> main.run();
> }
>
>
> public class DownloadLogger implements Processor {
> public void process(final Exchange exchange) throws Exception {
> System.out.println("We just downloaded:  "
> + exchange.getIn().getHeader("CamelFileName"));
> Thread stop = new Thread() {
> @Override
> public void run() {
> try {
> //exchange.getContext().stopRoute("myRoute");
>
> exchange.getContext().getShutdownStrategy().setTimeout(5);
> exchange.getContext().stop();
> } catch (Exception e) {
> // ignore
> }
> }
> };
> stop.start();
> System.out.println("after camel context stop");
> }
> }
> I
> thansk in advance!
>
> Lei
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/After-camelContext-shutdown-is-any-way-to-exit-the-Java-main-method-tp5735993.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel HTTP component vs. Apache HTTP client

2013-07-21 Thread Willem Jiang
It makes sense that camel has lots of things to do beside processing the
message as you do with HttpClient.



Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
(English)
  http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem


On Mon, Jul 22, 2013 at 11:26 AM, humayun0156  wrote:

> my xml files are not more than 5kb and i don't want to cache them.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-HTTP-component-vs-Apache-HTTP-client-tp5735943p5735995.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: camel error with simple program with camel-core-2.11.1.jar

2013-07-21 Thread vinay
update..

I get following warning when starting camel...

WARNING: Module [camel-groovy] - Unable to load extension class [class
org.apach
e.camel.groovy.extend.CamelGroovyMethods] due to
[org/apache/camel/Expression].
Maybe this module is not supported by your JVM version.

regards,
Vinay



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-error-with-simple-program-with-camel-core-2-11-1-jar-tp5735829p5736000.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel cache consumer (event based)

2013-07-21 Thread rrajen2
Hi
 I have a Camel cache producer built using EHCache. I was wondering if I
want a event-based Cache consumer to consume from it, how would I be able to
do it? Assume I have a Cache named cache://testCache with its producer
built. Please share sample code demonstrating a event based consumer from
the cache cache://testCache showing cache changes like
addition/update/delete events.

Thanks




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-cache-consumer-event-based-tp5736001.html
Sent from the Camel - Users mailing list archive at Nabble.com.