Add thread pool configuration for SEDA using xml

2012-07-23 Thread billy ding
Hi, from http://camel.apache.org/seda.html, we can use DSL to add thread pool
to SEDA, e.g. from(seda:stageName).thread(5).process(...), 
can anyone tell me how to do the same thing using xml? 
I have a xml seda route definition.
camel:from uri=seda:asyncAuthenticate /
camel:to uri=bean:authenticateBean?method=performIndempotentOperations /

Thanks a lot.
Billy



--
View this message in context: 
http://camel.465427.n5.nabble.com/Add-thread-pool-configuration-for-SEDA-using-xml-tp5716324.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Add thread pool configuration for SEDA using xml

2012-07-23 Thread Claus Ibsen
On Mon, Jul 23, 2012 at 2:54 AM, billy ding dingq...@gmail.com wrote:
 Hi, from http://camel.apache.org/seda.html, we can use DSL to add thread pool
 to SEDA, e.g. from(seda:stageName).thread(5).process(...),

This is not really possible. Please read the docs again.
The seda has its own internal fixed thread pool, you cannot
re-configure. You set the option concurrentConsumers=5 on the seda uri
to indicate 5 threads.

 to SEDA, e.g. from(seda:stageName?concurrentConsumers=5).process(...),


 can anyone tell me how to do the same thing using xml?
 I have a xml seda route definition.
 camel:from uri=seda:asyncAuthenticate /
 camel:to uri=bean:authenticateBean?method=performIndempotentOperations /

 Thanks a lot.
 Billy



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Add-thread-pool-configuration-for-SEDA-using-xml-tp5716324.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, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: No language could be found for: js

2012-07-23 Thread Claus Ibsen
On Sat, Jul 21, 2012 at 5:13 PM, Rob Ogando roga...@gmail.com wrote:
 Hi,
 I'm using Max OSX 10.6.8
 JDK 1.6.0_33
 with Karaf.


Karaf is a general purpose container, and you may need to
configure/tweak it to work with some of the Camel components.
Hence why SMX team do that for Apache ServiceMix to ensure it works
well with CXF, Camel and AMQ all together.

In the Karaf distribution there is a etc/jre.properties.cxf file, you
may need to replace that file with the jre.properties. And then delete
the data dir, and restart the Karaf.

