Re: unable to see all the palettes in Fuse

2014-01-03 Thread Claus Ibsen
Hi

Please use the Fuse user forum for questions about Fuse IDE
https://community.jboss.org/en/jbossfuse

You can see a list of forums / irc / issue tracker for Fuse IDE here
https://github.com/fusesource/fuseide

On Fri, Jan 3, 2014 at 6:49 AM, maheshpvd mahesh...@gmail.com wrote:
 Hi,

 while creating camel-context.xml in fuse-ide i'm unable to see all the
 palettes that are present. it shows only few palettes. how to get all the
 palettes to be displayed...?

 Thanks in advance.
  Thank you.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/unable-to-see-all-the-palettes-in-Fuse-tp5745466.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
Make your Camel applications look hawt, try: http://hawt.io


Re: suspend and resume routes

2014-01-03 Thread Claus Ibsen
Hi

Can you try using getRouteStatus from CamelContext.

http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#getRouteStatus(java.lang.String)

On Thu, Jan 2, 2014 at 8:39 PM, frida stefanopu...@gmail.com wrote:
 Hi Claus,

 to get the route status I'm just checking route.getStatus()

 this.getCamelContext().suspendRoute(route.getId(), 5, TimeUnit.SECONDS);
 //here I've also tried a brutal thread.sleep (7000);
 log.info(route {}  (status: {}), new Object[]{id, route.getStatus()});
 that turns in
 INFO  com.ste.controller.camel.CamelController  - route route1 (status:
 Started)

 and in my jsp:
 c:out value=${route.status} / == Started
 c:out value=${route.suspended} / == false
 c:out value=${route.suspending} / == false


 Thanks!



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/suspend-and-resume-routes-tp5745446p5745451.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
Make your Camel applications look hawt, try: http://hawt.io


Re: Failed to create route

2014-01-03 Thread fkfausa
Thank's guy's. Your comments made me realize that i lacked beans. One of them
was required that set up the transaction policy. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Failed-to-create-route-tp5745435p5745476.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: suspend and resume routes

2014-01-03 Thread frida
Yes!

camelContext().getRouteStatus(id) returns Suspended as expected :)

I've noticed the same behaviour with route.resume(); VS
camelContext().resumeRoute(id);




2014/1/3 Claus Ibsen-2 [via Camel] ml-node+s465427n5745475...@n5.nabble.com


 Hi

 Can you try using getRouteStatus from CamelContext.


 http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#getRouteStatus(java.lang.String)


 On Thu, Jan 2, 2014 at 8:39 PM, frida [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5745475i=0
 wrote:

  Hi Claus,
 
  to get the route status I'm just checking route.getStatus()
 
  this.getCamelContext().suspendRoute(route.getId(), 5, TimeUnit.SECONDS);
  //here I've also tried a brutal thread.sleep (7000);
  log.info(route {}  (status: {}), new Object[]{id,
 route.getStatus()});
  that turns in
  INFO  com.ste.controller.camel.CamelController  - route route1 (status:
  Started)
 
  and in my jsp:
  c:out value=${route.status} / == Started
  c:out value=${route.suspended} / == false
  c:out value=${route.suspending} / == false
 
 
  Thanks!
 
 
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/suspend-and-resume-routes-tp5745446p5745451.html

  Sent from the Camel - Users mailing list archive at Nabble.com.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: [hidden email]http://user/SendEmail.jtp?type=nodenode=5745475i=1
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 Make your Camel applications look hawt, try: http://hawt.io


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://camel.465427.n5.nabble.com/suspend-and-resume-routes-tp5745446p5745475.html
  To unsubscribe from suspend and resume routes, click 
 herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5745446code=c3RlZmFub3B1ZGR1QGdtYWlsLmNvbXw1NzQ1NDQ2fC0xMzQ0NzkwMjc3
 .
 NAMLhttp://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/suspend-and-resume-routes-tp5745446p5745477.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Access another CamelContext

2014-01-03 Thread Hilderich
Hello again,

My approach above doesn't work steadily because more than one bundle exports
a service
with the same interface org.apache.camel.CamelContext. Now I have the
situation that
sometimes the Camel-Context is from that and then later the Camel-Context
is from the other bundle.
How can I use OSGi-Service-Metadata in Blueprint to use only the
Camel-Context of
one specific bundle?

Kind Regards
Hilderich



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


Re: Need for XA?

2014-01-03 Thread Henryk Konsek
Hi Tom,

 In our application we have a lot of routes that follow the same pattern:
 read a message, do some processing, update/insert in the database and then
 send a message to the next route.
 (...)
 do we need XA transactions (...) ?

That's right. You don't need XA to transactionally process your
message flow. Plain local JMS transaction, ActiveMQ reredelivery
mechanism and some Camel magic will be fine here. :)

Just mark consumer endpoint as transactional [1] (as demonstrated on
the snippet below) and ActiveMQ will handle the message redelivery for
you.

from uri=activemq:div.line/
transacted/
bean ref=divServiceActivator method=validateDivLine/

Keep in mind that ActiveMQ broker will keep the message in div.line
queue until the transaction will be committed by the Camel at the end
of the route (after sending message to div.line.processed queue). If
divServiceActivator will throw the exception during the DB update, the
Camel will not commit and message incoming from div.line will be
redelivered by the broker. You can control how many times message will
be redelivered by the broker on the ActiveMQ configuration level [2].

