Re: CommonJ ThreadPoolFactory interface question

2013-01-03 Thread Claus Ibsen
Hi Peter

Thanks for keeping us posted on your work on commonJ. Looking forward
to your contributions.
Maybe at some point the code can be in the Camel distro if you and
Preben want that?


On Wed, Jan 2, 2013 at 10:20 PM, Petter Nordlander
 wrote:
> Hi again,
>
> Sometimes when you write down a question, the answer comes by itself.
>
> I realised I didn't need to have those parameters to create commonJ threads 
> in Camel. I have ported camel-commonj to the new ThreadPoolFactory interface 
> and initial tests with WebSphere 7 works just fine. I have no complete test 
> suite heavy concurrency and interruptions etc. but will start look into that 
> as well.
>
> I am planning to submit a patch/branch to Prebens camel-commonj component for 
> the latest Camel version. I have the Factory made as a camel component built 
> and tested with maven. I believe more people can use this component. Even 
> though there is not a lot of code, it is somewhat tricky to graps all 
> concepts in both CommonJ, Java concurrency and the Camel interfaces.
>
> Sorry for submitting a question that turned out was no question at all.
>
> // Petter
> 
> Från: Petter Nordlander [petter.nordlan...@enfo.se]
> Skickat: den 1 januari 2013 21:49
> Till: users@camel.apache.org
> Ämne: CommonJ ThreadPoolFactory interface question
>
> Hi,
>
> I am trying to do something I have neglected for some time now. That is to 
> hook in a CommonJ (WebSphere AS) thread pool for core camel features (JMS and 
> Servlet stuff is working is just fine but I like to have the async. core 
> features in managed threads as well).
>
> So I actually read up a bit on this one. I've been fiddling around with Mr 
> Preben's tryout (https://github.com/pax95/camel-commonj) a bit. It looks 
> pretty good although there is some final touch needed.
>
> However, in the new versions of Camel, the interface has changed from 
> ExecutorServiceStrategy to ExecutorServiceManager, so camel-commonj has to be 
> "ported" to the new interface. When starting, I realised that large portions 
> of the code was shared with DefaultExecutorServiceStrategy (even though 
> Prebens class derives from the Deafult class, private declarations prevents 
> reuse to some extent). My approach is to try to do the implementation in the 
> newer ThreadPoolFactory interface rather than to rewrite the entire 
> ExecutorServiceManager interface. Actually, this is the documented approach.
>
> ThreadPoolFactory
> newCachedThreadPool(ThreadFactory threadFactory)
> newScheduledThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory)
> newThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory)
> Now to my question.
>
> The agrument to these methods I need to implement is a ThreadFactory which 
> essentially just have one method "Thread newThread(Runnable r)". A look in 
> the source reviels that what's actually passed is an instance of a 
> CamelThreadFactory configured with name, pattern and daemon flag.
>
> public CamelThreadFactory(String pattern, String name, boolean daemon)
>
> Those arguments is what I need to create the thread pool. I need to create 
> the thread name, but that is a later problem which is easier to solve). The 
> information is there, but not in any way reachable. If I could assume that 
> only CamelThreadFactory was passed in this case (which I can assume in the 
> current code base, at least), then in theory I could use some reflection 
> hacking to get the private parameters, but that does not at all feel good.
>
> So, has anyone actually used the ThreadPoolFactory to jack in Camel threads 
> into a Java EE thread pool/work manager before? Any hints how to come around 
> the above "limits"?
>
> Any help at all is appreciated.
>
> Best Regards
> Petter Nordlander
>
>
>
>
>
>



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


Re: Issue with use of SSLFilter with a custom codec

2013-01-03 Thread Claus Ibsen
Hi

What Camel version are you using?
And which Camel component are you referring to? Could it be camel-mina
? eg the Mina 1.x based component?
And how have you configured the Camel component/route?



On Thu, Jan 3, 2013 at 1:11 AM, James Gough  wrote:
> I am trying to use SSLFilter with a custom codec, but it appears that my
> client (for which I have called SSLFilter's "setUseClientMode" method with a
> setting of true), is calling SSLFilter prior to calling the codec, and it
> calls the decoder's decode method rather than the encoder's encode method,
> which is called when sslFilter is not used.
>
> It goes something like this:
>
> SSLFilter used:
> caller -> SSLFilter -> codec's decoder.decode() method -> service
>
> SSLFilter not used:
> caller -> codec's encoder.encode() method -> service
>
> The codec also is handed an encrypted message, which is useless since I have
> to do some stuff to it prior to sending it.
>
> Any hints?



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


Re: Issue with property values from files post 2.9.1 2.10.3 update

2013-01-03 Thread Claus Ibsen
Hi

Can you try using / as path separators?


On Wed, Jan 2, 2013 at 11:44 PM, demetrios
 wrote:
> Has anyone got a response to this.
> I know this functionality has changed from version 2.9.3.
> In the spring context everything works as expected but once you go into the
> camel context it will for some reason re parse the expected single backslash
> as an escape character.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Issue-with-property-values-from-files-post-2-9-1-2-10-3-update-tp5724758p5724806.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: How to avoid sending message headers with mail component ?