We have a notice about this in the bottom of the Camel release notes.



 On Saturday, July 21, 2012 at 2:58 AM, Claus Ibsen wrote:

 Hi

 What JDK, OS are you using?
 And what container do you use, tomcat, jetty, jboss, karaf, servicemix etc?
 Or in other words a bit more about your runtime environment.



 On Fri, Jul 20, 2012 at 6:49 PM, RobertO roga...@gmail.com 
 (mailto:roga...@gmail.com) wrote:
  I'm trying to use javascript in my routes but keep getting the No language
  could be found for: js error in my unit tests when I load the camelcontext
  via spring. I've found other references to this error on the mailing list
  but have so far been unable to resolve this.
 
  Camel v2.9.2
 
  I've added these dependencies to my pom:
 
  dependency
  groupIdorg.apache.camel/groupId
  artifactIdcamel-script/artifactId
  version${camel.version}/version
  /dependency
 
  dependency
  groupIdorg.apache.camel/groupId
  artifactIdcamel-script-javascript/artifactId
  version${camel.version}/version
  /dependency
 
  Can someone give me instructions on how to fix this?
 
  Thank you.
 
 
 
 
  --
  View this message in context: 
  http://camel.465427.n5.nabble.com/No-language-could-be-found-for-js-tp5716299.html
  Sent from the Camel - Users mailing list archive at Nabble.com 
  (http://Nabble.com).
 




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







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


Parallel processing using apache camel

2012-07-23 Thread Nafees
Hi

 We download  binary files present in ftp server to a local folder and do
mediation and data storage. we end this route when all files from ftp had
been completed.

from(ftpUrl).to(fileUrl).bean(endRoute,ftpStopper);

from(fileUrl).thread(5).to(mediationProcessManager).bean(endRoute,localStopper);

I want to implement threading mechanism so as to reduce processing time. 

Plz guide me how this can be achieved. My idea is to start e.g. 5 threads..
5 files shud be processed in parallel, after threads have done there
job..next 5 files and so on..

Thanks
Nafees



--
View this message in context: 
http://camel.465427.n5.nabble.com/Parallel-processing-using-apache-camel-tp5716329.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Request-reply with Camel Spring AMQP

2012-07-23 Thread Bruno Dusausoy

Hi,

I know this is not an official Camel component but is it possible to do 
request/reply with the Camel Spring AMQP component ?

I don't see any example on the internet.

Basically here's my context :

!-- Beans and Rabbit MQ Configuration here ... --

camelContext xmlns=http://camel.apache.org/schema/spring;
route
from uri=file:src/data?noop=true/
to uri=direct:beforeRabbit/
/route
route
from uri=direct:beforeRabbit/
log message=Sending to RabbitMQ/
to 
uri=spring-amqp:mytest:myQueue:testKey?exchangePattern=InOutamp;durable=trueamp;autodelete=false/

bean ref=outBean method=process/
/route
route
from 
uri=spring-amqp:mytest:myQueue:testKey?durable=trueamp;autodelete=false/

bean ref=processBean method=process/
/route
/camelContext


And the beans :

public class OutBean {

public void process(@Body String message) {
System.out.println(message);
}
}

public class ProcessBean {

public String process() {
return Process completed;
}
}


What I'm trying to do - this is a proof-of-concept - is to send the file 
through RabbitMQ and then get a response Process completed from the 
ProcessBean which is then displayed by the OutBean.


This isn't working. What is displayed is the body of the file, not the 
String Process completed.


Am I doing something wrong ?

Thanks.
--
Bruno Dusausoy
Software engineer
YP5 Software
--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.


Multicast and Aggregator V AKKA

2012-07-23 Thread gilboy
Hi

In my application I have 4 web service calls I need to make in a process
flow which can be made in parallel.The obvious approach in solving this to
me was just to use a multicast and have results aggregated together using
the aggregator EIP support.

Since I have been hearing much about akka lately, I am trying to understand
what benefits there would be if I went the akka route(having an actor for
each of the service calls) rather than going the multicast and aggregator
approach.

I don't see any advantages. Help much appreciated on this as I am sure I
must be missing something

Thanks
Joe



--
View this message in context: 
http://camel.465427.n5.nabble.com/Multicast-and-Aggregator-V-AKKA-tp5716331.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Spring testing framework

2012-07-23 Thread Sri
Hi All,

I wanted to create unit testing framework for Camel  spring. It would be
great if any body who have already worked on similiar kind of stuff can
share thoughts on this. I wanted to use annotations for this framework. 

Regards
Sri





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


Re: Camel Spring testing framework

2012-07-23 Thread Bruno Dusausoy

On 23/07/2012 11:38, Sri wrote:

Hi All,

I wanted to create unit testing framework for Camel  spring. It would be
great if any body who have already worked on similiar kind of stuff can
share thoughts on this. I wanted to use annotations for this framework.


Doesn't this suit your needs ?
http://camel.apache.org/spring-testing.html

Do you have any specific requirements ?

--
Bruno Dusausoy
Software engineer
YP5 Software
--
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.


Re: Camel Spring testing framework

2012-07-23 Thread Sri
Hi,

I just wanted to create a base class for my testing framework which should
use Spring Application context and Camel context and the other test cases
can extend this base class and proceed.

and BTW the spring enhanced testing is available in 2.9.1 version.

Regards
Srinivas



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


Re: Request-reply with Camel Spring AMQP

2012-07-23 Thread Willem Jiang
I just take a quick look at the document of Camel Spring AMQP 
component[1], it doesn't support to setup the exchangePattern option.


From your description, it looks like it is still use the InOnly 
exchange pattern.


On Mon Jul 23 15:36:37 2012, Bruno Dusausoy wrote:

Hi,

I know this is not an official Camel component but is it possible to
do request/reply with the Camel Spring AMQP component ?
I don't see any example on the internet.

Basically here's my context :

!-- Beans and Rabbit MQ Configuration here ... --

camelContext xmlns=http://camel.apache.org/schema/spring;
route
from uri=file:src/data?noop=true/
to uri=direct:beforeRabbit/
/route
route
from uri=direct:beforeRabbit/
log message=Sending to RabbitMQ/
to
uri=spring-amqp:mytest:myQueue:testKey?exchangePattern=InOutamp;durable=trueamp;autodelete=false/

bean ref=outBean method=process/
/route
route
from
uri=spring-amqp:mytest:myQueue:testKey?durable=trueamp;autodelete=false/

bean ref=processBean method=process/
/route
/camelContext


And the beans :

public class OutBean {

public void process(@Body String message) {
System.out.println(message);
}
}

public class ProcessBean {

public String process() {
return Process completed;
}
}


What I'm trying to do - this is a proof-of-concept - is to send the
file through RabbitMQ and then get a response Process completed from
the ProcessBean which is then displayed by the OutBean.

This isn't working. What is displayed is the body of the file, not the
String Process completed.

Am I doing something wrong ?

Thanks.



--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang



RE: Input directory with multiple file consumers

2012-07-23 Thread Raf
 Is there a way to monitor the same input folder from camel
applications on different machines? I am wondering what the best
practice is on handling this situation. 

 

Since you logged an issue for this, you might want to know that I found
a workaround.

 

If you add the parameters preMove=processingmaxMessagesPerPoll=1 then
multiple servers can work on the same camel folder.

 

Without maxMessagesPerPoll=1, camel will scan all files in the folder
and then process them one by one. This will give errors when another
server has already processed the file while this server still thinks it
needs to be processed. This is no longer possible when
maxMessagesPerPoll=1 is used.

 

Without preMove=processing, the different servers will want to lock the
same file, only one gets the lock and the others are waiting to lock the
same file. With preMove=processing, each server will pick up a different
file because they no longer see the files locked by other servers.

 

 

Regards,

Raf





--
View this message in context: 
http://camel.465427.n5.nabble.com/Input-directory-with-multiple-file-consumers-tp5713788p5716340.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to invoke CXF webservice from processor bean

2012-07-23 Thread jeyaseelan78
Hi,
Here is my SEI.
-
import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public interface PasApplicationAdapterService {

@WebMethod
public String processClient(String pasXml) throws Exception;

@WebMethod
public void processPASLoadStatus(String pasLoadStatus) throws Exception;
}

Below is my end point configuration,
cxf:cxfEndpoint id=PASLIEndpoint
address=http://localhost:9080/LegacyIntegration/services/pas/;
serviceClass=xyz.abc.PasApplicationAdapterService
wsdlURL=wsdl/PASService.wsdl /

Can you please help to locate the problem?
Thanks in advance.







--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716341.html
Sent from the Camel - Users mailing list archive at Nabble.com.


CXFRS does not process JSON

2012-07-23 Thread hom
Hi,

I've created a cxfrs route as described in
http://camel.apache.org/cxfrs.html (How to consume the REST request in
Camel). I am using SOAPUI to test the endpoint. The resource class is:

/@Path(/)
@Consumes({application/xml,application/json})
@Produces({application/xml,application/json})
public class Resource {
 
@POST
@Path(/doit/)
@Consumes({application/xml,application/json})
@Produces({application/xml,application/json})
public DoItResponse doit(DoItRequest request){return null;};
}/

For XML everything works fine, but when I send a json request I always get:

data contentType=text/plain contentLength=555![CDATA[JAXBException
occurred : unexpected element (uri:, local:DoItRequest). Expected
elements are
{http://www.xyz.org/types}DoItRequest,{http://www.xyz.org/types}DoItResponse,{http://www.xyz.org/types}
ProviderError. unexpected element (uri:, local:DoItRequest) ...

I set media type and access header to application/json, but it seems that
json is not recognized.
Any ideas?






--
View this message in context: 
http://camel.465427.n5.nabble.com/CXFRS-does-not-process-JSON-tp5716343.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel 2.10 eagerMaxMessagesPerPoll

2012-07-23 Thread cvancal
I am trying to use the File component with the following properties:

maxMessagesPerPoll=1
eagerMaxMessagesPerPoll=false

but when I deploy I am getting:

There are 1 parameters that couldn't be set on the endpoint. Check the uri
if the parameters are spelt correctly and that they are properties of the
endpoint. Unknown parameters=[{eagerMaxMessagesPerPoll=false}]
 
Any thoughts?

Thanks

Curt



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


Re: CXFRS does not process JSON

2012-07-23 Thread Sergey Beryozkin

Hi
On 23/07/12 16:10, hom wrote:

Hi,

I've created a cxfrs route as described in
http://camel.apache.org/cxfrs.html (How to consume the REST request in
Camel). I am using SOAPUI to test the endpoint. The resource class is:

/@Path(/)
@Consumes({application/xml,application/json})
@Produces({application/xml,application/json})
public class Resource {

@POST
@Path(/doit/)
@Consumes({application/xml,application/json})
@Produces({application/xml,application/json})
 public DoItResponse doit(DoItRequest request){return null;};
}/

For XML everything works fine, but when I send a json request I always get:

data contentType=text/plain contentLength=555![CDATA[JAXBException
occurred : unexpected element (uri:, local:DoItRequest). Expected
elements are
{http://www.xyz.org/types}DoItRequest,{http://www.xyz.org/types}DoItResponse,{http://www.xyz.org/types}
ProviderError. unexpected element (uri:, local:DoItRequest) ...

I set media type and access header to application/json, but it seems that
json is not recognized.
Any ideas?

The problem is most likely to do with the fact that DoItRequest is 
namespace-qualified (with @XmlRootElement or at the package level).

However a json sequence you are posting is most likely has no prefixes.
If you work with Jettison, then one way to do it is to provide a 
namespace map, however, as I said I think the sequence have no prefixes 
so there's no inbound info that can be used to map prefixes to namespaces.

Thus the better option is to use a transformation feature:
http://cxf.apache.org/docs/transformationfeature.html

having an 'inTransformElements' property to have a pair like 
DoItRequest: {http//mynamespace}DoItRequest should do it


HTH, Sergey






--
View this message in context: 
http://camel.465427.n5.nabble.com/CXFRS-does-not-process-JSON-tp5716343.html
Sent from the Camel - Users mailing list archive at Nabble.com.





How to handle http status code

2012-07-23 Thread bitter geek
Hi All,

I have a router builder for a rest service with configure override
like the following:
...
@Override
public void configure() throws Exception {
from(direct:GetCustomer)
.setHeader(Content-Type, 
constant(application/x-www-form-urlencoded))
.setHeader(Exchange.HTTP_METHOD, constant(GET))
.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, 
constant(Boolean.TRUE))
.setHeader(Exchange.HTTP_PATH, simple(${header.httpPath}))
.setHeader(Exchange.HTTP_QUERY,
simple(getURIComponentQuery()))
.to(endpoint);
}
...


The rest service returns an xml document. I don't have the xsd for it
so would like to set the type of the response to String via
convertBodyTo(String.class).

But once I do this, producerTemplate.requestBodyAndHeaders(null,
headers) returns a String object. So I lose the status code.

Noting converting it to string will let me access the status code but
then I no longer have the text body available.

Any idea how to get both the status code and the text body properly?

Thanks a lot for the help!

Bing


Re: How to handle http status code

2012-07-23 Thread Sergey Beryozkin

Hi
On 23/07/12 16:43, bitter geek wrote:

Hi All,

I have a router builder for a rest service with configure override
like the following:
...
@Override
public void configure() throws Exception {
from(direct:GetCustomer)
.setHeader(Content-Type, 
constant(application/x-www-form-urlencoded))
.setHeader(Exchange.HTTP_METHOD, constant(GET))
.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, 
constant(Boolean.TRUE))
.setHeader(Exchange.HTTP_PATH, simple(${header.httpPath}))
.setHeader(Exchange.HTTP_QUERY,
simple(getURIComponentQuery()))
.to(endpoint);
}
...


The rest service returns an xml document. I don't have the xsd for it
so would like to set the type of the response to String via
convertBodyTo(String.class).

But once I do this, producerTemplate.requestBodyAndHeaders(null,
headers) returns a String object. So I lose the status code.

Noting converting it to string will let me access the status code but
then I no longer have the text body available.

Any idea how to get both the status code and the text body properly?

Thanks a lot for the help!
I can see from the code that a status code is set as 
Exchange.HTTP_RESPONSE_CODE header on the out message, so you should be 
able to get it from there


Cheers, Sergey



Bing




Re: cxfEndpoints and different transports (http, https) using PAX Web

2012-07-23 Thread Scott England-Sullivan
Hi Lars,

There is a bug currently that prevents the component from resolving a
match any consumer endpoint with a bridged producer.  I have opened
a ticket a provided a patch.  You can follow the details here:

https://issues.apache.org/jira/browse/CAMEL-5458

Until then, I believe you can configure your base external endpoint
with a context path and then match off of that.  I believe this will
work as you are expecting.

sully6768

On Jul 21, 2012, at 11:03 AM, helander leh...@gmail.com wrote:

 Hi Sully and thanks for the input.

 Now I think I know how it works, but I have an additional question:

 Both entries in the config file specifies http://localhost:8181;, is it
 possible do something like:

   http://localhost:8181/system/console; on one and
 http://localhost:8181/cxf; on the other

 in order to filter what gets received from the respective jetty port? Or
 could you do that kind of filtering
 in some other way?

 /Lars



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/cxfEndpoints-and-different-transports-http-https-using-PAX-Web-tp5716216p5716310.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


CxfRsProducer is not thread safe

2012-07-23 Thread dumi_p
Hi all,

I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
scenario:

1. Have a CXF rest service deployed
2. Have a proxy CXF rest service over the service above, deployed under the
same Camel instance

It works fine, until I perform requests in parallel. Exception stacktrace is
attached.  http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt
stacktrace.txt 

I tried following things in class
org.apache.camel.component.cxf.jaxrs.CxfRsProducer order to fix it:
1. Invoked JAXRSClientFactoryBean.setThreadSafe(true), with no success
2. Added synchronization point over line WebClient client =
cfb.createWebClient(), from invokeHttpClient method. It works, but
performance dropped on my localhost from 150 requests per second to 10
requests per second, so the fix is not acceptable.

I attach my camel-config.xml - please let me know if additional info is
needed. http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
camel-config.xml 

I am not sure if the problem lies in the configuration I performed or in the
cxf-rs component or in cxf itself.

Any idea is appreciated.

Best regards,
Dumitru



--
View this message in context: 
http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CXFRS does not process JSON

2012-07-23 Thread hom
Thanks for the quick reply. I added the transformFeature bean, but it seems
that is has no effect.
I am still getting the same message.
This is what I did in the blueprint context:

blueprint

  bean id=providerRoute class=org.xyz.ProviderRoute/

  bean id=transformFeature
class=org.apache.cxf.feature.StaxTransformFeature
property name=inTransformElements
   map
  entry key=DoItRequest
value={http://www.xyz.org/types}DoItRequest/
   /map
/property
  /bean
 
 camelContext id=camel xmlns=http://camel.apache.org/schema/blueprint;
routeBuilder ref=providerRoute /
 /camelContext
/blueprint

Did I miss something?



--
View this message in context: 
http://camel.465427.n5.nabble.com/CXFRS-does-not-process-JSON-tp5716343p5716352.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to handle http status code

2012-07-23 Thread bitter geek
Hi Sergey,

Thanks for the reply.

I'm quite new to Camel. I knew you can get it from the out message but
how do I access the out message from the code snippet I provided?

I'd like to know what is the best way to access both the status and
the response message as a string.

On 7/23/12, Sergey Beryozkin sberyoz...@gmail.com wrote:
 Hi
 On 23/07/12 16:43, bitter geek wrote:
 Hi All,

 I have a router builder for a rest service with configure override
 like the following:
 ...
 @Override
  public void configure() throws Exception {
  from(direct:GetCustomer)
  .setHeader(Content-Type,
 constant(application/x-www-form-urlencoded))
  .setHeader(Exchange.HTTP_METHOD, constant(GET))
  .setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
 constant(Boolean.TRUE))
  .setHeader(Exchange.HTTP_PATH, simple(${header.httpPath}))
  .setHeader(Exchange.HTTP_QUERY,
  simple(getURIComponentQuery()))
  .to(endpoint);
  }
 ...


 The rest service returns an xml document. I don't have the xsd for it
 so would like to set the type of the response to String via
 convertBodyTo(String.class).

 But once I do this, producerTemplate.requestBodyAndHeaders(null,
 headers) returns a String object. So I lose the status code.

 Noting converting it to string will let me access the status code but
 then I no longer have the text body available.

 Any idea how to get both the status code and the text body properly?

 Thanks a lot for the help!
 I can see from the code that a status code is set as
 Exchange.HTTP_RESPONSE_CODE header on the out message, so you should be
 able to get it from there

 Cheers, Sergey


 Bing




Re: How to handle http status code

2012-07-23 Thread Christoph Emmersberger
Hi Bing,

simple question, why don't you write e.g. a processor that is configured to 
your route. Your route could look like thos:

/** Processor defined as spring bean, e.g. via @Named tag */
@Inject
MyHeaderExtractor myHeaderExtractor;

public void configure() throws Exceltion {
from(direct:GetCustomer)
.setHeader(direct:GetCustomer)
// ... continue with your setter to the header
.process(myHeaderExtractor)
.to(endpoint); 
}

Your header extractor can than implement the processor interface which forces 
you to implement a process(Exchange exchange) method.

You could also decide simply using the bean processing capabilities of camel as 
an alternative approach.

@Named
public class MyHeaderExtractor extends Processor {

public void process(Exchange exchange) {
exchange.getIn().getHeaders(); // returns the header map on the 
in exchange
exchange.getIn().getBody(); // returns the body on the in 
exchange
// Here you can add some specific header extractions for 
whatever you need it
exchange.getOut().getHeaders(); // Would give you the out header
}
}

Hope this helps, best regards,

Christoph



On Jul 23, 2012, at 7:06 PM, bitter geek wrote:

 Hi Sergey,
 
 Thanks for the reply.
 
 I'm quite new to Camel. I knew you can get it from the out message but
 how do I access the out message from the code snippet I provided?
 
 I'd like to know what is the best way to access both the status and
 the response message as a string.
 
 On 7/23/12, Sergey Beryozkin sberyoz...@gmail.com wrote:
 Hi
 On 23/07/12 16:43, bitter geek wrote:
 Hi All,
 
 I have a router builder for a rest service with configure override
 like the following:
 ...
 @Override
 public void configure() throws Exception {
 from(direct:GetCustomer)
 .setHeader(Content-Type,
 constant(application/x-www-form-urlencoded))
 .setHeader(Exchange.HTTP_METHOD, constant(GET))
 .setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
 constant(Boolean.TRUE))
 .setHeader(Exchange.HTTP_PATH, simple(${header.httpPath}))
 .setHeader(Exchange.HTTP_QUERY,
 simple(getURIComponentQuery()))
 .to(endpoint);
 }
 ...
 
 
 The rest service returns an xml document. I don't have the xsd for it
 so would like to set the type of the response to String via
 convertBodyTo(String.class).
 
 But once I do this, producerTemplate.requestBodyAndHeaders(null,
 headers) returns a String object. So I lose the status code.
 
 Noting converting it to string will let me access the status code but
 then I no longer have the text body available.
 
 Any idea how to get both the status code and the text body properly?
 
 Thanks a lot for the help!
 I can see from the code that a status code is set as
 Exchange.HTTP_RESPONSE_CODE header on the out message, so you should be
 able to get it from there
 
 Cheers, Sergey
 
 
 Bing
 
 



Re: Camel 2.10 eagerMaxMessagesPerPoll

2012-07-23 Thread Christian Müller
Sure?

We have a unit test [1] which works.

[1]
https://svn.apache.org/repos/asf/camel/tags/camel-2.10.0/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeNotEagerMaxMessagesPerPollTest.java

Best,
Christian

On Mon, Jul 23, 2012 at 5:06 PM, cvancal cvan...@gmail.com wrote:

 I am trying to use the File component with the following properties:

 maxMessagesPerPoll=1
 eagerMaxMessagesPerPoll=false

 but when I deploy I am getting:

 There are 1 parameters that couldn't be set on the endpoint. Check the uri
 if the parameters are spelt correctly and that they are properties of the
 endpoint. Unknown parameters=[{eagerMaxMessagesPerPoll=false}]

 Any thoughts?

 Thanks

 Curt



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



Re: Camel Spring testing framework

2012-07-23 Thread ychawla
Hi Sri,
The Camel in Action book has great resources on testing. There is also a
good WIKI page for Camel testing:

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

Also check on the 'adviceWith' page.  It has some great testing strategies:

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

Thanks,
Yogesh



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


Re: Parallel processing using apache camel

2012-07-23 Thread ychawla
Hi Nafees,
Have you looked into using SEDA component?  You can send from your file path
to the SEDA component and set up your concurrency there:

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

There is another Camel post that discussed how to do this:

http://camel.465427.n5.nabble.com/Ability-to-process-multiple-files-file-endpoint-simultaneously-in-a-single-Application-td470713.html

Thanks,
Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/Parallel-processing-using-apache-camel-tp5716329p5716359.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to invoke CXF webservice from processor bean

2012-07-23 Thread ychawla
Hi,
I see that you set the operationName but did you set the operationNamespace.

For example:

senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
http://yourOperationNamespace;);

Try setting that and see if you get the same results.

Thanks,
Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716360.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to handle http status code

2012-07-23 Thread bitter geek
Hi Christoph,

Thanks for your help!

I managed to get it to work based on you code with some changes as shown below.

One change is to call process after to(endpoint). The reponse I need
to handle is that from to(endpoint).
After this change, the getOut() on exchange returns null, so I have to
set the body on in. (why is it null?)

I then create a responseEntity object so the return value from
requestBodyAndHeaders will have both the status and response text
ready to use.

Do you think if this is the right approach to my problem?

Thanks again!

@Override
public void configure() throws Exception {
from(direct:GetCustomer)
.setHeader(Content-Type, 
constant(application/x-www-form-urlencoded))
.setHeader(Exchange.HTTP_METHOD, constant(GET))
.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, 
constant(Boolean.TRUE))
.setHeader(Exchange.HTTP_PATH, simple(${header.httpPath}))
.setHeader(Exchange.HTTP_QUERY,
simple(getURIComponentQuery()))
.to(endpoint)
.process(new Processor() {
@Override
public void process(final Exchange exchange) throws 
Exception {
int responseCode =
exchange.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, int.class);
String body = 
exchange.getIn().getBody(String.class);
ResponseEntityString response = new 
ResponseEntityString(body,
HttpStatus.valueOf(responseCode));
exchange.getIn().setBody(response);
}
});
}
//
The calling code:

ResponseEntityString response = (ResponseEntityString)
producerTemplate.requestBodyAndHeaders(null, headers);
return getDto(response);

///


On 7/23/12, Christoph Emmersberger cemme...@googlemail.com wrote:
 Hi Bing,

 simple question, why don't you write e.g. a processor that is configured to
 your route. Your route could look like thos:

 /** Processor defined as spring bean, e.g. via @Named tag */
 @Inject
 MyHeaderExtractor myHeaderExtractor;

 public void configure() throws Exceltion {
   from(direct:GetCustomer)
   .setHeader(direct:GetCustomer)
   // ... continue with your setter to the header
   .process(myHeaderExtractor)
   .to(endpoint);
 }

 Your header extractor can than implement the processor interface which
 forces you to implement a process(Exchange exchange) method.

 You could also decide simply using the bean processing capabilities of camel
 as an alternative approach.

 @Named
 public class MyHeaderExtractor extends Processor {
   
   public void process(Exchange exchange) {
   exchange.getIn().getHeaders(); // returns the header map on the 
 in
 exchange
   exchange.getIn().getBody(); // returns the body on the in 
 exchange
   // Here you can add some specific header extractions for 
 whatever you need
 it
   exchange.getOut().getHeaders(); // Would give you the out header
   }
 }

 Hope this helps, best regards,

 Christoph



 On Jul 23, 2012, at 7:06 PM, bitter geek wrote:

 Hi Sergey,

 Thanks for the reply.

 I'm quite new to Camel. I knew you can get it from the out message but
 how do I access the out message from the code snippet I provided?

 I'd like to know what is the best way to access both the status and
 the response message as a string.

 On 7/23/12, Sergey Beryozkin sberyoz...@gmail.com wrote:
 Hi
 On 23/07/12 16:43, bitter geek wrote:
 Hi All,

 I have a router builder for a rest service with configure override
 like the following:
 ...
 @Override
public void configure() throws Exception {
from(direct:GetCustomer)
.setHeader(Content-Type,
 constant(application/x-www-form-urlencoded))
.setHeader(Exchange.HTTP_METHOD, constant(GET))
.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
 constant(Boolean.TRUE))
.setHeader(Exchange.HTTP_PATH, simple(${header.httpPath}))
.setHeader(Exchange.HTTP_QUERY,
simple(getURIComponentQuery()))
.to(endpoint);
}
 ...


 The rest service returns an xml document. I don't have the xsd for it
 so would like to set the type of the response to String via
 convertBodyTo(String.class).

 But once I do this, producerTemplate.requestBodyAndHeaders(null,
 headers) returns a String object. So I lose the status code.

 Noting converting it to string will let me access the status code but
 then I no longer have the text body available.

 Any idea how to get both the status code and the text body properly?

 Thanks a 