Now is the tricky part. Notice that it is still possible that Camel
can fail to commit JMS transaction *after* successful DB update (power
outages happen). That would mean that incoming message will be
redelivered and processed twice. To handle this situation and keep
your system state concise make divServiceActivator#persistDivVehicle()
bean invocation idempotent [3], so it won't try to alter database
twice. You can also try to make
divServiceActivator#persistDivVehicle() operation idempotent on the
business logic level (sometimes it is as trivial as checking if entity
with given ID hasn't been persisted already).

Cheers.

[1] http://camel.apache.org/transactional-client.html
[2] http://activemq.apache.org/message-redelivery-and-dlq-handling.html
[3] http://camel.apache.org/idempotent-consumer.html

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: Access another CamelContext

2014-01-03 Thread Hilderich
Hello *,

I figured it out:

In Apache Karaf I checked the service metadata via:



The following output gave me a view to the server metadata
and I saw the key *camel.context.name*

In my blueprint I was able to write the following:



The crucial thing above is the filter attribute.

That's it.

Kind regards
Hilderich





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


ActiveMQ consumer remains after shutdown

2014-01-03 Thread Muhammad Ichsan
I have routes defined in an OSGi bundle. The routes use activemq
component to process data. To be exact, I have camel listen into 3
different queue with concurrency = 10.

As I started it in servicemix (apache-servicemix-4.4.0-fuse-00-27), I
see in the Active MQ Web console that the queues are consumed as
expected:
- queue.a = 10 concurrent consumers
- queue.b = 10 concurrent consumers
- queue.c = 10 concurrent consumers

Without doing any transaction, I stop the bundle. But strangely I have
the following fact:
- queue.a = 10 concurrent consumers
- queue.b = 9 concurrent consumers
- queue.c = 1 concurrent consumers

where I expect all of them to be 0 concurrent consumers.

This is a big problem, since when I start the bundle back, it creates
more than 10 concurrent consumers for each queue. And my transaction
can not run properly, because the old consumers (which remains),
interfere the transaction messages.

My question is, what's wrong here? Is a bug? Or I should do something
to make it as expected?

FYI, this is my ActiveMQ log level = INFO on Servicemix:
http://pastebin.com/AcgQApDK

Thanks

-- 
~The best men are men who benefit to others
http://www.michsan.web.id 一緒に勉強しましょう!

Yang berkualitas memang beda rasanya!
http://rizqi-cookies.com


set the value of camel body as value of constructor-arg

2014-01-03 Thread Satyam Maloo
I have the following bean declaration in camel-context.xml

bean id=AmbiguousData class=java.lang.Exception
constructor-arg index=0 type=java.lang.String value=${body} /
/bean
The value of body is set dynamically in camel. From the logs I am able to
verify that the body is correct(Ambiguous data found for Test2), but the
value passed to the bean is wrong(${body}).

LOG:

...

BodyType:String , Body:Ambiguous data found for IMSI_Test2 ,
CaughtExceptionType:java.lang.Exception, CaughtExceptionMessage:${body},
StackTrace:java.lang.Exception: ${body} at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121)
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
..

How do I resolve this issue?



-
Satyam A Maloo
--
View this message in context: 
http://camel.465427.n5.nabble.com/set-the-value-of-camel-body-as-value-of-constructor-arg-tp5745482.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Access another CamelContext

2014-01-03 Thread Richard Kettelerij
Thanks for the update. This might help other users.


On Fri, Jan 3, 2014 at 10:58 AM, Hilderich hilde.sch...@yahoo.de wrote:

 Hello *,

 I figured it out:

 In Apache Karaf I checked the service metadata via:



 The following output gave me a view to the server metadata
 and I saw the key *camel.context.name*

 In my blueprint I was able to write the following:



 The crucial thing above is the filter attribute.

 That's it.

 Kind regards
 Hilderich





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



Re: set the value of camel body as value of constructor-arg

2014-01-03 Thread Richard Kettelerij
Can you post your route?


On Fri, Jan 3, 2014 at 12:25 PM, Satyam Maloo maloosat...@gmail.com wrote:

 I have the following bean declaration in camel-context.xml

 bean id=AmbiguousData class=java.lang.Exception
 constructor-arg index=0 type=java.lang.String value=${body} /
 /bean
 The value of body is set dynamically in camel. From the logs I am able to
 verify that the body is correct(Ambiguous data found for Test2), but the
 value passed to the bean is wrong(${body}).

 LOG:

 ...

 BodyType:String , Body:Ambiguous data found for IMSI_Test2 ,
 CaughtExceptionType:java.lang.Exception, CaughtExceptionMessage:${body},
 StackTrace:java.lang.Exception: ${body} at
 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at

 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at

 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at
 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at

 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121)
 at

 org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
 ..

 How do I resolve this issue?



 -
 Satyam A Maloo
 --
 View this message in context:
 http://camel.465427.n5.nabble.com/set-the-value-of-camel-body-as-value-of-constructor-arg-tp5745482.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: ActiveMQ consumer remains after shutdown

2014-01-03 Thread Claus Ibsen
If you use a connection pool then make sure that this pool is also
shutdown when you stop the bundle.

eg usually that is to ensure the pool start|stop methods is invoked.

See details at:
http://camel.apache.org/activemq

On Fri, Jan 3, 2014 at 12:07 PM, Muhammad Ichsan ich...@gmail.com wrote:
 I have routes defined in an OSGi bundle. The routes use activemq
 component to process data. To be exact, I have camel listen into 3
 different queue with concurrency = 10.

 As I started it in servicemix (apache-servicemix-4.4.0-fuse-00-27), I
 see in the Active MQ Web console that the queues are consumed as
 expected:
 - queue.a = 10 concurrent consumers
 - queue.b = 10 concurrent consumers
 - queue.c = 10 concurrent consumers

 Without doing any transaction, I stop the bundle. But strangely I have
 the following fact:
 - queue.a = 10 concurrent consumers
 - queue.b = 9 concurrent consumers
 - queue.c = 1 concurrent consumers

 where I expect all of them to be 0 concurrent consumers.

 This is a big problem, since when I start the bundle back, it creates
 more than 10 concurrent consumers for each queue. And my transaction
 can not run properly, because the old consumers (which remains),
 interfere the transaction messages.

 My question is, what's wrong here? Is a bug? Or I should do something
 to make it as expected?

 FYI, this is my ActiveMQ log level = INFO on Servicemix:
 http://pastebin.com/AcgQApDK

 Thanks

 --
 ~The best men are men who benefit to others
 http://www.michsan.web.id 一緒に勉強しましょう!

 Yang berkualitas memang beda rasanya!
 http://rizqi-cookies.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