2013-01-03 Thread Claus Ibsen
On Tue, Jan 1, 2013 at 11:55 AM, JackMigger  wrote:
> Happy new year and thanks for the quick reply !
>
> But what happens in a (simplified) case like this:
>
> from("ibatis:selectUnprocessedAccounts?consumer.onConsume=consumeAccount")
>   // returns a list of beans with partly private information
>
>   .split( ... )
>   .removeHeaders("*")
>// set the message body from bean.text
>   ...
>   // set the headers to, cc, bcc from bean.email, bean.cc, etc...
>   ...
>.to("smtp://...)
>
>   // bcc header is also sent in the mail (?)
>
>   // message/bean is now consumed, but any reference to the sql
> consumeAccount statement (e.g. #id#)
>   // has gone
> .to("mock:results");
>
> As far as I understand, I have to filter out all but the further needed
> headers (as "id").
> Might there be a way to keep all camel message headers but configure that
> *only the body* is mailed ?

You can use the wire tap to spawn off a new message (sending a new exchange)
where you only copy the body.

See details at:
http://camel.apache.org/wire-tap.html

Something like
.wireTap("smtp:...", false, simple("${body}"))



> (I'm aware that I could always write my own processor)
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-avoid-sending-message-headers-with-mail-component-tp5724719p5724752.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: How to avoid sending message headers with mail component ?

2013-01-03 Thread Claus Ibsen
Hi

Oh another approach could be to use a custom header filter strategy on
the mail component / endpoint.
That will filter out all the headers, then only the body is being sent.



On Thu, Jan 3, 2013 at 9:27 AM, Claus Ibsen  wrote:
> On Tue, Jan 1, 2013 at 11:55 AM, JackMigger  wrote:
>> Happy new year and thanks for the quick reply !
>>
>> But what happens in a (simplified) case like this:
>>
>> from("ibatis:selectUnprocessedAccounts?consumer.onConsume=consumeAccount")
>>   // returns a list of beans with partly private information
>>
>>   .split( ... )
>>   .removeHeaders("*")
>>// set the message body from bean.text
>>   ...
>>   // set the headers to, cc, bcc from bean.email, bean.cc, etc...
>>   ...
>>.to("smtp://...)
>>
>>   // bcc header is also sent in the mail (?)
>>
>>   // message/bean is now consumed, but any reference to the sql
>> consumeAccount statement (e.g. #id#)
>>   // has gone
>> .to("mock:results");
>>
>> As far as I understand, I have to filter out all but the further needed
>> headers (as "id").
>> Might there be a way to keep all camel message headers but configure that
>> *only the body* is mailed ?
>
> You can use the wire tap to spawn off a new message (sending a new exchange)
> where you only copy the body.
>
> See details at:
> http://camel.apache.org/wire-tap.html
>
> Something like
> .wireTap("smtp:...", false, simple("${body}"))
>
>
>
>> (I'm aware that I could always write my own processor)
>>
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/How-to-avoid-sending-message-headers-with-mail-component-tp5724719p5724752.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cib...@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



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


Re: SV: CommonJ ThreadPoolFactory interface question

2013-01-03 Thread Preben.Asmussen
Hi Petter

Your contribution is most welcome. There is actually a open ticket for a new
component at https://issues.apache.org/jira/browse/CAMEL-3957

I have tested the component on Weblogic 10, but was not convinced that
workmanagers in WLS actually got released properly even though the code
should tell the workmanager to release. So further testing on WLS should be
done. Hope it works better on WAS :-)
ATM we are using Camels threadPools out of the box on WLS, and are running a
lot of Camel routes on  domains without any issues. 

Cheers
Preben



--
View this message in context: 
http://camel.465427.n5.nabble.com/CommonJ-ThreadPoolFactory-interface-question-tp5724754p5724821.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Fork/join with resequencing

2013-01-03 Thread Vincent Lombart
Hello,

Does anybody have an idea about what could sometimes cause a
NullPointerException in Camel code in the second route (all my messages are
built with the "seqnum" header)?

Vincent Lombart wrote
>   from("seda:fork?concurrentConsumers=" + 
> CONCURRENCY).process(
>   myProcessor).to("seda:join");
>   from("seda:join").resequence(header("seqnum")).stream()
>   
> .capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");

Here is the exception:
01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN 
o.a.c.processor.StreamResequencer - Caused by:
[java.lang.NullPointerException - null]
java.lang.NullPointerException: null
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
~[camel-core-2.10.3.jar:2.10.3]
at
org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
~[camel-core-2.10.3.jar:2.10.3] 

Best regards
Vincent



--
View this message in context: 
http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Need Suggestion regarding the Camel

2013-01-03 Thread prashanth141443
Hi all,
I am a newbie to camel after referring books i got a bit of knowledge of
camel.

I am in need of requirement where i will getting the requests through tcp
which i ll manipulating.

Now my question is that which is advantageous to use either Socket or Rmi.

As per my analysis socket programming is the best option for me. Need some
suggestions on this pls.

Thanks



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


Referencing constants in a (spring) route definition

2013-01-03 Thread fab
Hello all, 

I'm using spring to define camel routes and was wondering if it is possilbe
to reference constants in a java class as the endpoint name, something like



The // part is standard Spring syntax where /util/ points
to the namespace
http://www.springframework.org/schema/util/spring-util-3.1.xsd. 

Thanks, 

Fabio



--
View this message in context: 
http://camel.465427.n5.nabble.com/Referencing-constants-in-a-spring-route-definition-tp5724830.html
Sent from the Camel - Users mailing list archive at Nabble.com.


SV: Need Suggestion regarding the Camel

2013-01-03 Thread Petter Nordlander
Hi,
RMI and Sockets are very different level and for different purposes. If you 
want to expose and invoke java services over a network, RMI could be an option. 
Sockets are more low level. Although the Apache Mina implementation in Camel is 
actually really good at dealing with TCP streams 
(http://camel.apache.org/mina.html).

There are a lot of protocols and communication methods implemented in Camel:
http://camel.apache.org/components.html

Each of them have pros and cons, so it's very much up to what type of problem 
you are trying to solve.
Can you specify a bit more how your scenario looks like?

Best Regards
Petter Nordlander

Från: prashanth141443 [pprashant...@gmail.com]
Skickat: den 3 januari 2013 12:13
Till: users@camel.apache.org
Ämne: Need Suggestion regarding the Camel

Hi all,
I am a newbie to camel after referring books i got a bit of knowledge of
camel.

I am in need of requirement where i will getting the requests through tcp
which i ll manipulating.

Now my question is that which is advantageous to use either Socket or Rmi.

As per my analysis socket programming is the best option for me. Need some
suggestions on this pls.

Thanks



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


WebSphere MQ Reply

2013-01-03 Thread prueegg
I have a problem with Request/Reply over WebSphere MQ.

Sitation is that the Request is comming from WMQ and has to go back to WMQ.
Everything works fine, the message is handeld correctly as InOut, the reply
is prepared but not sent to WMQ even if there is no exception or any hint
for that in the trace.

It works with ActiveMQ instead of WMQ.

What I've found out is that the header JMSReplyTo in the case of WMQ has the
following pattern*:
queue://[QueueManagerName]/[QueueName]?targetClient=1

It seems that the endpoint cannot cope with the QueueManagerName in the URI.

I already have a WMQ specific DestinationResolver in place. I've also found
out that the overriden method
/public Destination resolveDestinationName(Session session, String
destinationName, boolean isPubSubDomain)/ 
was never called for the ReplyDestination. 

Do you have any idea? 

Patrick


* The mapping to the URI pattern with QueueManagerName works designed by
IBM:
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=%2Fcom.ibm.mq.csqzaw.doc%2Fjm25500_.htm
 



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


Problem with multiple coma separated endpoints defined in the same URI

2013-01-03 Thread PLANAMENTE Michael EXT-OD

Hi all,

I've experienced a strange behavior when I declared multiple endpoints in the 
same URI. (All endpoints are coma separated.)
See below for explanations...

Using this java code:
From(inEndpoint).to(outEndpoint);
I'd like to send messages to all endpoints defined in outEndpoint (like a 
pipeline)

With, in config file:
inEndpointURI =activamq:queue:xyz (the problem is not here)
outEndpointURI = activemq:queue:blah,file://path  (the problem is here!)

with, in spring file:
camel context declaring the outEndpoint's URI attribute pointing to 
outEndpointURI.(nothing special here)

In java file:
@EndpointInject("outEndpoint")
Endpoint outEndpoint;

From(inEndpoint).to(outEndpoint);


The strange behaviour:
The endpoint detects there are 2(in this case) different endpoints BUT consider 
all declared subsequent endpoints as being of the first(in this case activemq) 
endpoint's type! In other words, the file is considered as an activemq queue 
and I have a queue named  "file://path" in the amq broker!


Camel version: Camel 2.8.0


Any idea?


Many thanks,
Michael Planamente



Atos Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg
- 1130 Brussels - Belgium
RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872
Bankrekening-Compte Bancaire-Bank Account 310-0269424-44
BIC BBRUBEBB - IBAN BE55 3100 2694 2444

"The information contained in this e-mail and any attachment thereto is 
confidential and may contain information which is protected by intellectual 
property rights.
This information is intended for the exclusive use of the recipient(s) named 
above.
This e-mail does not constitute any binding relationship or offer toward any of 
the addressees.
If you are not one of the addressees , one of their employees or a proxy holder 
entitled to hand over this message to the addressee(s), any use of the 
information contained herein (e.g. reproduction, divulgation, communication or 
distribution,...) is prohibited.
If you have received this message in error, please notify the sender and 
destroy it immediately after.
The integrity and security of this message cannot be guaranteed and it may be 
subject to data corruption, interception and unauthorized amendment, for which 
we accept no liability."


Problem with multiple coma separated endpoints defined in the same URI

2013-01-03 Thread PLANAMENTE Michael EXT-OD
Hi all,

I've experienced a strange behavior when I declared multiple endpoints in the 
same URI. (All endpoints are coma separated.)
See below for explanations...

Using this java code:
From(inEndpoint).to(outEndpoint);
I'd like to send messages to all endpoints defined in outEndpoint (like a 
pipeline)

With, in config file:
inEndpointURI =activamq:queue:xyz (the problem is not here)
outEndpointURI = activemq:queue:blah,file://path  (the problem is here!)

with, in spring file:
camel context declaring the outEndpoint's URI attribute pointing to 
outEndpointURI.(nothing special here)

In java file:
@EndpointInject("outEndpoint")
Endpoint outEndpoint;

From(inEndpoint).to(outEndpoint);


The strange behaviour:
The endpoint detects there are 2(in this case) different endpoints BUT consider 
all declared subsequent endpoints as being of the first(in this case activemq) 
endpoint's type! In other words, the file is considered as an activemq queue 
and I have a queue named  "file://path" in the amq broker!


Camel version: Camel 2.8.0


Any idea?


Many thanks,
Michael Planamente



Atos Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg
- 1130 Brussels - Belgium
RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872
Bankrekening-Compte Bancaire-Bank Account 310-0269424-44
BIC BBRUBEBB - IBAN BE55 3100 2694 2444

"The information contained in this e-mail and any attachment thereto is 
confidential and may contain information which is protected by intellectual 
property rights.
This information is intended for the exclusive use of the recipient(s) named 
above.
This e-mail does not constitute any binding relationship or offer toward any of 
the addressees.
If you are not one of the addressees , one of their employees or a proxy holder 
entitled to hand over this message to the addressee(s), any use of the 
information contained herein (e.g. reproduction, divulgation, communication or 
distribution,...) is prohibited.
If you have received this message in error, please notify the sender and 
destroy it immediately after.
The integrity and security of this message cannot be guaranteed and it may be 
subject to data corruption, interception and unauthorized amendment, for which 
we accept no liability."


Re: Read web service msg and encrypt some data

2013-01-03 Thread jipchix
I forgot to say that after encrypting 1 field of the message, I'll forward
the modified message to another queue.

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Read-web-service-msg-and-encrypt-some-data-tp5724807p5724838.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Read web service msg and encrypt some data

2013-01-03 Thread Willem jiang
How did you access the PAYLOAD message in your manipulator bean?
I think it should be easy to do some transformation there.


--  
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 Thursday, January 3, 2013 at 11:31 PM, jipchix wrote:

> I forgot to say that after encrypting 1 field of the message, I'll forward
> the modified message to another queue.
>  
> Thanks
>  
>  
>  
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Read-web-service-msg-and-encrypt-some-data-tp5724807p5724838.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).





Re: Fork/join with resequencing

2013-01-03 Thread Taariq Levack
Hi Vincent

I reproduced your error with your code in Camel 2.9 and 2.10, and maybe
you've found a bug.
At first I thought it's your sleep calculations but even so we shouldn't
throw a null pointer.

Please file a JIRA so I can attach a patch and you can see if it works for
you too, but with the change I don't get this error. Or apply it and try a
build.
I'm not sure if I'll have time soon to dig further into why this is, but if
so I'll take a few stabs at it, and maybe somebody else already knows why
and has a better solution.

The change is in RouteContextProcessor, line 42, replace it with this so
the unit of work isn't yanked out from underneath it, for some reason it's
set to null and I only see valid reasons so far, though with concurrency it
might not be valid at a certain time or context.

final UnitOfWork unitOfWork = exchange.getUnitOfWork();
if (unitOfWork != null) {
unitOfWork.pushRouteContext(routeContext);
}

Taariq



On Thu, Jan 3, 2013 at 12:09 PM, Vincent Lombart  wrote:

> Hello,
>
> Does anybody have an idea about what could sometimes cause a
> NullPointerException in Camel code in the second route (all my messages are
> built with the "seqnum" header)?
>
> Vincent Lombart wrote
> >   from("seda:fork?concurrentConsumers=" +
> CONCURRENCY).process(
> >   myProcessor).to("seda:join");
> >
> from("seda:join").resequence(header("seqnum")).stream()
> >
> .capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");
>
> Here is the exception:
> 01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN
> o.a.c.processor.StreamResequencer - Caused by:
> [java.lang.NullPointerException - null]
> java.lang.NullPointerException: null
> at
>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
>
> org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
> ~[camel-core-2.10.3.jar:2.10.3]
>
> Best regards
> Vincent
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: WebSpherePackageScanClassResolver.isWebSphereClassLoader(WebSpherePackageScanClassResolver.java:46)

2013-01-03 Thread superduperguy
I am a newbie to Camel and facing the same issue. Did you find the resolution
to this issue? I am using Camel 2.10.2 version in Jboss-5.1.1


[31-12 00:53:35:471] ERROR
[org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error
installing to Start: name=iSeries.PayrollNotification:
service=Listener,name=PayrollNotificationPublisher2 state=Create mode=Manual
requiredState=Installed
java.lang.NullPointerException
at
org.apache.camel.impl.WebSpherePackageScanClassResolver.isWebSphereClassLoader(WebSpherePackageScanClassResolver.java:46)
at
org.apache.camel.impl.DefaultCamelContext.(DefaultCamelContext.java:218)
at
com.adp.sbs.dsa.notification.publish.PayrollNotificationPublisher2.setCamelContext(PayrollNotificationPublisher2.java:52)



--
View this message in context: 
http://camel.465427.n5.nabble.com/WebSpherePackageScanClassResolver-isWebSphereClassLoader-WebSpherePackageScanClassResolver-java-46-tp4267695p5724843.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: WebSpherePackageScanClassResolver.isWebSphereClassLoader(WebSpherePackageScanClassResolver.java:46)

2013-01-03 Thread Claus Ibsen
Hi

See this FAQ about using JBoss
http://camel.apache.org/how-do-i-run-activemq-and-camel-in-jboss.html



On Thu, Jan 3, 2013 at 5:31 PM, superduperguy  wrote:
> I am a newbie to Camel and facing the same issue. Did you find the resolution
> to this issue? I am using Camel 2.10.2 version in Jboss-5.1.1
>
>
> [31-12 00:53:35:471] ERROR
> [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error
> installing to Start: name=iSeries.PayrollNotification:
> service=Listener,name=PayrollNotificationPublisher2 state=Create mode=Manual
> requiredState=Installed
> java.lang.NullPointerException
> at
> org.apache.camel.impl.WebSpherePackageScanClassResolver.isWebSphereClassLoader(WebSpherePackageScanClassResolver.java:46)
> at
> org.apache.camel.impl.DefaultCamelContext.(DefaultCamelContext.java:218)
> at
> com.adp.sbs.dsa.notification.publish.PayrollNotificationPublisher2.setCamelContext(PayrollNotificationPublisher2.java:52)
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/WebSpherePackageScanClassResolver-isWebSphereClassLoader-WebSpherePackageScanClassResolver-java-46-tp4267695p5724843.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Unable to consume syslog messages

2013-01-03 Thread sscott
I'm attempting to use camel-syslog as detailed at
http://camel.apache.org/syslog.html to consume syslog messages. I'm using
Camel 2.10.2, Oracle JDK 1.6.0_31 64-Bit on CentOS 6.2.

I set up a simple test using Netty:

val ctx = new DefaultCamelContext

val dataFormat = new Rfc3164SyslogDataFormat

ctx.addRoutes(new RouteBuilder() {
def configure() {
   
from("netty:udp://localhost:5140?sync=false&allowDefaultCodec=false")
.setExchangePattern(ExchangePattern.InOnly)
.unmarshal(dataFormat)
.bean(classOf[SyslogBean])
}
})
ctx.start()

(SyslogBean has a single method that accepts a
o.a.c.component.syslog.SyslogMessage and logs it).

I set up rsyslogd to forward *.* to localhost:5140.  Every log message
causes Camel to output an InvalidPayloadException caused by a
NoTypeConversionAvailableException with the detail "No type converter
available to convert from type:
org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type:
java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=105,
cap=105)"

When I change the from() to be "mina:", with or without the sync=false and
allowDefaultCodec=false options, and change the maven dependencies to
camel-mina from camel-netty, the same exceptions are thrown with the detail
"No body available of type: java.io.InputStream on: Message: [Body is null].
Caused by: No type converter available to convert from type: null to the
required type: java.io.InputStream with value null."

This probably is more of a netty/mina question than a syslog dataformat
question, any help is appreciated



--
View this message in context: 
http://camel.465427.n5.nabble.com/Unable-to-consume-syslog-messages-tp5724850.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Fork/join with resequencing

2013-01-03 Thread Taariq Levack
For completion, that snippet wasn't complete but it you apply the change you'll 
see to also use that unitOfWork reference throughout the method, otherwise the 
null pointer will likely only be delayed.
I'll run the camel-core tests tomorrow but your code worked consistently.

Taariq

On 03 Jan 2013, at 18:04, Taariq Levack  wrote:

> Hi Vincent
> 
> I reproduced your error with your code in Camel 2.9 and 2.10, and maybe 
> you've found a bug. 
> At first I thought it's your sleep calculations but even so we shouldn't 
> throw a null pointer.
> 
> Please file a JIRA so I can attach a patch and you can see if it works for 
> you too, but with the change I don't get this error. Or apply it and try a 
> build. 
> I'm not sure if I'll have time soon to dig further into why this is, but if 
> so I'll take a few stabs at it, and maybe somebody else already knows why and 
> has a better solution.
> 
> The change is in RouteContextProcessor, line 42, replace it with this so the 
> unit of work isn't yanked out from underneath it, for some reason it's set to 
> null and I only see valid reasons so far, though with concurrency it might 
> not be valid at a certain time or context.
> 
> final UnitOfWork unitOfWork = exchange.getUnitOfWork();
> if (unitOfWork != null) {
> unitOfWork.pushRouteContext(routeContext);
> }
> 
> Taariq
> 
> 
> 
> On Thu, Jan 3, 2013 at 12:09 PM, Vincent Lombart  wrote:
> Hello,
> 
> Does anybody have an idea about what could sometimes cause a
> NullPointerException in Camel code in the second route (all my messages are
> built with the "seqnum" header)?
> 
> Vincent Lombart wrote
> >   from("seda:fork?concurrentConsumers=" + 
> > CONCURRENCY).process(
> >   myProcessor).to("seda:join");
> >   
> > from("seda:join").resequence(header("seqnum")).stream()
> >   
> > .capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");
> 
> Here is the exception:
> 01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN
> o.a.c.processor.StreamResequencer - Caused by:
> [java.lang.NullPointerException - null]
> java.lang.NullPointerException: null
> at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
> ~[camel-core-2.10.3.jar:2.10.3]
> at
> org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
> ~[camel-core-2.10.3.jar:2.10.3]
> 
> Best regards
> Vincent
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 


Re: Apache Karaf and camel-fop

2013-01-03 Thread Maruan Sahyoun
as a quick update - using the latest ServiceMix Bundles I was able to 
successfully use camel and camel-fop within Karaf. 

Thanks for fixing the SMX bundles and making that possible.

Maruan

Am 15.09.2012 um 08:55 schrieb Maruan Sahyoun :

> Hi Claus, 
> 
> thanks for your reply and your input. I'll try to come up with a solution, 
> maybe a quick workaround to start with, and post my findings.
> 
> Maruan Sahyoun
> 
> Am 15.09.2012 um 08:32 schrieb Claus Ibsen :
> 
>> On Fri, Sep 14, 2012 at 9:41 AM, Maruan Sahyoun  
>> wrote:
>>> I should have mentioned that I did as you suggested using features:install 
>>> for camel and camel-fop (as well as camel-blueprint etc.)
>>> 
>> 
>> Yeah I am not sure what to do than other than digging into it, there
>> may be some of the OSGi bundles that needs to have their MANIFEST.MF
>> files tweaked to get them working properly.
>> 
>> But also the FOP library itself may do some class-loading tricks that
>> don't work well with OSGi. And then its often harder to get working.
>> 
>> Another approach that people have done is to put together an uber JAR
>> with all the smaller JARs and then deploy that (for example with wrap)
>> then that seems to work. Although that goes against the idea of OSGi
>> modularity and bundles a bit.
>> 
>> And possibly there may be FAB which could make it work. For example
>> people using Hibernate get this working much easier with FAB;
>> Hibernate being one of the toughest piece to get working with OSGi.
>> http://www.davsclaus.com/2012/08/osgi-deployment-made-easy-with-fab.html
>> 
>> At the Apache communities we love help and contributions, so if you
>> got the need and time for FOP, then we would love help with getting
>> the camel-fop feature to run out of the box in the Apache products.
>> 
>>> 
>>> 
>>> Am 14.09.2012 um 09:36 schrieb Claus Ibsen:
>>> 
 Hi
 
 If you use Karaf / SMX then there is a camel-fop feature you can use
 to install. That is the recommended approach for installing Camel
 components.
 
 features:install camel
 features:install camel-fop
 
 Though the camel-fop feature may not yet 100% work. As you say below,
 classloading from non-OSGi friendly JARs is not easy to get working
 seamless with OSGi.
 
 
 On Fri, Sep 14, 2012 at 9:32 AM, Maruan Sahyoun  
 wrote:
> I installed the dependencies via osgi:install from that repository which 
> enabled the Camel route to deploy (defined via Blueprint xml). But when I 
> tried to submit data I got the error
> 
> java.lang.UnsupportedOperationException: Don't know how to handle 
> "application/pdf" as an output format. Neither an FOEventHandler, nor a 
> Renderer could be found for this output format.
>  at 
> org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:361)[72:org.apache.servicemix.bundles.fop:1.0.0.2]
> 
> So I think it doesn't find the Renderers. As far as I understand the 
> mechanism fop is using for getting it's renderers it depends on Java 
> class loading.
> 
> Maruan
> 
> 
> Am 14.09.2012 um 09:24 schrieb Claus Ibsen:
> 
>> On Fri, Sep 14, 2012 at 9:19 AM, Maruan Sahyoun  
>> wrote:
>>> OK - some further testing shows that camel-fop works fine if you run 
>>> camel standalone. So the issue is when running inside an OSGI 
>>> container. I'll do some more investigation. Is there someone around 
>>> using camel-fop inside Karaf or ServiceMix? Any hints?
>>> 
>>> Thanks for all the help so far. I'm very glad that I found Camel - nice 
>>> piece of software and very helpful community.
>>> 
>> 
>> I think some of the FOP JARs and its dependencies is being created as
>> OSGi wrapped bundles, which will get published to the maven repo at
>> http://repo2.maven.org/maven2/org/apache/servicemix/bundles/
>> 
>> 
>> 
>>> Maruan Sahyoun
>>> 
>>> 
>>> Am 10.09.2012 um 13:12 schrieb Charles Moulliard:
>>> 
 Hi,
 
 Have you deployed the bundle of Apache XMLGraphics ?
 
 Regards,
 
 Charles
 
 On Mon, Sep 10, 2012 at 10:38 AM, Maruan Sahyoun 
 wrote:
 
> Hi,
> 
> I'm trying to use camel-fop from within Apache Karaf. But I'm getting 
> an
> error message about a missing class
> Caused by: java.lang.NoClassDefFoundError:
> org/apache/xmlgraphics/image/loader/ImageContext
> 
> Apache Karaf is 2.29
> Apache Camel is 2.10.0 (I also tried 2.10.1)
> 
> features installed are camel-core, camel-blueprint, camel-fop
> 
> Did anyone experience the same issue?
> 
> Thanks for your help
> 
> Maureen
> 
> 
 
 
 --
 Charles Moulliard
 Apache Committer / S

Re: Issue with use of SSLFilter with a custom codec

2013-01-03 Thread James Gough
I'm using Camel 2.9.0 with the Mina 1.x component with the 
mina-filter-ssl component imported.  I am using the Grails routing 
plugin's sendMessage method to the following URL:


 
"mina:tcp://${hostname}:${port}?sync=false&minaLogger=true&codec=#mycodec&filters=#sslClientFilter"

The SSLFilter is set up using Spring DSL, the only settings I set for 
the filter is to pass a valid SSLContext to it's constructor and setting 
the clientMode to true:


  "sslContextGenerator(com.mypackage.mina.SSLContextGenerator) {
keyStorePassword = '${keyStorePassword}'
trustStorePassword = '${trustStorePassword}'
keyStorePath = '${keyStorePath}'
trustStorePath = '${trustStorePath}'
  }

  sslContext(sslContextGenerator: "getSSLContext")

  sslClientFilter(org.apache.mina.filter.SSLFilter, sslContext) {
useClientMode = true
  }"

I have verified that the SSLFilter instance does have the "client" 
parameter set to true.


I'm stumped.  It just seems like when the SSLFilter is engaged it's 
behavior is entirely different.


Jim


On 1/3/13 12:01 AM, Claus Ibsen wrote:

Hi

What Camel version are you using?
And which Camel component are you referring to? Could it be camel-mina
? eg the Mina 1.x based component?
And how have you configured the Camel component/route?



On Thu, Jan 3, 2013 at 1:11 AM, James Gough  wrote:

I am trying to use SSLFilter with a custom codec, but it appears that my
client (for which I have called SSLFilter's "setUseClientMode" method with a
setting of true), is calling SSLFilter prior to calling the codec, and it
calls the decoder's decode method rather than the encoder's encode method,
which is called when sslFilter is not used.

It goes something like this:

SSLFilter used:
caller -> SSLFilter -> codec's decoder.decode() method -> service

SSLFilter not used:
caller -> codec's encoder.encode() method -> service

The codec also is handed an encrypted message, which is useless since I have
to do some stuff to it prior to sending it.

Any hints?







Re: Fork/join with resequencing

2013-01-03 Thread Vincent Lombart
Hello Taariq,

Thank you for taking the time to look into my problem. As suggested I have
opened the Jira  CAMEL-5925
   to let you attach a
patch.

Best regards
Vincent


Taariq Levack wrote
> For completion, that snippet wasn't complete but it you apply the change
> you'll see to also use that unitOfWork reference throughout the method,
> otherwise the null pointer will likely only be delayed.
> I'll run the camel-core tests tomorrow but your code worked consistently.
> 
> Taariq
> 
> On 03 Jan 2013, at 18:04, Taariq Levack <

> taariql@

> > wrote:
> 
>> Hi Vincent
>> 
>> I reproduced your error with your code in Camel 2.9 and 2.10, and maybe
>> you've found a bug. 
>> At first I thought it's your sleep calculations but even so we shouldn't
>> throw a null pointer.
>> 
>> Please file a JIRA so I can attach a patch and you can see if it works
>> for you too, but with the change I don't get this error. Or apply it and
>> try a build. 
>> I'm not sure if I'll have time soon to dig further into why this is, but
>> if so I'll take a few stabs at it, and maybe somebody else already knows
>> why and has a better solution.
>> 
>> The change is in RouteContextProcessor, line 42, replace it with this so
>> the unit of work isn't yanked out from underneath it, for some reason
>> it's set to null and I only see valid reasons so far, though with
>> concurrency it might not be valid at a certain time or context.
>> 
>> final UnitOfWork unitOfWork = exchange.getUnitOfWork();
>> if (unitOfWork != null) {
>> unitOfWork.pushRouteContext(routeContext);
>> }
>> 
>> Taariq
>> 
>> 
>> 
>> On Thu, Jan 3, 2013 at 12:09 PM, Vincent Lombart <

> apache@

> > wrote:
>> Hello,
>> 
>> Does anybody have an idea about what could sometimes cause a
>> NullPointerException in Camel code in the second route (all my messages
>> are
>> built with the "seqnum" header)?
>> 
>> Vincent Lombart wrote
>> >   from("seda:fork?concurrentConsumers=" +
>> CONCURRENCY).process(
>> >   myProcessor).to("seda:join");
>> >  
>> from("seda:join").resequence(header("seqnum")).stream()
>> >  
>> .capacity(CAPACITY).timeout(TIMEOUT).to("mock:result");
>> 
>> Here is the exception:
>> 01:35:49.719 [Camel (camel-1) thread #0 - Resequencer Delivery] WARN
>> o.a.c.processor.StreamResequencer - Caused by:
>> [java.lang.NullPointerException - null]
>> java.lang.NullPointerException: null
>> at
>> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:42)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:290)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:185)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.StreamResequencer.sendElement(StreamResequencer.java:65)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.resequencer.ResequencerEngine.deliverNext(ResequencerEngine.java:261)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.resequencer.ResequencerEngine.deliver(ResequencerEngine.java:225)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> at
>> org.apache.camel.processor.StreamResequencer$Delivery.run(StreamResequencer.java:242)
>> ~[camel-core-2.10.3.jar:2.10.3]
>> 
>> Best regards
>> Vincent
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724823.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>