Re: MockEndpoint expectedBodiesReceived should handle duplicates

2012-07-23 Thread Christian Müller
Thanks for reporting William!

Do you consider to raise an JIRA [1] and attach your patch?

[1] https://issues.apache.org/jira/browse/CAMEL

Best,
Christian

On Mon, Jul 23, 2012 at 10:24 PM, wjmcdonald 
william.mcdon...@transcentra.com wrote:

 When trying to test bodies received like:
 mock.expectedBodiesReceivedInAnyOrder(10, 40, 30,
 20, 40);

 The assertMockEndpointsSatisfied() fails because it does not allow
 duplicate
 items in the list (eg. two 40).

 There is nothing in the javadoc headers that describes the contract these
 methods have (ie. duplicates allowed or not).  However, I believe that
 duplicate message bodies allowed is the correct way it should work.

 Looking at the implementation, the family of expectedBodiesReceivedxxx()
 use
 a Set which doesn't allow duplicate items.  The following change to a
 Multiset fixes the problem.  I don't know if it is threadsafe.

 (Also, in general, I don't like using 'remove' from collection classes in
 an
 iteration as a way of counting things, etc.  I'd prefer an empty container
 that you add to, rather than one that you subtract from.  Perhaps modern
 Java doesn't have any problems with 'remove()' in a loop anymore, or in
 this
 situation since its not using an Iterator.)

 import com.google.common.collect.HashMultiset;
 import com.google.common.collect.Multiset;

   /**
  * Adds an expectation that the given body values are received by this
  * endpoint in any order
  */
 public void expectedBodiesReceivedInAnyOrder(final List? bodies) {
 expectedMessageCount(bodies.size());
 this.expectedBodyValues = bodies;
 this.actualBodyValues = new ArrayList();

 expects(new Runnable() {
 public void run() {
  /* These two lines changed */
 Multiset actualBodyValuesSet = HashMultiset.create();
 actualBodyValuesSet.addAll(actualBodyValues);
 for (int i = 0; i  expectedBodyValues.size(); i++) {
 Exchange exchange = getReceivedExchange(i);
 assertTrue(No exchange received for counter:  + i,
 exchange != null);

 Object expectedBody = expectedBodyValues.get(i);
 assertTrue(Message with body  + expectedBody
 +  was expected but not found in  +
 actualBodyValuesSet,
 actualBodyValuesSet.remove(expectedBody));
 }
 }
 });
 }

 Can you fix this family of methods to accept duplicates?




 --
 View this message in context:
 http://camel.465427.n5.nabble.com/MockEndpoint-expectedBodiesReceived-should-handle-duplicates-tp5716363.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: CXFRS does not process JSON