Make your Camel applications look hawt, try: http://hawt.io


Re: set the value of camel body as value of constructor-arg

2014-01-03 Thread Claus Ibsen
On Fri, Jan 3, 2014 at 12:25 PM, Satyam Maloo maloosat...@gmail.com wrote:
 I have the following bean declaration in camel-context.xml

 bean id=AmbiguousData class=java.lang.Exception
 constructor-arg index=0 type=java.lang.String value=${body} /
 /bean

You cannot do this, as bean is simple/blueprint and ${body} is
Camel's expression language.

Also when using bean is created once at startup.

You may want to use a bean factory and call it from a Camel route
where you can pass in the body as a parameter to it.



 The value of body is set dynamically in camel. From the logs I am able to
 verify that the body is correct(Ambiguous data found for Test2), but the
 value passed to the bean is wrong(${body}).

 LOG:

 ...

 BodyType:String , Body:Ambiguous data found for IMSI_Test2 ,
 CaughtExceptionType:java.lang.Exception, CaughtExceptionMessage:${body},
 StackTrace:java.lang.Exception: ${body} at
 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at
 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at
 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at
 org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121)
 at
 org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
 ..

 How do I resolve this issue?



 -
 Satyam A Maloo
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/set-the-value-of-camel-body-as-value-of-constructor-arg-tp5745482.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
Make your Camel applications look hawt, try: http://hawt.io


Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Stephan Burkard
Hi Henryk

 Are you sure? :) Exchange properties are propagated as well as
 headers. Can you show me an example, where the properties are not
 propagated down the route?

Wow, I just realized that there are producer methods to send a body and a
property. I never noticed them before because I always used the ones for
body and header(s).

But however, I need to send expected headers into most of my tests, so I
would need to have a method that takes body, header-map and a property or
even a property-map. At least in my current Camel version (2.9.x) I didn't
found a way to do this. Am I wrong? Have you another pleasant surprise for
me? :)

Thanks a lot!
Stephan



On Tue, Dec 31, 2013 at 11:06 AM, Henryk Konsek hekon...@gmail.com wrote:

  @Henryk: Yes, that works fine for message headers, I use it a lot to pass
  expected message headers. But it is not possible for Exchange properties.

 Are you sure? :) Exchange properties are propagated as well as
 headers. Can you show me an example, where the properties are not
 propagated down the route?

  @Willem: Yes, that's true. It feels a bit cumbersome, but it works.

 Yeah, the whole point of using mocking library is to reduce the
 boilerplate, so I won't implement interfaces as well. Also not always
 you would like to introduce interface for the bean and tests design
 shouldn't force you to do so. There is also a chance that you might
 work with 3rd party beans (developed by the other team for example)
 which you can't refactor. You definitely need a way to live with the
 mocks in your routes :) .

  Based on your answers, I guess there is no fundamental Camel concept I am
  missing, but simply the Camel best practices that need to mature in my
  Camel routes and tests :-)

 Yes. There is no hidden Camel feature that could help you here. :)

 --
 Henryk Konsek
 http://henryk-konsek.blogspot.com



Re: How to read aggregation from HawtDB when Camel cannot read it by index

2014-01-03 Thread Stephan Burkard
I know it is somehow the wrong place, but the HawtDB Google group seems to
be dead (at least my posted question never appeared).

Is there anybody who has written or commited to the hawtdb component of
Camel I can ask?

Thanks
Stephan



On Fri, Dec 20, 2013 at 10:51 AM, Stephan Burkard sburk...@gmail.comwrote:

 Hi Camel users

 I am trying to recover data from a Camel aggregator persistent hawtdb
 repository (Camel 2.9.x). The aggregator was killed unexpectedly because of
 an out-of-memory-error.

 I wrote a small Java class that opens the hawtdb file, creates a
 HawtDBAggregationRepository instance that uses the file and tried to get
 the index keys and aggregations from it.

 I was able to get almost all aggregations from it, only two of them throw
 the exception below when I try to access them. Can I access them in another
 way to recover the aggregated data?

 Thanks for any help
 Stephan



 WARN | HawtDBFile | Error executing work Getting key
 [7601003010220_XML400]. Will do rollback.
 org.fusesource.hawtdb.api.IndexException: java.io.EOFException
 at
 org.fusesource.hawtdb.api.AbstractStreamPagedAccessor.load(AbstractStreamPagedAccessor.java:66)
 at
 org.fusesource.hawtdb.internal.index.BTreeIndex.loadNode(BTreeIndex.java:238)
 at
 org.fusesource.hawtdb.internal.index.BTreeNode.getChild(BTreeNode.java:261)
 at
 org.fusesource.hawtdb.internal.index.BTreeNode.getLeafNode(BTreeNode.java:772)
 at
 org.fusesource.hawtdb.internal.index.BTreeNode.get(BTreeNode.java:652)
 at
 org.fusesource.hawtdb.internal.index.BTreeIndex.get(BTreeIndex.java:85)
 at
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository$2.execute(HawtDBAggregationRepository.java:150)
 at
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository$2.execute(HawtDBAggregationRepository.java:144)
 at
 org.apache.camel.component.hawtdb.HawtDBFile.doExecute(HawtDBFile.java:165)
 at
 org.apache.camel.component.hawtdb.HawtDBFile.execute(HawtDBFile.java:119)
 at
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository.get(HawtDBAggregationRepository.java:144)
 at
 ch.visana.ke.concierge.VisanaHawtDbRecovery.readExchangeByKeyFromRepository(VisanaHawtDbRecovery.java:81)
 at
 ch.visana.ke.concierge.VisanaHawtDbRecovery.testGetAggregationExchangeByKey(VisanaHawtDbRecovery.java:70)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
 at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
 at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at
 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at
 org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
 at
 org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
 at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
 Caused by: java.io.EOFException
 at
 org.fusesource.hawtdb.internal.page.ExtentInputStream.read(ExtentInputStream.java:80)
 at java.io.DataInputStream.readFully(DataInputStream.java:178)
 at java.io.DataInputStream.readFully(DataInputStream.java:152)
 at
 org.fusesource.hawtbuf.codec.AbstractBufferCodec.decode(AbstractBufferCodec.java:40)
 at
 

Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Claus Ibsen
Just use the send/request method that takes a processor, and then use
an inlined processor to set the headers/properties/body on the
exchange in message.