--
View this message in context: 
http://camel.465427.n5.nabble.com/Fork-join-with-resequencing-tp5724727p5724856.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Read web service msg and encrypt some data

2013-01-03 Thread jipchix
I have a POJO that was generated using wsdl2java - let's call this Person
class. This class was generated 

Then in my Manipulator class, I have an input parameter - (String xml).  I
write this 'xml' to the log and see that it contains some header and the
message body.  In the Manipulator class then I attempt to instantiate
"Person" thinking somehow it would magically contains fields parsed out from
my XML.  There is no link between them I can see.  Here are the snippets
from the 2 classes:
// MyManipulator.java file
public class MyManipulator {

   @Converter
   public Person Manipulator (String xml) {
   
   Person p = new Person();
 ...  encryptme(p.ssn);
 }
}

//Person.java file
...

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"emplID",
"firstName",
"lastName",
"empType",
"empClass",
"ssn",
"location"
})
@XmlRootElement(name = "Person")
public class Person {

@XmlElement(required = true)
protected String emplID;
@XmlElement(required = true)
protected String firstName;
@XmlElement(required = true)
protected String lastName;
@XmlElement(required = true)
protected String empType;
@XmlElement(required = true)
protected String empClass;
@XmlElement(required = true)
protected String ssn;
   ...
public String getEmplID() {
return emplID;
}
 // Other getters & setters
..


As mentioned: I could see the message and header in 'xml' var.  However, if
I try to output p.ssn, p.empID, etc., they all showed null.  So I have
message in the 'xml' but I can't get it mapped to "Person" object to
manipulate ssn.

Thanks

 




--
View this message in context: 
http://camel.465427.n5.nabble.com/Read-web-service-msg-and-encrypt-some-data-tp5724807p5724857.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Karaf and camel-fop

2013-01-03 Thread Babak Vahdat


Am 03.01.2013 um 18:41 schrieb Maruan Sahyoun :

> as a quick update - using the latest ServiceMix Bundles I was able to 
> successfully use camel and camel-fop within Karaf. 
> 

Hi

Thanks for the update.

Babak

> Thanks for fixing the SMX bundles and making that possible.
> 
> Maruan
> 
> Am 15.09.2012 um 08:55 schrieb Maruan Sahyoun :
> 
>> Hi Claus, 
>> 
>> thanks for your reply and your input. I'll try to come up with a solution, 
>> maybe a quick workaround to start with, and post my findings.
>> 
>> Maruan Sahyoun
>> 
>> Am 15.09.2012 um 08:32 schrieb Claus Ibsen :
>> 
>>> On Fri, Sep 14, 2012 at 9:41 AM, Maruan Sahyoun  
>>> wrote:
 I should have mentioned that I did as you suggested using features:install 
 for camel and camel-fop (as well as camel-blueprint etc.)
>>> 
>>> Yeah I am not sure what to do than other than digging into it, there
>>> may be some of the OSGi bundles that needs to have their MANIFEST.MF
>>> files tweaked to get them working properly.
>>> 
>>> But also the FOP library itself may do some class-loading tricks that
>>> don't work well with OSGi. And then its often harder to get working.
>>> 
>>> Another approach that people have done is to put together an uber JAR
>>> with all the smaller JARs and then deploy that (for example with wrap)
>>> then that seems to work. Although that goes against the idea of OSGi
>>> modularity and bundles a bit.
>>> 
>>> And possibly there may be FAB which could make it work. For example
>>> people using Hibernate get this working much easier with FAB;
>>> Hibernate being one of the toughest piece to get working with OSGi.
>>> http://www.davsclaus.com/2012/08/osgi-deployment-made-easy-with-fab.html
>>> 
>>> At the Apache communities we love help and contributions, so if you
>>> got the need and time for FOP, then we would love help with getting
>>> the camel-fop feature to run out of the box in the Apache products.
>>> 
 
 
 Am 14.09.2012 um 09:36 schrieb Claus Ibsen:
 
> Hi
> 
> If you use Karaf / SMX then there is a camel-fop feature you can use
> to install. That is the recommended approach for installing Camel
> components.
> 
> features:install camel
> features:install camel-fop
> 
> Though the camel-fop feature may not yet 100% work. As you say below,
> classloading from non-OSGi friendly JARs is not easy to get working
> seamless with OSGi.
> 
> 
> On Fri, Sep 14, 2012 at 9:32 AM, Maruan Sahyoun  
> wrote:
>> I installed the dependencies via osgi:install from that repository which 
>> enabled the Camel route to deploy (defined via Blueprint xml). But when 
>> I tried to submit data I got the error
>> 
>> java.lang.UnsupportedOperationException: Don't know how to handle 
>> "application/pdf" as an output format. Neither an FOEventHandler, nor a 
>> Renderer could be found for this output format.
>> at 
>> org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:361)[72:org.apache.servicemix.bundles.fop:1.0.0.2]
>> 
>> So I think it doesn't find the Renderers. As far as I understand the 
>> mechanism fop is using for getting it's renderers it depends on Java 
>> class loading.
>> 
>> Maruan
>> 
>> 
>> Am 14.09.2012 um 09:24 schrieb Claus Ibsen:
>> 
>>> On Fri, Sep 14, 2012 at 9:19 AM, Maruan Sahyoun 
>>>  wrote:
 OK - some further testing shows that camel-fop works fine if you run 
 camel standalone. So the issue is when running inside an OSGI 
 container. I'll do some more investigation. Is there someone around 
 using camel-fop inside Karaf or ServiceMix? Any hints?
 
 Thanks for all the help so far. I'm very glad that I found Camel - 
 nice piece of software and very helpful community.