2012-07-23 Thread Sergey Beryozkin

On 23/07/12 17:52, hom wrote:

Thanks for the quick reply. I added the transformFeature bean, but it seems
that is has no effect.
I am still getting the same message.
This is what I did in the blueprint context:

blueprint

   bean id=providerRoute class=org.xyz.ProviderRoute/

   bean id=transformFeature
class=org.apache.cxf.feature.StaxTransformFeature
 property name=inTransformElements
map
   entry key=DoItRequest
value={http://www.xyz.org/types}DoItRequest/
/map
 /property
   /bean

  camelContext id=camel xmlns=http://camel.apache.org/schema/blueprint;
 routeBuilder ref=providerRoute /
  /camelContext
/blueprint

Did I miss something?


It's a CXF-specific feature so it needs to bound to either a 
cxfrs:rsServer or jaxrs:endpoint (assuming a camel transport is used), 
using a feature extension.


Cheers, Sergey




--
View this message in context: 
http://camel.465427.n5.nabble.com/CXFRS-does-not-process-JSON-tp5716343p5716352.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com


CamelDestinationOverrideUrl documentation

2012-07-23 Thread ychawla
Hello All,
There is a header that can be set called: CamelDestinationOverrideUrl.  This
is really cool because you can have a single CXF endpoint and set this
header to set to different endpoints that implement this interface.  

For example, you can have 10 endpoints you send to that use the same WSDL
and with a single CXF bean you can set this header in a route dynamically to
send to any of them.

I don't see this feature documented on the WIKI CXF page but it is on the
CXFRS page.  

Can I update the CXF WIKI page with this documentation?

Thanks,
Yogesh





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


Re: CxfRsProducer is not thread safe

2012-07-23 Thread Sergey Beryozkin

Hi
On 23/07/12 17:38, dumi_p wrote:

Hi all,

I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
scenario:

1. Have a CXF rest service deployed
2. Have a proxy CXF rest service over the service above, deployed under the
same Camel instance

It works fine, until I perform requests in parallel. Exception stacktrace is
attached.  http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt
stacktrace.txt

I tried following things in class
org.apache.camel.component.cxf.jaxrs.CxfRsProducer order to fix it:
1. Invoked JAXRSClientFactoryBean.setThreadSafe(true), with no success
2. Added synchronization point over line WebClient client =
cfb.createWebClient(), from invokeHttpClient method. It works, but
performance dropped on my localhost from 150 requests per second to 10
requests per second, so the fix is not acceptable.

I attach my camel-config.xml - please let me know if additional info is
needed. http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
camel-config.xml

I am not sure if the problem lies in the configuration I performed or in the
cxf-rs component or in cxf itself.

Any idea is appreciated.

Well,I look at the code and see some JAXRSClientFactoryBean cache - 
Willem can you comment on this please ? This looks suspicious.
The trace shows that the thread safety is compromised at the point of 
creating web clients. I can work on a patch - though will take me a bit 
of time to get to it


Dumitru - any chance you can declare jaxrs:client or WebClient [1,2] 
explicitly, with a thread safe flag set and reuse it in the routes 
directly ? That should do it.


Thanks
Sergey

[1] 
http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring
[2] 
http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring 


[2]


Best regards,
Dumitru



--
View this message in context: 
http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html
Sent from the Camel - Users mailing list archive at Nabble.com.




Global onException clause with RouteBuilders

2012-07-23 Thread Matt Narrell
I have a set of Java DSL RouteBuilders with onException clauses at the 
RouteBuilder level, and some per individual routes.  These are bound to the 
CamelContext via Spring DSL routeBuilder ref=/.  Also in the CamelContext 
is a global onException defined.  

My global onException clause is never executed.  Does the global clause work 
with RouteBuilders in this way?  If I move my global exceptions into the 
RouteBuilder, they are caught and handled, but not at the global level.

-matt




Re: How to invoke CXF webservice from processor bean

2012-07-23 Thread Willem Jiang
Yeah, the operationNamespace is needed if the serviceName namespace is not
same with the operationName.


On Tue, Jul 24, 2012 at 2:54 AM, ychawla premiergenerat...@yahoo.comwrote:

 Hi,
 I see that you set the operationName but did you set the
 operationNamespace.

 For example:

 senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
 http://yourOperationNamespace;);

 Try setting that and see if you get the same results.

 Thanks,
 Yogesh



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716360.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: MockEndpoint expectedBodiesReceived should handle duplicates

2012-07-23 Thread Willem Jiang
This issue[1] has been fixed few weeks ago.
[1]https://issues.apache.org/jira/browse/CAMEL-5440

On Tue, Jul 24, 2012 at 5:51 AM, Christian Müller 
christian.muel...@gmail.com wrote:

 Thanks for reporting William!

 Do you consider to raise an JIRA [1] and attach your patch?

 [1] https://issues.apache.org/jira/browse/CAMEL

 Best,
 Christian

 On Mon, Jul 23, 2012 at 10:24 PM, wjmcdonald 
 william.mcdon...@transcentra.com wrote:

  When trying to test bodies received like:
  mock.expectedBodiesReceivedInAnyOrder(10, 40, 30,
  20, 40);
 
  The assertMockEndpointsSatisfied() fails because it does not allow
  duplicate
  items in the list (eg. two 40).
 
  There is nothing in the javadoc headers that describes the contract these
  methods have (ie. duplicates allowed or not).  However, I believe that
  duplicate message bodies allowed is the correct way it should work.
 
  Looking at the implementation, the family of expectedBodiesReceivedxxx()
  use
  a Set which doesn't allow duplicate items.  The following change to a
  Multiset fixes the problem.  I don't know if it is threadsafe.
 
  (Also, in general, I don't like using 'remove' from collection classes in
  an
  iteration as a way of counting things, etc.  I'd prefer an empty
 container
  that you add to, rather than one that you subtract from.  Perhaps modern
  Java doesn't have any problems with 'remove()' in a loop anymore, or in
  this
  situation since its not using an Iterator.)
 
  import com.google.common.collect.HashMultiset;
  import com.google.common.collect.Multiset;
 
/**
   * Adds an expectation that the given body values are received by
 this
   * endpoint in any order
   */
  public void expectedBodiesReceivedInAnyOrder(final List? bodies) {
  expectedMessageCount(bodies.size());
  this.expectedBodyValues = bodies;
  this.actualBodyValues = new ArrayList();
 
  expects(new Runnable() {
  public void run() {
   /* These two lines changed */
  Multiset actualBodyValuesSet = HashMultiset.create();
  actualBodyValuesSet.addAll(actualBodyValues);
  for (int i = 0; i  expectedBodyValues.size(); i++) {
  Exchange exchange = getReceivedExchange(i);
  assertTrue(No exchange received for counter:  + i,
  exchange != null);
 
  Object expectedBody = expectedBodyValues.get(i);
  assertTrue(Message with body  + expectedBody
  +  was expected but not found in  +
  actualBodyValuesSet,
  actualBodyValuesSet.remove(expectedBody));
  }
  }
  });
  }
 
  Can you fix this family of methods to accept duplicates?
 
 
 
 
  --
  View this message in context:
 
 http://camel.465427.n5.nabble.com/MockEndpoint-expectedBodiesReceived-should-handle-duplicates-tp5716363.html
  Sent from the Camel - Users mailing list archive at Nabble.com.
 



Re: How to handle http status code

2012-07-23 Thread Willem Jiang
Here is some tricks for accessing message header and body.
In the Processor, you can access the message body from InMessage, and You
can also set the  OutMessage body and header. If you doen't set the
OutMessage, Camel will take the InMessage as the InMessage for next
processor, otherwise it will take the OutMessage as the InMessage.
If you set the OutMessage body, you should also copy the header of
InMessage to the OutMessage.

On Tue, Jul 24, 2012 at 3:12 AM, bitter geek bitterg...@gmail.com wrote:

 Hi Christoph,

 Thanks for your help!

 I managed to get it to work based on you code with some changes as shown
 below.

 One change is to call process after to(endpoint). The reponse I need
 to handle is that from to(endpoint).
 After this change, the getOut() on exchange returns null, so I have to
 set the body on in. (why is it null?)

 I then create a responseEntity object so the return value from
 requestBodyAndHeaders will have both the status and response text
 ready to use.

 Do you think if this is the right approach to my problem?

 Thanks again!
 
 @Override
 public void configure() throws Exception {
 from(direct:GetCustomer)
 .setHeader(Content-Type,
 constant(application/x-www-form-urlencoded))
 .setHeader(Exchange.HTTP_METHOD, constant(GET))
 .setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
 constant(Boolean.TRUE))
 .setHeader(Exchange.HTTP_PATH,
 simple(${header.httpPath}))
 .setHeader(Exchange.HTTP_QUERY,
 simple(getURIComponentQuery()))
 .to(endpoint)
 .process(new Processor() {
 @Override
 public void process(final Exchange exchange)
 throws Exception {
 int responseCode =
 exchange.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE, int.class);
 String body =
 exchange.getIn().getBody(String.class);
 ResponseEntityString response = new
 ResponseEntityString(body,
 HttpStatus.valueOf(responseCode));
 exchange.getIn().setBody(response);
 }
 });
 }
 //
 The calling code:

 ResponseEntityString response = (ResponseEntityString)
 producerTemplate.requestBodyAndHeaders(null, headers);
 return getDto(response);

 ///


 On 7/23/12, Christoph Emmersberger cemme...@googlemail.com wrote:
  Hi Bing,
 
  simple question, why don't you write e.g. a processor that is configured
 to
  your route. Your route could look like thos:
 
  /** Processor defined as spring bean, e.g. via @Named tag */
  @Inject
  MyHeaderExtractor myHeaderExtractor;
 
  public void configure() throws Exceltion {
from(direct:GetCustomer)
.setHeader(direct:GetCustomer)
// ... continue with your setter to the header
.process(myHeaderExtractor)
.to(endpoint);
  }
 
  Your header extractor can than implement the processor interface which
  forces you to implement a process(Exchange exchange) method.
 
  You could also decide simply using the bean processing capabilities of
 camel
  as an alternative approach.
 
  @Named
  public class MyHeaderExtractor extends Processor {
 
public void process(Exchange exchange) {
exchange.getIn().getHeaders(); // returns the header map
 on the in
  exchange
exchange.getIn().getBody(); // returns the body on the in
 exchange
// Here you can add some specific header extractions for
 whatever you need
  it
exchange.getOut().getHeaders(); // Would give you the out
 header
}
  }
 
  Hope this helps, best regards,
 
  Christoph
 
 
 
  On Jul 23, 2012, at 7:06 PM, bitter geek wrote:
 
  Hi Sergey,
 
  Thanks for the reply.
 
  I'm quite new to Camel. I knew you can get it from the out message but
  how do I access the out message from the code snippet I provided?
 
  I'd like to know what is the best way to access both the status and
  the response message as a string.
 
  On 7/23/12, Sergey Beryozkin sberyoz...@gmail.com wrote:
  Hi
  On 23/07/12 16:43, bitter geek wrote:
  Hi All,
 
  I have a router builder for a rest service with configure override
  like the following:
  ...
  @Override
 public void configure() throws Exception {
 from(direct:GetCustomer)
 .setHeader(Content-Type,
  constant(application/x-www-form-urlencoded))
 .setHeader(Exchange.HTTP_METHOD, constant(GET))
 .setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
  constant(Boolean.TRUE))
 .setHeader(Exchange.HTTP_PATH,
 simple(${header.httpPath}))
 