There is also an ExchangeBuilder AFAIR that you may use as well. Then
you can use that to create an exchange, to send with the produce
template.

On Fri, Jan 3, 2014 at 12:41 PM, Stephan Burkard sburk...@gmail.com wrote:
 Hi Henryk

 Are you sure? :) Exchange properties are propagated as well as
 headers. Can you show me an example, where the properties are not
 propagated down the route?

 Wow, I just realized that there are producer methods to send a body and a
 property. I never noticed them before because I always used the ones for
 body and header(s).

 But however, I need to send expected headers into most of my tests, so I
 would need to have a method that takes body, header-map and a property or
 even a property-map. At least in my current Camel version (2.9.x) I didn't
 found a way to do this. Am I wrong? Have you another pleasant surprise for
 me? :)

 Thanks a lot!
 Stephan



 On Tue, Dec 31, 2013 at 11:06 AM, Henryk Konsek hekon...@gmail.com wrote:

  @Henryk: Yes, that works fine for message headers, I use it a lot to pass
  expected message headers. But it is not possible for Exchange properties.

 Are you sure? :) Exchange properties are propagated as well as
 headers. Can you show me an example, where the properties are not
 propagated down the route?

  @Willem: Yes, that's true. It feels a bit cumbersome, but it works.

 Yeah, the whole point of using mocking library is to reduce the
 boilerplate, so I won't implement interfaces as well. Also not always
 you would like to introduce interface for the bean and tests design
 shouldn't force you to do so. There is also a chance that you might
 work with 3rd party beans (developed by the other team for example)
 which you can't refactor. You definitely need a way to live with the
 mocks in your routes :) .

  Based on your answers, I guess there is no fundamental Camel concept I am
  missing, but simply the Camel best practices that need to mature in my
  Camel routes and tests :-)

 Yes. There is no hidden Camel feature that could help you here. :)

 --
 Henryk Konsek
 http://henryk-konsek.blogspot.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
Make your Camel applications look hawt, try: http://hawt.io


Re: How to read aggregation from HawtDB when Camel cannot read it by index

2014-01-03 Thread Claus Ibsen
camel-hawtdb is deprecated as posted on
http://camel.apache.org/hawtdb

hawtdb is though an open source project so you can dive into the
source code, and help that project. But as said hawtdb project is also
considered deprecated, as its better to use the more stable and wide
in use leveldb instead.

If you are a Red Hat subscriber then you can get professional support
on hawtdb as its shipped as part of JBoss Fuse, and thus you can use
that as a hammer to get help. Also Red Hat employees the main
developers on hawtdb.

For the free support, then yeah, you can only hope for help ...

On Fri, Jan 3, 2014 at 12:53 PM, Stephan Burkard sburk...@gmail.com wrote:
 I know it is somehow the wrong place, but the HawtDB Google group seems to
 be dead (at least my posted question never appeared).

 Is there anybody who has written or commited to the hawtdb component of
 Camel I can ask?

 Thanks
 Stephan



 On Fri, Dec 20, 2013 at 10:51 AM, Stephan Burkard sburk...@gmail.comwrote:

 Hi Camel users

 I am trying to recover data from a Camel aggregator persistent hawtdb
 repository (Camel 2.9.x). The aggregator was killed unexpectedly because of
 an out-of-memory-error.

 I wrote a small Java class that opens the hawtdb file, creates a
 HawtDBAggregationRepository instance that uses the file and tried to get
 the index keys and aggregations from it.

 I was able to get almost all aggregations from it, only two of them throw
 the exception below when I try to access them. Can I access them in another
 way to recover the aggregated data?

 Thanks for any help
 Stephan



 WARN | HawtDBFile | Error executing work Getting key
 [7601003010220_XML400]. Will do rollback.
 org.fusesource.hawtdb.api.IndexException: java.io.EOFException
 at
 org.fusesource.hawtdb.api.AbstractStreamPagedAccessor.load(AbstractStreamPagedAccessor.java:66)
 at
 org.fusesource.hawtdb.internal.index.BTreeIndex.loadNode(BTreeIndex.java:238)
 at
 org.fusesource.hawtdb.internal.index.BTreeNode.getChild(BTreeNode.java:261)
 at
 org.fusesource.hawtdb.internal.index.BTreeNode.getLeafNode(BTreeNode.java:772)
 at
 org.fusesource.hawtdb.internal.index.BTreeNode.get(BTreeNode.java:652)
 at
 org.fusesource.hawtdb.internal.index.BTreeIndex.get(BTreeIndex.java:85)
 at
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository$2.execute(HawtDBAggregationRepository.java:150)
 at
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository$2.execute(HawtDBAggregationRepository.java:144)
 at
 org.apache.camel.component.hawtdb.HawtDBFile.doExecute(HawtDBFile.java:165)
 at
 org.apache.camel.component.hawtdb.HawtDBFile.execute(HawtDBFile.java:119)
 at
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository.get(HawtDBAggregationRepository.java:144)
 at
 ch.visana.ke.concierge.VisanaHawtDbRecovery.readExchangeByKeyFromRepository(VisanaHawtDbRecovery.java:81)
 at
 ch.visana.ke.concierge.VisanaHawtDbRecovery.testGetAggregationExchangeByKey(VisanaHawtDbRecovery.java:70)
 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
 at
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
 at
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at
 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at
 org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
 at
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
 at
 org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
 at
 org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at
 