>>> 
>>> I think some of the FOP JARs and its dependencies is being created as
>>> OSGi wrapped bundles, which will get published to the maven repo at
>>> http://repo2.maven.org/maven2/org/apache/servicemix/bundles/
>>> 
>>> 
>>> 
 Maruan Sahyoun
 
 
 Am 10.09.2012 um 13:12 schrieb Charles Moulliard:
 
> Hi,
> 
> Have you deployed the bundle of Apache XMLGraphics ?
> 
> Regards,
> 
> Charles
> 
> On Mon, Sep 10, 2012 at 10:38 AM, Maruan Sahyoun 
> wrote:
> 
>> Hi,
>> 
>> I'm trying to use camel-fop from within Apache Karaf. But I'm 
>> getting an
>> error message about a missing class
>> Caused by: java.lang.NoClassDefFoundError:
>> org/apache/xmlgraphics/image/loader/ImageContext
>> 
>> Apache Karaf is 2.29
>> Apache Camel is 2.10.0 (I also tried 2.10.1)
>> 
>> features installed are camel-core, camel-blueprint, camel-fop
>> 
>> Did anyon

MailComponent's claim to handle special mail multipart formats and attachments?!

2013-01-03 Thread axelr
Hi,

we are using the MailComponent to archive certain mails in a database - text
and attachments separated. Most of them are very simple and just plain text
with one or more pdf attachments.