Re: CxfRsProducer is not thread safe

2012-07-23 Thread Willem Jiang
On Tue, Jul 24, 2012 at 6:16 AM, Sergey Beryozkin sberyoz...@gmail.comwrote:

 Hi

 On 23/07/12 17:38, dumi_p wrote:

 Hi all,

 I am using Camel 2.10.0 deployed on Tomcat 7 and I try to test following
 scenario:

 1. Have a CXF rest service deployed
 2. Have a proxy CXF rest service over the service above, deployed under
 the
 same Camel instance

 It works fine, until I perform requests in parallel. Exception stacktrace
 is
 attached.  http://camel.465427.n5.nabble.**com/file/n5716351/stacktrace.*
 *txt http://camel.465427.n5.nabble.com/file/n5716351/stacktrace.txt
 stacktrace.txt

 I tried following things in class
 org.apache.camel.component.**cxf.jaxrs.CxfRsProducer order to fix it:
 1. Invoked JAXRSClientFactoryBean.**setThreadSafe(true), with no success
 2. Added synchronization point over line WebClient client =
 cfb.createWebClient(), from invokeHttpClient method. It works, but
 performance dropped on my localhost from 150 requests per second to 10
 requests per second, so the fix is not acceptable.

 I attach my camel-config.xml - please let me know if additional info is
 needed. http://camel.465427.n5.nabble.**com/file/n5716351/camel-**
 config.xmlhttp://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
 camel-config.xml

 I am not sure if the problem lies in the configuration I performed or in
 the
 cxf-rs component or in cxf itself.

 Any idea is appreciated.

  Well,I look at the code and see some JAXRSClientFactoryBean cache -
 Willem can you comment on this please ? This looks suspicious.