Re: Message properties missing after Camel - rabbitmq routing

2014-01-03 Thread Willem.Jiang
The correlation_id and reply_to header are removed in 
removeHeaders pattern=rabbitmq.*/

You can find more information about the rabbitmq.* header here[1]

[1]https://github.com/apache/camel/blob/master/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConstants.java



--
View this message in context: 
http://camel.465427.n5.nabble.com/Message-properties-missing-after-Camel-rabbitmq-routing-tp5745254p5745491.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Asynchronous processing of routes

2014-01-03 Thread Henryk Konsek
Hi Yash,

Solution to your problem is probably easier than you think. Using
aggregator [1] EIP should solve your issue.

from(jms:Q1).bean(SomeProcessorBean.class).to(jms:Q2);
from(Q2).
  
aggregate().constant(true).completionPredicate(body().isEqualTo(M2)).groupExchanges().
  to(Q3);

Aggregation demonstrated below will collect all messages until it
receive M2 message. After M2 message is received, list of all messages
collected so far (including closing M3 message) will be send as single
exchange to Q3.

You probable would like to aggregate groups of messages according to
some correlation identifier [2]. I use constant(true) in the example
to collect all the messages to a single group, but normally you
correlate on header value or body contents.

Cheers.

[1] http://camel.apache.org/aggregator.html
[2] http://camel.apache.org/correlation-identifier.html

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Henryk Konsek
 There is also an ExchangeBuilder AFAIR that you may use as well. Then
 you can use that to create an exchange, to send with the produce
 template.

ExchangeBuilder is cool indeed, I forgot about it. :)

BTW Probably having bean mocking API similar to the one presented
below would be a nice addition to our testing API. However creating
such API is not as trivial as it might look like, because of the rich
bean binding capabilities that it should support.

@Bean // Spring Java config Example
MyBean myBean() {
  return MockBean.createMockBean(MyBean.class).
removeHeader(foo). // this mock will remove given header from exchange
addProperty(prop). // add property that couldn't be added before
assertHeader(bar).isEqualTo(baz); // and make some assertions
}

from(...).bean(myBean, myMethod).to(...);

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: Question about using message headers/Exchange properties and route testing

2014-01-03 Thread Stephan Burkard
Thank you very much Claus, great hints!

I found the ExchangeBuilder in Camel 2.11 and later, so it is not available
in my version, but I have to keep that in mind.

However, I found a CamelTestSupport.createExchangeWithBody() method that
seems to create an Exchange from my body object. Then I could add my
headers and properties and use the send-method that takes an Exchange. Or I
use the send-method that takes a processor as you also suggested.

Regards
Stephan


On Fri, Jan 3, 2014 at 1:40 PM, Henryk Konsek hekon...@gmail.com wrote:

  There is also an ExchangeBuilder AFAIR that you may use as well. Then
  you can use that to create an exchange, to send with the produce
  template.

 ExchangeBuilder is cool indeed, I forgot about it. :)

 BTW Probably having bean mocking API similar to the one presented
 below would be a nice addition to our testing API. However creating
 such API is not as trivial as it might look like, because of the rich
 bean binding capabilities that it should support.

 @Bean // Spring Java config Example
 MyBean myBean() {
   return MockBean.createMockBean(MyBean.class).
 removeHeader(foo). // this mock will remove given header from
 exchange
 addProperty(prop). // add property that couldn't be added before
 assertHeader(bar).isEqualTo(baz); // and make some assertions
 }

 from(...).bean(myBean, myMethod).to(...);

 --
 Henryk Konsek
 http://henryk-konsek.blogspot.com



Re: How to read aggregation from HawtDB when Camel cannot read it by index

2014-01-03 Thread Stephan Burkard
Thanks Claus

I will check if our subscription is eligible to get hawt-db-support.

It does not need to be a hammer. I guess a screwdriver would be sufficient
:-)

Regards
Stephan