During the last months we have got some mails where the MailComponent (esp.
its MailBinder) run into an exception:

org.apache.camel.RuntimeCamelException: Error populating the initial mail
message attachments
at
org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:124)
at
org.apache.camel.impl.DefaultMessage.createAttachments(DefaultMessage.java:209)
at
org.apache.camel.impl.DefaultMessage.getAttachments(DefaultMessage.java:274)
at xxx.BuchhaltungEmailTest.testA(BuchhaltungEmailTest.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
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:30)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
at org.junit.rules.RunRules.evaluate(RunRules.java:18)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
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: javax.mail.internet.ParseException: Expected parameter value,
got "null"
at javax.mail.internet.ParameterList.(ParameterList.java:262)
at
javax.mail.internet.ContentDisposition.(ContentDisposition.java:100)
at 
javax.mail.internet.MimeBodyPart.getDisposition(MimeBodyPart.java:1076)
at 
javax.mail.internet.MimeBodyPart.getDisposition(MimeBodyPart.java:303)
at
org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMultipart(MailBinding.java:306)
at
org.apache.camel.component.mail.MailBinding.extractAttachmentsFromMail(MailBinding.java:287)
at
org.apache.camel.component.mail.MailMessage.populateInitialAttachments(MailMessage.java:121)
*   ... 32 more

