Re: Camel + NMR + Karaf (OSGi) possible without ServiceMix?

2010-12-02 Thread klausb

Ok, I've got the NMR stuff loaded. But have still an unresolved dependency to
org.apache.servicemix.camel.nmr. Any idea, what the URI is for the
corresponding feature file. That is the one, which contains the camel-nmr
feature (if that exists).

Thanks,
klaus.
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-NMR-Karaf-OSGi-possible-without-ServiceMix-tp3287623p3289382.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Wast performance? Instrument Interceptor is wrapped twice for each processor.

2010-12-02 Thread Hadrian Zbarcea
The InstrumentationProcessor is a delegate processor (aka interceptor) that 
allows you do do before and after processing.
It is not really invoked twice (or I have to see a test case that does that, 
the unit tests in camel I am aware of don't). It is invoked once, takes a start 
timestamp, it delegates processing to the inner processor and then takes the 
time diff and records it.

Now with a DelegateProcessor all this call is synchronous. Being actually a 
DelegateAsyncProcessor, the call to the inner processor is done by the async 
engine (see AsyncProcessorHelper.process()) which calls asynchronously on the 
done() method. I assume this is what you see and interpret as a second call.

This design is not wasting performance, quite to the contrary. It ensures a 
better use of resources and scales much better with higher message volume.

I hope this helps,
Hadrian


On Dec 1, 2010, at 9:53 PM, ext2 wrote:

 Hi:
   Each camel processor will be wrapped with Instrument Interceptor
 twice.  So for each process , the Instrument interceptor will be executed
 twice.
It seems no use but waste performance; 
   Why? Or a bug?
 Thanks for any suggestion.
 
 
 



Re: Camel + NMR + Karaf (OSGi) possible without ServiceMix?

2010-12-02 Thread Jean-Baptiste Onofré
camel-nmr feature is provided by ServiceMix 4 (the main features 
subproject).


It's contained in the features descriptor available on, for example:
mvn:org.apache.servicemix/apache-servicemix/4.3.0-SNAPSHOT

This features descriptor provides camel-nmr, camel-activemq, 
examples-camel-osgi, examples-camel-nmr, examples-cxf-camel-nmr, etc 
around camel.


Regards
JB

On 12/02/2010 02:49 PM, klausb wrote:


Ok, I've got the NMR stuff loaded. But have still an unresolved dependency to
org.apache.servicemix.camel.nmr. Any idea, what the URI is for the
corresponding feature file. That is the one, which contains the camel-nmr
feature (if that exists).

Thanks,
klaus.


Re: Build a bean from a Master Detail flat file

2010-12-02 Thread Claus Ibsen
On Tue, Nov 30, 2010 at 4:50 PM, Marco Bettiol jamiro...@gmail.com wrote:
 I have one flat file with the following structure:

 
 //Order Headers
 header A
 header B
 ...
 --
 //OrderDetails
 detail A.1
 detail B.1
 detail B.2
 

 in other word I have a file where at the beginning I can find the orders
 headers and then the orders details.
 I successfully mapped the OrderHeader from flat file to a java bean using
 bindy.
 The problem I do not know how to solve is how to process the order header
 with its own details togheter to create 1 Order bean containing both
 header and associated details.


You can always do custom mapping from a Camel Processor or Java Bean.
If the flat file contains N+ orders in the  same file. You can spit
out new messages from the Java code using Producer Template.
Then you can send the order using the producer template to the
direct:order endpoint.


from(file)
   .process(new MyCustomProcessor();

from(direct:order)
   .to(log:order)
...



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Hor to route using objects

2010-12-02 Thread Claus Ibsen
On Thu, Dec 2, 2010 at 11:10 PM, nkrust saum.p...@gmail.com wrote:

 Hi,

 I'm trying to do a POC on Content Based Routing based on camel.
 From what ever literature that I've seen so far I only see routing happening
 from files, queues etc. But I've not seen any example where I can route
 based on a particular property of a ValueObject.

 Is it possible, if so how can it be implemented?

Yeah the Content Based Router can route based on any kind of Object.

in the when clause you just use a predicate which determines the
property on the ValueObject is equal to whatever you specify.
You can implement the predicate using Java code or use some fluent
builder or expression languages.

For example the Camel Simple is an expression language you can use as well

when(simple(${body.xxx} == 'foo)).to(log:foo)
This will invoke the XXX method on the method body and compare if its
equals to foo.
If XXX is a getter you can omit the get.


The Simple language can also be used with Spring XML when defining Camel routes

when
   simple   ... /simple
   to uri=log:foo/
/when

See more here
http://camel.apache.org/simple





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




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Hor to route using objects

2010-12-02 Thread nkrust

I was looking more for how the URI should be constructed.
from uri=xxx/
I'm looking to route to different servers based on the VO that will be
passed from a java class.

Thanks for responding Claude.


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


Re: Hor to route using objects

2010-12-02 Thread Claus Straube
You have to differ between consumers (from), producers (to) and the 
route semantic like a content based routing. For me it's not clear what 
you want to know. The from uris are depending on the consumer component 
you want to use (http://camel.apache.org/components.html) as well as the 
producers... Claus showed you how to build a content based router (that 
was your initial question) - if you  have questions about from() / to(), 
you should tell us what component you want to use (where come your 
messages from, where will they go?). What are the consumers on the 
different servers? Is it a Webservice, REST, Database, Mail, etc...


Best regards - Claus

On 02.12.2010 23:48, nkrust wrote:

I was looking more for how the URI should be constructed.
from uri=xxx/
I'm looking to route to different servers based on the VO that will be
passed from a java class.

Thanks for responding Claude.