On Fri, Jan 3, 2014 at 1:01 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 camel-hawtdb is deprecated as posted on
 http://camel.apache.org/hawtdb

 hawtdb is though an open source project so you can dive into the
 source code, and help that project. But as said hawtdb project is also
 considered deprecated, as its better to use the more stable and wide
 in use leveldb instead.

 If you are a Red Hat subscriber then you can get professional support
 on hawtdb as its shipped as part of JBoss Fuse, and thus you can use
 that as a hammer to get help. Also Red Hat employees the main
 developers on hawtdb.

 For the free support, then yeah, you can only hope for help ...

 On Fri, Jan 3, 2014 at 12:53 PM, Stephan Burkard sburk...@gmail.com
 wrote:
  I know it is somehow the wrong place, but the HawtDB Google group seems
 to
  be dead (at least my posted question never appeared).
 
  Is there anybody who has written or commited to the hawtdb component of
  Camel I can ask?
 
  Thanks
  Stephan
 
 
 
  On Fri, Dec 20, 2013 at 10:51 AM, Stephan Burkard sburk...@gmail.com
 wrote:
 
  Hi Camel users
 
  I am trying to recover data from a Camel aggregator persistent hawtdb
  repository (Camel 2.9.x). The aggregator was killed unexpectedly
 because of
  an out-of-memory-error.
 
  I wrote a small Java class that opens the hawtdb file, creates a
  HawtDBAggregationRepository instance that uses the file and tried to get
  the index keys and aggregations from it.
 
  I was able to get almost all aggregations from it, only two of them
 throw
  the exception below when I try to access them. Can I access them in
 another
  way to recover the aggregated data?
 
  Thanks for any help
  Stephan
 
 
 
  WARN | HawtDBFile | Error executing work Getting key
  [7601003010220_XML400]. Will do rollback.
  org.fusesource.hawtdb.api.IndexException: java.io.EOFException
  at
 
 org.fusesource.hawtdb.api.AbstractStreamPagedAccessor.load(AbstractStreamPagedAccessor.java:66)
  at
 
 org.fusesource.hawtdb.internal.index.BTreeIndex.loadNode(BTreeIndex.java:238)
  at
 
 org.fusesource.hawtdb.internal.index.BTreeNode.getChild(BTreeNode.java:261)
  at
 
 org.fusesource.hawtdb.internal.index.BTreeNode.getLeafNode(BTreeNode.java:772)
  at
  org.fusesource.hawtdb.internal.index.BTreeNode.get(BTreeNode.java:652)
  at
  org.fusesource.hawtdb.internal.index.BTreeIndex.get(BTreeIndex.java:85)
  at
 
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository$2.execute(HawtDBAggregationRepository.java:150)
  at
 
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository$2.execute(HawtDBAggregationRepository.java:144)
  at
 
 org.apache.camel.component.hawtdb.HawtDBFile.doExecute(HawtDBFile.java:165)
  at
 
 org.apache.camel.component.hawtdb.HawtDBFile.execute(HawtDBFile.java:119)
  at
 
 org.apache.camel.component.hawtdb.HawtDBAggregationRepository.get(HawtDBAggregationRepository.java:144)
  at
 
 ch.visana.ke.concierge.VisanaHawtDbRecovery.readExchangeByKeyFromRepository(VisanaHawtDbRecovery.java:81)
  at
 
 ch.visana.ke.concierge.VisanaHawtDbRecovery.testGetAggregationExchangeByKey(VisanaHawtDbRecovery.java:70)
  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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at
 
 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
  at
 
 org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at
 
 org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
  at
 
 org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
  at
 
 org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
  at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
  at
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
  at
 
 org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
  at
 
 org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
  at 

Re: Master Slave Camel-ActiveMQ

2014-01-03 Thread Bilgin Ibryam
I couldn't resist and summarized different ways for achieving master slave
configurations in a blog post here

http://www.ofbizian.com/2014/01/masterslave-failover-for-camel-routes.html

Cheers,




On 3 January 2014 02:17, Willem Jiang willem.ji...@gmail.com wrote:

 There is one shortcoming of the Zookeeper policy, the route is started
 before the route policy get a chance to stop the consumer.

 If you are using JBoss Fuse, you can try to camel master component[1], it
 just starts the master component at the first place.

 [1]
 https://access.redhat.com/site/documentation/en-US/JBoss_Fuse/6.0/html/EIP_Component_Reference/files/Master.html

 --
 Willem Jiang

 Red Hat, Inc.
 Web: 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 January 3, 2014 at 9:43:13 AM, Preethi (preethi.krishna...@gmail.com)
 wrote:
 
  I have been trying to use zookeeper but it looks like the camel
  route on the
  slave, which is subscribing to the IBM MQ,still runs. I could
  see the
  exception below when I start the slave.
 
  Cause: JMSWMQ0026: Failed to subscribe to topic '#/#/ITEM/MAINT'
  using
  MQSUB.; nested exception is com.ibm.mq.MQException: JMSCMQ0001:
  WebSphere MQ
  call failed with compcode '2' ('MQCC_FAILED') reason '2429'
  ('MQRC_SUBSCRIPTION_IN_USE').
 
  This means that the slave is connecting the IBM MQ even with the
  zookeeper
  route policy enabled. Is there a way I can have a single route running
  at a
  time among multiple similar routes?
 
 
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/Master-Slave-Camel-ActiveMQ-tp5745360p5745453.html
  Sent from the Camel - Users mailing list archive at Nabble.com.
 




-- 
Bilgin Ibryam

Apache Camel  Apache OFBiz committer
Blog: ofbizian.com
Twitter: @bibryam https://twitter.com/bibryam

Author of Instant Apache Camel Message Routing
http://www.amazon.com/dp/1783283475


Camel RemoteFilePollingConsumerPollStrategy and retry

2014-01-03 Thread geppo
Hi,
I'm extending the GenericFileConsumer and setting the Poll Strategy to
RemoteFilePollingConsumerPollStrategy. At the moment if there is an error
when the pollDirectory method is called the polling is executed again, and
again, and again,...

[WARN] RemoteFilePollingConsumerPollStrategy : Trying to recover by
disconnecting from remote server forcing a re-connect at next poll:
smb://domain\server...
[WARN] RemoteFilePollingConsumerPollStrategy : Consumer
Consumer[smb://domain\server...] caused by: null
java.lang.NullPointerException
at MyConsumer.pollDirectory(MyConsumer.java:31)
at
org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:81)
at
org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:133)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:88)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
...
What I want to happen is to just retry a set number of times and then give
up. I can implement my own logic on the MyConsumer class in the
pollDirectory method, but I was wondering if there is a nicer (i.e. standard
Camel) way to handle this.