I don't like the   JAXRSClientFactoryBean cache either, it is used to
create the WebClient if we change the URI per request. Now I just want to
ask if there is a way to override the server address by setting the context
per request in the WebClient.

If So , it could easy for use to resolve the issue.


 The trace shows that the thread safety is compromised at the point of
 creating web clients. I can work on a patch - though will take me a bit of
 time to get to it

 Dumitru - any chance you can declare jaxrs:client or WebClient [1,2]
 explicitly, with a thread safe flag set and reuse it in the routes directly
 ? That should do it.

 Thanks
 Sergey

 [1] http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
 **ConfiguringHTTPclientsinSpringhttp://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringHTTPclientsinSpring
 [2] http://cxf.apache.org/docs/**jax-rs-client-api.html#JAX-**RSClientAPI-
 **ConfiguringproxiesinSpringhttp://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ConfiguringproxiesinSpring
 [2]


  Best regards,
 Dumitru



 --
 View this message in context: http://camel.465427.n5.nabble.**
 com/CxfRsProducer-is-not-**thread-safe-tp5716351.htmlhttp://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





Re: CamelDestinationOverrideUrl documentation

2012-07-23 Thread Willem Jiang
yes, it is support in the camel-cxfrs component. But it is not used in CXF,
 I think we don't need to change the CXF wiki page for it.