These mails are HTML emails and the result of forwarded messages containing
an attachment. They can be viewed without any problems by different mail
client (outlook, thunderbird, zarafa web access).

One of the primary reasons is the try to get the disposition and the
filename. The trace of a custom MailBinder, which catches the exceptions, is
as follows:

TRACE [main] org.apache.camel.component.mail.MailBinding: Part #1:
Disposition: null
TRACE [main] org.apache.camel.component.mail.MailBinding: Part #1:
Description: null
TRACE [main] org.apache.camel.component.mail.MailBinding: Part #1:
ContentType: message/rfc822
TRACE [main] org.apache.camel.component.mail.MailBinding: Part #1: FileName:
null
TRACE [main] org.apache.camel.component.mail.MailBinding: Part #1: Size:
3
TRACE [main] org.apache.camel.component.mail.MailBinding: Part #1:
LineCount: -1

I am not primarily interested in a technical solution. My question is
whether Camel's MailComponent should be able to deal with such special
formats - at leas

Re: camel-smpp in trx mode

2013-01-03 Thread Christian Müller
It doesn't make sense for me to support the TRX mode.
Could you provide some pseudo code how your route will looks like?

Best,
Christian

On Mon, Dec 31, 2012 at 5:32 AM, Srinivas  wrote:

> Hi Christian,
>
>  Thank you for replying.
>
>   Operator given only one smpp connectivity that is in trx mode and
> operator not allowed two smpp(tx and rx) connections. In my application
> receive delivery sm ,delivery recipients and submit sm. Please help me how
> to solve my problem using apache camel.
>
> Regards,
>
> Srinivas
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-smpp-in-trx-mode-tp5724608p5724731.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--