For example I was thinking to throw a GenericFileOperationFailedException,
but then I don't know if the GenericFileConsumer does anything with it.
Any idea?



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


Streaming ResultSet Revisted

2014-01-03 Thread Christopher Gardner
Here:

http://camel.465427.n5.nabble.com/streaming-of-an-sql-resultset-td5547603.html

Claus recommends using ... a custom expression that returns an Iterator,
the the
splitter will use the iterator to read in a one row at a time.

I'm using groovy to do something like this.  Instead of a custom
expression, I'm using a processor.  The code does this:

1.  Processor creates a Query object.
2.  Processor passes a Closure to the Query object.
3.  Query object uses Spring's JDBCTemplate to execute the query.  It uses
passes the Closure to an implementation of Spring's ResultSetExtractor.
4.  ResultSetExtractor implementation constructs a ResultSet iterator with
the ResultSet and passes the iterator to the Closure.
5.  Closure calls the streaming/splitting route via a producer template.

I took this approach to ensure that the connection is automatically closed,
SQLExceptions are handled, etc.

If you used a custom expression, where would you clean up your JDBC
resources?


Re: ActiveMQ consumer remains after shutdown

2014-01-03 Thread Muhammad Ichsan
My question is: is it true that CachingConnectionFactory causes problem in
Camel OSGi environment?
On Jan 3, 2014 7:21 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 On Fri, Jan 3, 2014 at 1:18 PM, Muhammad Ichsan ich...@gmail.com wrote:
  I'm using org.springframework.jms.connection.CachingConnectionFactory
  instead of org.apache.activemq.pool.PooledConnectionFactory. Is that
  problem?
 

 If you are using blueprint, then yeah you need to call its start|stop
 method also - the method names may be destroy / init or whatever, so
 you need to check that out.

 If you use spring xml file, then spring automatic should call its
 start|stop methods.
 But in blueprint this does not happen.


  While using org.apache.activemq.pool.PooledConnectionFactory with
  proper start and stop (init-method=start destroy-method=stop), I
  have no problem.
 
  On Fri, Jan 3, 2014 at 6:32 PM, Claus Ibsen claus.ib...@gmail.com
 wrote:
  If you use a connection pool then make sure that this pool is also
  shutdown when you stop the bundle.
 
  eg usually that is to ensure the pool start|stop methods is invoked.
 
  See details at:
  http://camel.apache.org/activemq
 
  On Fri, Jan 3, 2014 at 12:07 PM, Muhammad Ichsan ich...@gmail.com
 wrote:
  I have routes defined in an OSGi bundle. The routes use activemq
  component to process data. To be exact, I have camel listen into 3
  different queue with concurrency = 10.
 
  As I started it in servicemix (apache-servicemix-4.4.0-fuse-00-27), I
  see in the Active MQ Web console that the queues are consumed as
  expected:
  - queue.a = 10 concurrent consumers
  - queue.b = 10 concurrent consumers
  - queue.c = 10 concurrent consumers
 
  Without doing any transaction, I stop the bundle. But strangely I have
  the following fact:
  - queue.a = 10 concurrent consumers
  - queue.b = 9 concurrent consumers
  - queue.c = 1 concurrent consumers
 
  where I expect all of them to be 0 concurrent consumers.
 
  This is a big problem, since when I start the bundle back, it creates
  more than 10 concurrent consumers for each queue. And my transaction
  can not run properly, because the old consumers (which remains),
  interfere the transaction messages.
 
  My question is, what's wrong here? Is a bug? Or I should do something
  to make it as expected?
 
  FYI, this is my ActiveMQ log level = INFO on Servicemix:
  http://pastebin.com/AcgQApDK
 
  Thanks
 
  --
  ~The best men are men who benefit to others
  http://www.michsan.web.id 一緒に勉強しましょう!
 
  Yang berkualitas memang beda rasanya!
  http://rizqi-cookies.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
  Make your Camel applications look hawt, try: http://hawt.io
 
 
 
  --
  ~The best men are men who benefit to others
  http://www.michsan.web.id 一緒に勉強しましょう!
 
  Yang berkualitas memang beda rasanya!
  http://rizqi-cookies.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
 Make your Camel applications look hawt, try: http://hawt.io



Re: Need for XA?