On Tue, Jul 24, 2012 at 6:07 AM, ychawla premiergenerat...@yahoo.comwrote:

 Hello All,
 There is a header that can be set called: CamelDestinationOverrideUrl.
  This
 is really cool because you can have a single CXF endpoint and set this
 header to set to different endpoints that implement this interface.

 For example, you can have 10 endpoints you send to that use the same WSDL
 and with a single CXF bean you can set this header in a route dynamically
 to
 send to any of them.

 I don't see this feature documented on the WIKI CXF page but it is on the
 CXFRS page.

 Can I update the CXF WIKI page with this documentation?

 Thanks,
 Yogesh





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



Re: How to invoke CXF webservice from processor bean

2012-07-23 Thread jeyaseelan78
Hi,
I even tried giving 
exchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
http://pas.adapter.service.xyz.abc.XX/;);
but still no luck and it looks like it is just ignoring the headers
completely. it always invokes one specific operation defined in the SEI.
I have the following questions here,
1. In my implementation I am using the cxf endpoint as url , should I be
using the cxf uri instead?
2. While invoking the webservice, should I have to use CxfProducer template
instead of just the producertemplate?

I feel I am running out of options and not clear which one to try. Can you
please provide some example if you have already encountered situation like
mine above. I am breaking my head for post couple weeks, your help would be
highly appreciated.
Thanks for your kind support.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716379.html
Sent from the Camel - Users mailing list archive at Nabble.com.