Re: camel-smpp in trx mode

2013-01-03 Thread Johanes Soetanto
On Friday, 4 January 2013, Christian Müller wrote:

> It doesn't make sense for me to support the TRX mode.
> Could you provide some pseudo code how your route will looks like?
>
> Best,
> Christian
>
> On Mon, Dec 31, 2012 at 5:32 AM, Srinivas 
> >
> wrote:
>
> > Hi Christian,
> >
> >  Thank you for replying.
> >
> >   Operator given only one smpp connectivity that is in trx mode
> and
> > operator not allowed two smpp(tx and rx) connections. In my application
> > receive delivery sm ,delivery recipients and submit sm. Please help me
> how
> > to solve my problem using apache camel.
> >
> > Regards,
> >
> > Srinivas


>From my experience, some SMSC only allow single connection using TRX.
I can't remember whether i have established TRX connection during my tests,
but I remember that sometimes my outbound route also receive incoming sms
if i add additional "to" destination


>
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/camel-smpp-in-trx-mode-tp5724608p5724731.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
>
> --
>


-- 
Johanes


Re: Relative URL for XSL in XSLT component

2013-01-03 Thread Christian Müller
Please have a look at [1] which shows it works.
Could you please remove "file:" and try it again.

[1]
https://svn.apache.org/repos/asf/camel/tags/camel-2.8.5/components/camel-spring/src/test/java/org/apache/camel/component/xslt/XsltFromFileExceptionTest.java