2014-01-03 Thread kraythe .
XA transactions are usually only needed if you have multisystem
transactions to be coordinated. So if you read from a JMS queue and because
of that store a message in a database then send a message on to another
queue, you want both the DB and the JMS to roll back if there is a 500
error calling a web site or something. For that you need XA. If you are
just going broker queue to queue tyou dont need XA.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Fri, Jan 3, 2014 at 3:33 AM, Henryk Konsek hekon...@gmail.com wrote:

 Hi Tom,

  In our application we have a lot of routes that follow the same pattern:
  read a message, do some processing, update/insert in the database and
 then
  send a message to the next route.
  (...)
  do we need XA transactions (...) ?

 That's right. You don't need XA to transactionally process your
 message flow. Plain local JMS transaction, ActiveMQ reredelivery
 mechanism and some Camel magic will be fine here. :)

 Just mark consumer endpoint as transactional [1] (as demonstrated on
 the snippet below) and ActiveMQ will handle the message redelivery for
 you.

 from uri=activemq:div.line/
 transacted/
 bean ref=divServiceActivator method=validateDivLine/

 Keep in mind that ActiveMQ broker will keep the message in div.line
 queue until the transaction will be committed by the Camel at the end
 of the route (after sending message to div.line.processed queue). If
 divServiceActivator will throw the exception during the DB update, the
 Camel will not commit and message incoming from div.line will be
 redelivered by the broker. You can control how many times message will
 be redelivered by the broker on the ActiveMQ configuration level [2].

 Now is the tricky part. Notice that it is still possible that Camel
 can fail to commit JMS transaction *after* successful DB update (power
 outages happen). That would mean that incoming message will be
 redelivered and processed twice. To handle this situation and keep
 your system state concise make divServiceActivator#persistDivVehicle()
 bean invocation idempotent [3], so it won't try to alter database
 twice. You can also try to make
 divServiceActivator#persistDivVehicle() operation idempotent on the
 business logic level (sometimes it is as trivial as checking if entity
 with given ID hasn't been persisted already).

 Cheers.

 [1] http://camel.apache.org/transactional-client.html
 [2] http://activemq.apache.org/message-redelivery-and-dlq-handling.html
 [3] http://camel.apache.org/idempotent-consumer.html

 --
 Henryk Konsek
 http://henryk-konsek.blogspot.com



Re: Message properties missing after Camel - rabbitmq routing

2014-01-03 Thread muthukumara...@gmail.com
Thanks Willem  Kraythe for your reply



--
View this message in context: 
http://camel.465427.n5.nabble.com/Message-properties-missing-after-Camel-rabbitmq-routing-tp5745254p5745507.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Using the x509HostnameVerifier option in http4

2014-01-03 Thread Christian Müller
Which version of Camel do you use?
Do you use multiple http endpoints?

Best,

Christian
-

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Thu, Jan 2, 2014 at 3:59 PM, Mohan mohann...@gmail.com wrote:

 Hi Xavier,

 I am kind of facing similar issue that you had faced earlier.
 I have added

 bean id=x509HostnameVerifier
 class=org.apache.http.conn.ssl.AllowAllHostnameVerifier /
 in my camel context
 and in the url, I have


 .to(https4://dummy?httpClient.soTimeout=6x509HostnameVerifier=x509HostnameVerifier);

 But even after that it kept on giving me exception for host name
 verification as it kept on using BrowserCompatHostnameVerifier

 Which also means that it did no honor the param in the URL or I did not
 give
 it correctly.

 Any pointers?

 regards,
 Mohan







 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Using-the-x509HostnameVerifier-option-in-http4-tp5131544p5745439.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Request for a project to upload for Rest Webservices

2014-01-03 Thread Christian Müller
Did you checked our examples [1]?
You can find the source code at [2].

[1] http://camel.apache.org/examples.html
[2]
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=tree;f=examples;h=7bcd07be46cce0eecc614a3438489b0c6478283a;hb=HEAD

Best,

Christian
-

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Fri, Jan 3, 2014 at 5:26 AM, maheshpvd mahesh...@gmail.com wrote:

 Hi,

 Can any one upload complete Rest webservice project It would be very
 helpful for me. as i'm starting to this.

 Thanks in advancve.



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Request-for-a-project-to-upload-for-Rest-Webservices-tp5745463.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Alternative to a Streaming ResultSet

2014-01-03 Thread Christopher Gardner
Can the SQL component be streamed without the whole result set brought into
memory?  What about the jdbc component?


Re: Need for XA?

2014-01-03 Thread Larry Meadors
Just to be clear here...if you're doing this:
 - get a message from JMS broker A
 - write to database
 - put a messages in a queue on JMS broker A

Should you or should you not need XA?
Larry


Can I write a route that reads an arbitrary database table and stores it in a file?

2014-01-03 Thread Lothar Werzinger
Hi,

I have the requirement to write a route that listens on a web service
endpoint and that is supposed to read a database table where the connection
information (host, port, ...) and the table name are passed in via the web
service call, convert the table data to JSON and write it to a file.

Is such a route possible? If yes, can you please point me in the right
direction?

Thanks in advance!
-- 

Lothar Werzinger

Principal Architect

Tradescape, Inc. - Enabling Efficient Digital Marketplaces

+1-650-931-6719 (direct)

+1-800-697-6068 (main) Ext. 116

lot...@tradescape.biz

http://www.tradescape.biz

-- 


This message and any attachment (the message) is intended solely for the 
addressees and is confidential. If you receive this message by mistake, 
please delete it and notify the sender immediately. Any use not 
in accordance with its purpose, any out-spread or disclosure, either as a 
whole or partially, is prohibited except with formal approval. Internet 
cannot guarantee the integrity of this message, therefore Tradescape will 
not be liable for the message if modified.

-


Re: Can I write a route that reads an arbitrary database table and stores it in a file?

2014-01-03 Thread James Carman
It's possible, but probably not advisable. :)

from(cxf:bean:foo).process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// Query the database and build up the
JSONifiable data structure here...
}
}).marshal(new JsonDataFormat()).to(file:foo);

On Fri, Jan 3, 2014 at 8:34 PM, Lothar Werzinger lot...@tradescape.biz wrote:
 Hi,

 I have the requirement to write a route that listens on a web service
 endpoint and that is supposed to read a database table where the connection
 information (host, port, ...) and the table name are passed in via the web
 service call, convert the table data to JSON and write it to a file.

 Is such a route possible? If yes, can you please point me in the right
 direction?

 Thanks in advance!
 --

 Lothar Werzinger

 Principal Architect

 Tradescape, Inc. - Enabling Efficient Digital Marketplaces

 +1-650-931-6719 (direct)

 +1-800-697-6068 (main) Ext. 116

 lot...@tradescape.biz

 http://www.tradescape.biz

 --


 This message and any attachment (the message) is intended solely for the
 addressees and is confidential. If you receive this message by mistake,
 please delete it and notify the sender immediately. Any use not
 in accordance with its purpose, any out-spread or disclosure, either as a
 whole or partially, is prohibited except with formal approval. Internet
 cannot guarantee the integrity of this message, therefore Tradescape will
 not be liable for the message if modified.

 -