Best,
Christian

On Wed, Jan 2, 2013 at 5:36 PM, felixnutella wrote:

> Hi all
>
> I'm quite new at Camel but have managed to get it up and running using a
> few
> custom components/converters...
>
> But..
>
> Is it true that you need to specify an absolute path for the XSL in the
> XSLT
> component? Whenever I try to specify an relative, it comes up with File not
> found.
>
> I'm specifying the xslt transformation as: 
> uri="xslt:file://xsl/customer.xsl?transformerFactoryClass=net.sf.saxon.TransformerFactoryImpl&contentCache=false"/>
> - this does not work...
>
> If I'm doing it like: 
> uri="xslt:file://C:/Users/USERNAME/Desktop/apache-servicemix-4.4.2/xsl/customer.xsl?transformerFactoryClass=net.sf.saxon.TransformerFactoryImpl&contentCache=false"/>
> it works perfectly.
>
> It should be said that Camel is running inside servicemix, which should be
> version 2.8.5 if that has any meaning.
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Relative-URL-for-XSL-in-XSLT-component-tp5724794.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--


Re: WebSpherePackageScanClassResolver.isWebSphereClassLoader(WebSpherePackageScanClassResolver.java:46)

2013-01-03 Thread superduperguy
I am using version 2.10.2 so shouldn't have to camel-jboss jar(which I can't
find easily either) and I don't have any special converter which I need to
list. 

All I am trying is modifying the camel-example-jms-file to use my MQ queue
and put contents on queue which will be forwarded to a file in my mbean.


.
.
.
public class PayrollNotificationPublisher2 extends ServiceMBeanSupport
implements PayrollNotificationPublisher2MBean {

private static final Logger log =
Logger.getLogger(PayrollNotificationPublisher2.class.getCanonicalName());   
private CamelContext context = null;
private ProducerTemplate template = null;
private String outboundQueueName ="/jms/mqseries/MyQ";
private String queueFactoryName ="/jms/mqseries/MQConnectionFactory";

public PayrollNotificationPublisher2(){}

@Override
public void startService(){
setCamelContext();
}

@Override
public void stopService(){
try {
context.stop();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage());
}
}   

public void setCamelContext() {
// TODO Auto-generated method stub
// START SNIPPET: e1
context = new DefaultCamelContext();
// END SNIPPET: e1
// Set up the ActiveMQ JMS Components
// START SNIPPET: e2

JNDIUtil jndiUtil = new JNDIUtil();
log.debug("Looking up outbound queue connection factory: " +
queueFactoryName);
QueueConnectionFactory  connectionFactory =
jndiUtil.getQueueConnectionFactory("vm:"+queueFactoryName);
   

// Note we can explicit name the component
context.addComponent("jms-mq",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
// END SNIPPET: e2
// Add some configuration by hand ...
// START SNIPPET: e3
try {
context.addRoutes(new RouteBuilder() {
public void configure() {
   // 
from("jms-mq:queue:/jms/mqseries/MyQ").to("file://test");
 from("vm:/jms/mqseries/MyQ").to("file://test");
}
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage());
}

// Camel template - a handy class for kicking off exchanges
// START SNIPPET: e4
template = context.createProducerTemplate();
// END SNIPPET: e4
// Now everything is set up - lets start the context
try {
context.start();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage());
}
}

public void sendMessage(String putOnQ) throws JMSException {

// Now send some test text to a component - for this case a JMS
Queue
// The text get converted to JMS messages - and sent to the Queue
// test.queue
// The file component is listening for messages from the Queue
// test.queue, consumes
// them and stores them to disk. The content of each file will be
the
// test we sent here.
// The listener on the file component gets notified when new files
are
// found ... that's it!
// START SNIPPET: e5
for (int i = 0; i < 5; i++) {
//template.sendBody("test-jms:queue:test.queue", putOnQ +" "+
i);
template.sendBody("/jms/mqseries/MyQ", putOnQ +" "+ i);
}
// END SNIPPET: e5


}

}


I am still getting the same error while creating the default camel context?





--
View this message in context: 
http://camel.465427.n5.nabble.com/WebSpherePackageScanClassResolver-isWebSphereClassLoader-WebSpherePackageScanClassResolver-java-46-tp4267695p5724863.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Content based Routing

2013-01-03 Thread boday
I suggest you start with some simple  examples
   or  books
   to get your head around how to use
Camel.

To your specific flow, see the following links...

1. see  camel-file    to process a file
2. for XML parsing, see  camel-xpath  
...
for CSV parsing, see  camel-csv   
3. see  camel-jdbc    for populating a
database table

Also, you can run Camel applications any number of ways (don't need to use
ServiceMix)...there is is a great overview of the options here:
http://download.progress.com/5331/open/adobe/prc/psc/091610_apache_camel_deployment/index.htm
 





Padmalaya wrote
> I need help in implementing content based routing in Camel. Basically I
> need to use unstructured data do some processing and then send it to the
> required DB Tables. I have however Identified the following sequences:
> 
> 1. Collect Data from Client (can be a csv or an xml) using Camel Route
> 2. Process Data Received (How Can Camel Help me Identify the relevant
> content???)
> 3. Run Camel Service mix and populate data into the Database
> 
> If there is any similar implementation as of this please give me the link.
> 
> Regards,
> 
> Padmalaya





-
Ben O'Day
IT Consultant -http://consulting-notes.com

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


CXFRS client from Camel route

2013-01-03 Thread rado
Hi Guys,
here is my situation:
1. We need to consume an external REST Web Service exposed and maintained by
3-rd party;
2. This service accepts POST requests with XML payload based on which it
creates a resource;

3. In our current Camel route we call a REST client bean like this:
...
 
 
**

and here is the restClient config (in the sping context):
http://localhost:8080/my-rest-service/services";  
serviceClass="com.my.services.rs.client.ExampleResource" >

 
 



4. The com.my.services.rs.client.ExampleResource is just an interface and
looks like this:
public interface ExampleResource {

@POST
@Path(value = "/resources/")
@Produces(MediaType.APPLICATION_XML)
public String createExampleResource(String exampleResourceXML);

}

That all works fine as it is.

However we want to use the cxfrs Camel component instead and replace the
line in bold above with something like this:
**

I have gone through the example in the cxfrs component's doc but coudn't
understand how could i only create cxf:rsClient and use this in my route? 

Thank you for your help.



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