Not writing to Error queue

2012-07-25 Thread nishant.rupani
I am usign a router to consume messages from MQ. On exception, I want write
the incoming message to the error queue. However, it is not writing message
to error queue.

For testing, I called a method of a bean on exception and that worked fine.
but it is not publishing the message to error queue.

We are using camel 2.9.0



--
View this message in context: 
http://camel.465427.n5.nabble.com/Not-writing-to-Error-queue-tp5716435.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Not writing to Error queue

2012-07-25 Thread Willem Jiang
How did you setup the DeadLetterQueue ?

On Wed, Jul 25, 2012 at 2:53 PM, nishant.rupani 
nishant.rup...@morganstanley.com wrote:

 I am usign a router to consume messages from MQ. On exception, I want write
 the incoming message to the error queue. However, it is not writing message
 to error queue.

 For testing, I called a method of a bean on exception and that worked fine.
 but it is not publishing the message to error queue.

 We are using camel 2.9.0



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Not-writing-to-Error-queue-tp5716435.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Splitting large binary file into chunks

2012-07-25 Thread sushil_vsk5
Hello:
Is it possible to use the camel splitter in a streaming mode to split a
large binary file (for example an Mp4 file) into fixed sized chunks? Or does
the file always have to be text based?
Regards,
Sushil



--
View this message in context: 
http://camel.465427.n5.nabble.com/Splitting-large-binary-file-into-chunks-tp5716434.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-nmr for camel 2.10

2012-07-25 Thread helander
When reading about the vm component it is described to be asynchronous, so 
it would not fit the request/reply case. Unless you build two separate
paths, one for request and one for reply. Or did I miss something?

/Lars



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


Re: Splitting large binary file into chunks

2012-07-25 Thread Willem Jiang
You use define a customer IteratorFactory to return Iterators for
Splitter to use.

import static org.apache.camel.builder.ExpressionBuilder.beanExpression;
from(direct:streaming)
 .split(beanExpression(new MyCustomIteratorFactory(),  iterator))
 .streaming().to(activemq:my.parts)

Willem

On Wed, Jul 25, 2012 at 2:35 PM, sushil_vsk5 sushil_v...@yahoo.co.in wrote:

 Hello:
 Is it possible to use the camel splitter in a streaming mode to split a
 large binary file (for example an Mp4 file) into fixed sized chunks? Or does
 the file always have to be text based?
 Regards,
 Sushil



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Splitting-large-binary-file-into-chunks-tp5716434.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Rest client

2012-07-25 Thread bitter geek
Hi Sergey,

Can you elaborate on how to use CXF RS endpoint without using the producer?

You help is much appreciated.

Thanks,

Bing

On 7/24/12, Sergey Beryozkin sberyoz...@gmail.com wrote:
 I lost your private email,

 the CXF RS endpoint is safe, only the producer is not right now

 Cheers, Sergey

 On 24/07/12 15:00, Sergey Beryozkin wrote:
 Hi
 On 24/07/12 14:52, bitter geek wrote:
 Hi All,

 I'm a bit confused with the sample code for creating rest endpoint.

 I do not have access to the rest service class but only want to create
 a rest endpoint to use with camel.

 Do I only need to create rsClient tag? If so, what class do I put
 there for serviceClass? Why does it need a serviceClass if this
 endpoint is just used to make an http request?

 I believe this option is there to make a proxy based invocation, for the
 produce/consumes types be derived from specific operations available on
 the service class.

 However, the cxf rs producer is not thread safe right now.
 So I'd recommend you try one of the other Camel HTTP components which
 can make outbound calls till we get it fixed (http, jetty, etc - I'm
 assuming they are thread-safe on the client side), or please experiment
 with embedding direct thread-safe cxf jaxrs/web client references into
 the root

 Sergey

 In addition, how do I get hold of this endpoint in Java?

 Thanks a lot for your help!

 Bing

 /
 !-- Defined the server endpoint to create the cxf-rs consumer --
 cxf:rsServer id=rsServer
 address=http://localhost:${CXFTestSupport.port1}/CxfRsRouterTest/route;
 serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

 loggingFeatureEnabled=true loggingSizeLimit=20/

 !-- Defined the client endpoint to create the cxf-rs consumer --
 cxf:rsClient id=rsClient
 address=http://localhost:${CXFTestSupport.port2}/CxfRsRouterTest/rest;
 serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

 loggingFeatureEnabled=true /




 --
 Sergey Beryozkin

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

 Blog: http://sberyozkin.blogspot.com



Route stops if more than one message is sent

2012-07-25 Thread Alistair Young
I have a route that adds a header to an incoming message and if the
header already exists and is less than a certain value the message is
delayed by 1s and sent back to the original topic. The flow is:

route1 : producer - topicA - consumer
route2: consumer - topicB - check header - delay 1s - topicA

it works fine if I send one message in route1. If I send 2 messages in
route1, route2 stops after the check header stage of the first message
and never sends to topicA.

Is there a config setting I'm missing? I've looked at producer flow
control but can't get the route to take more than one message. Non
transacted routes. I have an errorHandlerRef but it's never called. The
route just stops.

thanks,

Alistair



---
Alistair Young
Senior Software Engineer
UHI@Sabhal Mòr Ostaig


RE: Not writing to Error queue

2012-07-25 Thread nishant.rupani
I tried couple of ways.

1)
onException useOriginalMessage=true
exceptionjava.sql.SQLException/exception
handled
constanttrue/constant
/handled
bean ref=exceptionHandler method=exceptionPrint /
to uri=wmqError:${error.queue} /
/onException


2)
route id=main errorHandlerRef=myDeadLetterErrorHandler
/route

bean id=myDeadLetterErrorHandler 
class=org.apache.camel.builder.DeadLetterChannelBuilder
property name=deadLetterUri value=wmqError:${error.queue} /
property name=redeliveryPolicy ref=myRedeliveryPolicyConfig /
/bean

bean id=myRedeliveryPolicyConfig 
class=org.apache.camel.processor.RedeliveryPolicy
property name=maximumRedeliveries value=1 /
property name=redeliveryDelay value=5 /
/bean



From: Willem.Jiang [via Camel] [mailto:ml-node+s465427n571643...@n5.nabble.com]
Sent: Wednesday, July 25, 2012 1:34 PM
To: Rupani, Nishant (ISGT)
Subject: Re: Not writing to Error queue

How did you setup the DeadLetterQueue ?

On Wed, Jul 25, 2012 at 2:53 PM, nishant.rupani 
[hidden email]/user/SendEmail.jtp?type=nodenode=5716436i=0 wrote:

 I am usign a router to consume messages from MQ. On exception, I want write
 the incoming message to the error queue. However, it is not writing message
 to error queue.

 For testing, I called a method of a bean on exception and that worked fine.
 but it is not publishing the message to error queue.

 We are using camel 2.9.0



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Not-writing-to-Error-queue-tp5716435.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Not-writing-to-Error-queue-tp5716435p5716436.html
To unsubscribe from Not writing to Error queue, click 
herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5716435code=bmlzaGFudC5ydXBhbmlAbW9yZ2Fuc3RhbmxleS5jb218NTcxNjQzNXwtMTA4NDIwMDI5OQ==.
NAMLhttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml

--
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or 
views contained herein are not intended to be, and do not constitute, advice 
within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and 
Consumer Protection Act. If you have received this communication in error, 
please destroy all electronic and paper copies and notify the sender 
immediately. Mistransmission is not intended to waive confidentiality or 
privilege. Morgan Stanley reserves the right, to the extent permitted under 
applicable law, to monitor electronic communications. This message is subject 
to terms available at the following link: 
http://www.morganstanley.com/disclaimers. If you cannot access these links, 
please notify us by reply message and we will send the contents to you. By 
messaging with Morgan Stanley you consent to the foregoing.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Not-writing-to-Error-queue-tp5716435p5716441.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Rest client

2012-07-25 Thread Sergey Beryozkin

On 25/07/12 09:30, bitter geek wrote:

Hi Sergey,

Can you elaborate on how to use CXF RS endpoint without using the producer?



The CXFRS producer is a component built on top of the CXF RS client 
code, however you do not have to use it in order to talk to a RS service 
given the way that service is implemented is not important (could be 
CXFRS on the other end or could be a PHP-based web app),

Here are some links:

http://camel.apache.org/restlet.html
http://camel.apache.org/jetty.html
http://camel.apache.org/http.html

Try one of those (I haven't tried). In meantime we'll work on getting 
the CXFRS client component thread-safe


Sergey


You help is much appreciated.

Thanks,

Bing

On 7/24/12, Sergey Beryozkinsberyoz...@gmail.com  wrote:

I lost your private email,

the CXF RS endpoint is safe, only the producer is not right now

Cheers, Sergey

On 24/07/12 15:00, Sergey Beryozkin wrote:

Hi
On 24/07/12 14:52, bitter geek wrote:

Hi All,

I'm a bit confused with the sample code for creating rest endpoint.

I do not have access to the rest service class but only want to create
a rest endpoint to use with camel.

Do I only need to create rsClient tag? If so, what class do I put
there for serviceClass? Why does it need a serviceClass if this
endpoint is just used to make an http request?


I believe this option is there to make a proxy based invocation, for the
produce/consumes types be derived from specific operations available on
the service class.

However, the cxf rs producer is not thread safe right now.
So I'd recommend you try one of the other Camel HTTP components which
can make outbound calls till we get it fixed (http, jetty, etc - I'm
assuming they are thread-safe on the client side), or please experiment
with embedding direct thread-safe cxf jaxrs/web client references into
the root

Sergey


In addition, how do I get hold of this endpoint in Java?

Thanks a lot for your help!

Bing

/
!-- Defined the server endpoint to create the cxf-rs consumer --
cxf:rsServer id=rsServer
address=http://localhost:${CXFTestSupport.port1}/CxfRsRouterTest/route;
serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

loggingFeatureEnabled=true loggingSizeLimit=20/

!-- Defined the client endpoint to create the cxf-rs consumer --
cxf:rsClient id=rsClient
address=http://localhost:${CXFTestSupport.port2}/CxfRsRouterTest/rest;
serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

loggingFeatureEnabled=true /






--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com




--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com


RE: Not writing to Error queue

2012-07-25 Thread nishant.rupani
I don't see any reference of retry or error queue write in logs. Method 
exceptionPrint is being called fine.

Snippet of my context is -

1)
camel:camelContext id=mainroute 
xmlns=http://camel.apache.org/schema/spring; trace=true

onException useOriginalMessage=true
exceptionjava.sql.SQLException/exception
redeliveryPolicy logRetryAttempted=true 
logRetryStackTrace=true maximumRedeliveries=3
retryAttemptedLogLevel=DEBUG 
retriesExhaustedLogLevel=ERROR /
handled
constanttrue/constant
/handled
bean ref=exceptionHandler 
method=exceptionPrint /
to uri=wmqError:${error.queue} /
/onException

route id=main-router
from uri=wmq:${source.queue} /
camel:bean ref=xmlToBeanProcessor /
recipientList
headerrecipients/header
/recipientList

/route
/camel:camelContext

2)
camel:camelContext id=mainroute 
xmlns=http://camel.apache.org/schema/spring; trace=true

route id=main-router 
errorHandlerRef=myDeadLetterErrorHandler
from uri=wmq:${source.queue} /
camel:bean ref=xmlToBeanProcessor /
recipientList
headerrecipients/header
/recipientList
/route

bean id=myDeadLetterErrorHandler 
class=org.apache.camel.builder.DeadLetterChannelBuilder
property name=deadLetterUri 
value=wmq:${error.queue} /
property name=redeliveryPolicy 
ref=myRedeliveryPolicyConfig /
/bean

bean id=myRedeliveryPolicyConfig 
class=org.apache.camel.processor.RedeliveryPolicy
property name=maximumRedeliveries value=1 /
property name=redeliveryDelay value=1 /
property name=logHandled value=true /
property name=logExhausted value=true /
property name=logContinued value=true /
property name=logRetryAttempted value=true /
property name=logRetryStackTrace value=true /
property name=logStackTrace value=true /
/bean
.
.
.
/camel:camelContext

From: iocanel [via Camel] [mailto:ml-node+s465427n5716444...@n5.nabble.com]
Sent: Wednesday, July 25, 2012 2:46 PM
To: Rupani, Nishant (ISGT)
Subject: Re: Not writing to Error queue

Can you please share your full camel context?
Also do you see anything in the logs?
--
*Ioannis Canellos*
*
FuseSource http://fusesource.com

**
Blog: http://iocanel.blogspot.com
**
Twitter: iocanel
*
Ioannis Canellos http://iocanel.blogspot.com


If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Not-writing-to-Error-queue-tp5716435p5716444.html
To unsubscribe from Not writing to Error queue, click 
herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5716435code=bmlzaGFudC5ydXBhbmlAbW9yZ2Fuc3RhbmxleS5jb218NTcxNjQzNXwtMTA4NDIwMDI5OQ==.
NAMLhttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml

--
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or 
views contained herein are not intended to be, and do not constitute, advice 
within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and 
Consumer Protection Act. If you have received this communication in error, 
please destroy all electronic and paper copies and notify the sender 
immediately. Mistransmission is not intended to waive confidentiality or 
privilege. Morgan Stanley reserves the right, to the extent permitted under 
applicable law, to monitor electronic communications. This message is subject 
to terms available at the following link: 
http://www.morganstanley.com/disclaimers. If you cannot access these links, 
please notify us by reply message and we will send the 

Re: Route stops if more than one message is sent

2012-07-25 Thread Alistair Young
I've removed all routes and now I'm getting random messages disappearing
from the simplest possible route:

excuse the lack of xml format - the email client is the worst in the
world and won't let me send plain text.

route
from uri=activemq:topic:topicA
to uri=activemq:topic:topicB
route

send 10 message, between 3 and 4 disappear and never reach topicB. No
errors logged.

Alistair


---
Alistair Young
Senior Software Engineer
UHI@Sabhal Mòr Ostaig
 Alistair Young  25/07/12 9:52 AM 
I have a route that adds a header to an incoming message and if the
header already exists and is less than a certain value the message is
delayed by 1s and sent back to the original topic. The flow is:

route1 : producer - topicA - consumer
route2: consumer - topicB - check header - delay 1s - topicA

it works fine if I send one message in route1. If I send 2 messages in
route1, route2 stops after the check header stage of the first message
and never sends to topicA.

Is there a config setting I'm missing? I've looked at producer flow
control but can't get the route to take more than one message. Non
transacted routes. I have an errorHandlerRef but it's never called. The
route just stops.

thanks,

Alistair



---
Alistair Young
Senior Software Engineer
UHI@Sabhal Mòr Ostaig



Re: Route stops if more than one message is sent

2012-07-25 Thread Vincent Nonnenmacher
You could use github to post a GIST of your routes DSL and post its URL
here, so you CAN get help.


On Wednesday, July 25, 2012, Alistair Young wrote:

 I've removed all routes and now I'm getting random messages disappearing
 from the simplest possible route:

 excuse the lack of xml format - the email client is the worst in the
 world and won't let me send plain text.

 route
 from uri=activemq:topic:topicA
 to uri=activemq:topic:topicB
 route

 send 10 message, between 3 and 4 disappear and never reach topicB. No
 errors logged.

 Alistair


 ---
 Alistair Young
 Senior Software Engineer
 UHI@Sabhal Mòr Ostaig
  Alistair Young  25/07/12 9:52 AM 
 I have a route that adds a header to an incoming message and if the
 header already exists and is less than a certain value the message is
 delayed by 1s and sent back to the original topic. The flow is:

 route1 : producer - topicA - consumer
 route2: consumer - topicB - check header - delay 1s - topicA

 it works fine if I send one message in route1. If I send 2 messages in
 route1, route2 stops after the check header stage of the first message
 and never sends to topicA.

 Is there a config setting I'm missing? I've looked at producer flow
 control but can't get the route to take more than one message. Non
 transacted routes. I have an errorHandlerRef but it's never called. The
 route just stops.

 thanks,

 Alistair



 ---
 Alistair Young
 Senior Software Engineer
 UHI@Sabhal Mòr Ostaig




Re: Route stops if more than one message is sent

2012-07-25 Thread Alistair Young
good idea! I've tracked the missing messages to transactions. I had
ActiveMQConnectionFactory and ActiveMQComponent both defined in
camel.xml. If I only use ActiveMQConnectionFactory with
JmsTransactionManager the routing works perfectly with transactions
enabled.

I've just run 2 messages through the header checking route and it worked
too. So it seems down to my incomprehension of transactions and why
there were both ActiveMQConnectionFactory and ActiveMQComponent defined.

thanks for listening though.

Alistair


---
Alistair Young
Senior Software Engineer
UHI@Sabhal Mòr Ostaig
 Vincent Nonnenmacher  25/07/12 11:37 AM 
You could use github to post a GIST of your routes DSL and post its URL
here, so you CAN get help.


On Wednesday, July 25, 2012, Alistair Young wrote:

 I've removed all routes and now I'm getting random messages
disappearing
 from the simplest possible route:

 excuse the lack of xml format - the email client is the worst in the
 world and won't let me send plain text.

 route
 from uri=activemq:topic:topicA
 to uri=activemq:topic:topicB
 route

 send 10 message, between 3 and 4 disappear and never reach topicB. No
 errors logged.

 Alistair


 ---
 Alistair Young
 Senior Software Engineer
 UHI@Sabhal Mòr Ostaig
  Alistair Young  25/07/12 9:52 AM 
 I have a route that adds a header to an incoming message and if the
 header already exists and is less than a certain value the message is
 delayed by 1s and sent back to the original topic. The flow is:

 route1 : producer - topicA - consumer
 route2: consumer - topicB - check header - delay 1s - topicA

 it works fine if I send one message in route1. If I send 2 messages in
 route1, route2 stops after the check header stage of the first message
 and never sends to topicA.

 Is there a config setting I'm missing? I've looked at producer flow
 control but can't get the route to take more than one message. Non
 transacted routes. I have an errorHandlerRef but it's never called.
The
 route just stops.

 thanks,

 Alistair



 ---
 Alistair Young
 Senior Software Engineer
 UHI@Sabhal Mòr Ostaig





Re: ExtendedClassNotFoundException PooledConnectionFactory

2012-07-25 Thread Willem Jiang
It looks like you are using OSGi, can you double check if your bundle 
imports the package of org.apache.activemq.pool


On 7/24/12 5:32 PM, m.jimen.blazquez wrote:

Hi!

I am using using camel 2.9.0 with JMS camel component in my application with
ActiveMQ server (works perfectly).

bean id=jms class=org.apache.camel.component.jms.JmsComponent
property name=connectionFactory
bean class=org.apache.activemq.ActiveMQConnectionFactory
property name=brokerURL value=tcp://localhost:61616 
/
/bean
/property
/bean

Now, I would want to use the activemq camel component instead of the JMS
camel component. I configure it like this:

bean id=jms
class=org.apache.activemq.camel.component.ActiveMQComponent
property name=brokerURL value=tcp://localhost:61616 /
/bean

I understand in the documentation that a dependency to the pool connection
factory component is optional, but when I try to start I obtain this error:



org.springframework.web.context.ContextLoader Context
initialization failed org.apache.camel.RuntimeCamelException:
java.lang.RuntimeException: Failed to instantiate PooledConnectionFactory:
org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException:
org.apache.activemq.pool.PooledConnectionFactory in KernelBundleClassLoader:
[bundle=org.apache.activemq.activemq-camel_5.6.0]
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1196)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:122)
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)

I have tried to switch to the 2.10.0 version but maven does not find the jms
component in a higher version than the 2.9.2.

Could someone tell me what I am doing wrong?

kindest regards




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




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


Using ActiveMQConnectionFactory and ActiveMQComponent together

2012-07-25 Thread Alistair Young
I've been following the Camel in Action book which uses
ActiveMQConnectionFactory and ActiveMQComponent in the same camel.xml
for transactions. If I use this config about 80% of messages are lost. I
have to use ActiveMQConnectionFactory and remove ActiveMQComponent. Is
the use of both only for standalone Camel use and only use one when it's
running inside ActiveMQ?

thanks,

Alistair



---
Alistair Young
Senior Software Engineer
UHI@Sabhal Mòr Ostaig


FTP connect issue

2012-07-25 Thread Nafees
Hi All,

I have a Route which gets files from FTP and copies to local folder, and
another route which picks up files and do some processing and the routes
stops when files count reaches ftpserver file count and route will be
removed from camelcontext.

All necessary information will be coming from an Object from ActiveMq and
based on info we create new routes everytime and control them appropriately.

Problem, I am facing is, First time I am running, it shows the no of files
correctly, next time , I run the same route , it shows one file less.

My FTP URL :
{0}://{1}@{2}/{3}?password={4}binary={5}passiveMode=truepollStrategy=#optimerPollthrowExceptionOnConnectFailed=truemaximumReconnectAttempts=0localWorkDirectory=/tmpidempotent=truedisconnect=true

My FILE URL : {0}://{1}?noop=trueautoCreate=false

Routes are :

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

from(fileUrl).to(mediationProcessor).bean(endRoute,stopLocalRoute);

in stopXXX(Exchange exhange){

String strRouteID = exchange.getFromRouteId();

 camelContext.stopRoute(strRouteID, 1000, TimeUnit.MILLISECONDS);
camelContext.getInflightRepository().removeRoute(strRouteID);
camelContext.removeRoute(strRouteID);

}

I am using disconnect = true in FTP options. Why is it showing me one file
less.

Plz help me.

Thanks
Nafees





--
View this message in context: 
http://camel.465427.n5.nabble.com/FTP-connect-issue-tp5716452.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CXFRS does not process JSON

2012-07-25 Thread Sergey Beryozkin

Hi
On 25/07/12 11:12, hom wrote:

In order to configure the JSONProvider, I switched to the server approach:

  jaxrs:server id=providerPOXJSON address=/xyz/json
 jaxrs:serviceBeans
 ref component-id=providerAdapter/
 /jaxrs:serviceBeans
 jaxrs:providers
   ref component-id=jsonProvider /
 /jaxrs:providers
 /jaxrs:server

bean id=providerAdapter class=org.xyz.json.ProviderAdapter/

 bean id=jsonProvider
class=org.apache.cxf.jaxrs.provider.JSONProvider


The complete class name is 
org.apache.cxf.jaxrs.provider.json.JSONProvider in CXF 2.6.1, I can 
see the docs wrongly referring to the old package in a couple of places, 
will get that fixed now.

You'll also need to add
dependency
groupIdorg.apache.cxf/groupId
artifactIdcxf-rt-rs-extension-providers/artifactId
version2.6.1/version
/dependency
dependency
   groupIdorg.codehaus.jettison/groupId
   artifactIdjettison/artifactId
   version1.3.1/version
/dependency


Note in Camel you can do
jaxrs:server id=providerPOXJSON address=camel://direct:xyzJSON

I've also seen a cxfrs rsServer component having a providers element, 
but I haven't tried.


HTH, Sergey


property name=namespaceMap
map
entry key=DoItRequest value={http://xyz/types}DoItRequest/
/map
/property
 /bean

When I deploy this I get the following error:

Caused by: java.lang.ClassNotFoundException:
org.apache.cxf.jaxrs.provider.JSONProvider not found by
org.apache.cxf.cxf-rt-frontend-jaxrs [132]
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)[org.apache.felix.framework-3.0.9.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
at
org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.resolver.WireImpl.getClass(WireImpl.java:99)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.ModuleImpl.searchImports(ModuleImpl.java:1390)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:722)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)[org.apache.felix.framework-3.0.9.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
at
org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1619)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:900)[org.apache.felix.framework-3.0.9.jar:]
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:384)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:381)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:113)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:110)[10:org.apache.aries.blueprint:0.3.1]


It seems that cxf-rt-frontend-jaxrs does not have access to the JSONProvider
class. The bundle does not import the required package.

Do you have an idea how to fix that?



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





Re: Using ActiveMQConnectionFactory and ActiveMQComponent together

2012-07-25 Thread Alistair Young
this is my camel.xml:

https://gist.github.com/3175958

The commented out ActiveMQComponent section for transactions, if used,
causes almost 100% message loss in the 'blackboard' route. I can only
use JmsTransactionManager + ActiveMQConnectionFactory. The commented out
section is from Camel in Action and is also on the camel site but I
can't use it with that route.

Although I have the route working with transactions, I'd really like to
understand why the documentation uses both ActiveMQConnectionFactory and
ActiveMQComponent. That works fine with simple transacted routes but not
with the filter/simple in the route.

any help would be appreciated.

thanks,

Alistair


---
Alistair Young
Senior Software Engineer
UHI@Sabhal Mòr Ostaig
 Alistair Young  25/07/12 12:59 PM 
I've been following the Camel in Action book which uses
ActiveMQConnectionFactory and ActiveMQComponent in the same camel.xml
for transactions. If I use this config about 80% of messages are lost. I
have to use ActiveMQConnectionFactory and remove ActiveMQComponent. Is
the use of both only for standalone Camel use and only use one when it's
running inside ActiveMQ?

thanks,

Alistair



---
Alistair Young
Senior Software Engineer
UHI@Sabhal Mòr Ostaig



Re: CXFRS does not process JSON

2012-07-25 Thread hom

The provider then needs to be registered directly with the rs endpoint

The classloading error is gone now, but I have no idea how register the
jsonprovider with the rs endpoint.
How can this be done?
 



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


Re: CXFRS does not process JSON

2012-07-25 Thread Sergey Beryozkin

Hi
On 25/07/12 16:37, hom wrote:

The journey comes to an end. I managed to create the json endpoint.
It does not use Camel but plain CXF.
This is the final configuration (quite simple actually ;-) ):

 jaxrs:server id=providerPOXJSON address=/xyz/json
 jaxrs:serviceBeans
 ref component-id=providerAdapter/
 /jaxrs:serviceBeans
 jaxrs:providers
   ref component-id=jsonProvider /
 /jaxrs:providers
 /jaxrs:server

 bean id=jsonProvider
class=org.apache.cxf.jaxrs.provider.json.JSONProvider
   property name=inTransformElements
 map
   entry key=* value={http://xyz/types}*/
 /map
   /property
 /bean

 bean id=providerAdapter class=org.xyz.ProviderAdapter/


Thanks for the patience and making it work :-).
I guess we can also use a camel transport URI within 
jaxrs:server/@address; however, I'm interested to see how it can be set 
up with the Camel RS Server component, I'll play a bit later on.


Cheers, Sergey



Thank you very much for your help.

Cheers



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




Re: How to handle http status code

2012-07-25 Thread dunnlow
I handle that with a try/catch block.

http://camel.apache.org/try-catch-finally.html

-J



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-handle-http-status-code-tp5716346p5716470.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel ActiveMQ consumers do not consume after restart

2012-07-25 Thread Marco Zapletal

For producing messages to AMQ, we are using the InOnly pattern only.

The routes in C1 look quite easy, one is consuming from the file system 
and producing to AMQ, the other one is consuming from AMQ and producing 
to the file system.


Within C2, we have now about 20 routes, which basically consume/produce 
from/to a queue and and process messages within beans.


Anyway, it seems that I have solved my problem now: I set the prefetch 
limit to zero on the connection string and all tests have worked since 
then (actually I thought I have tried this before by setting the 
prefetch in the Spring config to 0 ...). Maybe this helps others in the 
future.


Thanks and regards,

Marco


On 23.07.2012 04:07, Willem Jiang wrote:

It could be more easy for us to understand your case by looking at the
routes you have.

On Sat Jul 21 06:40:34 2012, Christian Müller wrote:

Which version of Camel and ActiveMQ do you use?
Which MEP do you use?

Best,
Christian

Sent from a mobile device
Am 20.07.2012 16:26 schrieb Marco Zapletal marco.zaple...@gmail.com:


Hi folks,

We have an application where we have two Camel contexts (C1, C2) which
exchange messages via two queues (Q1, Q2). These queues are located
on the
same ActiveMQ broker. Thereby, the message flow goes as follows:

C1 - Q1 - C2
C2 - Q2 - C1

C2 uses furthermore some internal queues on the AMQ broker, but I
guess
they are not relevant to the problem.

The issue we are facing can be described as follows and happens only
when
C1 or C2 go down or have to be restarted

- In case, no messages are produced of either C1/C2 while the other one
restarts, everything is fine - i.e., there is no problem with consuming
messages

- In case, messages are produced of either C1/C2 and are put in the
respective queue, during the absence of the other Camel application, we
gonna face problems with consuming messages from the queues.
We have especially tested this scenario by stopping C2. C1 produces
messages to Q1. Then we restart C2 again and (almost) nothing happened.

- By almost I mean, that the context of C2 starts up without errors.
What
is also observed is that when we have 1 concurrentConsumer defined in
the
AMQ consumer configuration in C2, 1 message is consumed (if 3
concurrentConsumers are defined, 3 messages are consumed). Afterwards,
consumption stops.

- When restarting C2 again, 1 message is consumed from Q1 (in case of 1
concurrentConsumer)

- C2 exposes also two CXF services as producers of routes. Both of
the two
routes have one of those internal AMQ queues as their final
destination.
When we want to access their respective WSDL URL, the request hangs.

- We have an admin Web application monitoring C2 via JMX. The admin
application hangs due to no response from C2's JMX services (although
the
C2 context starts up properly according to the logs).

- Nothing special can be seen in the logs. We examined the logs on DEBUG
level (on Camel as well as on AMQ side) and nothing special could be
seen.

- We went back to a rather base config. No transactions, no connection
pools, no caching of consumers/producers. We have experimented with the
prefetch (setting it to 1 or even 0) without success.

- In order to reach proper behavior again, Q1/Q2 (and maybe even the
internal queues of C2) have to be purged. Then C2 has be to be
restarted
again. After this procedure, message passing is back to normal.


Sorry for the long post, but I want to describe the problem as
detailed as
possible. Since we have been working on this now for days any help
would be
highly appreciated.


Thanks and best regards,


Marco













Re: CxfRsProducer is not thread safe

2012-07-25 Thread Sergey Beryozkin
As a sanity check I've run the multi-threaded test on the trunk and 
2.9.x due to diff CXF versions being used there, still things work OK.


Dumitru, I've been telling everyone CXF RS producer is broken :-), so 
need your help with reproducing the case. Are you having multiple 
threads running within a route builder itself ? Please provide more info


Sergey
On 25/07/12 14:44, Sergey Beryozkin wrote:

Dumitru,

I'm not seeing in
http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
how the route is initiated, can you provide the source of the updated
org.apache.camel.example.cxf.CamelRoute ?

I've updated one of the tests which Willem created to get 500 threads
stressing the rs client code, can not reproduce the issue

Cheers, Sergey

On 24/07/12 02:45, Willem Jiang wrote:

On Tue, Jul 24, 2012 at 6:16 AM, Sergey
Beryozkinsberyoz...@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.*
*txthttp://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.










Camel SEDA queue size not setting up

2012-07-25 Thread wantastic
Hello all,

I set up the seda endpoint and tried to monitor the status. 
to uri=seda:processMsg?size=100;blockWhenFull=true /
However, when I look at the seda endpoint with jConsole, I see that the size
and blockWhenFull is not set up.

Is this a known bug or am I doing something wrong?

Screenshot:
http://camel.465427.n5.nabble.com/file/n5716474/seda.jpg 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-SEDA-queue-size-not-setting-up-tp5716474.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CxfRsProducer is not thread safe

2012-07-25 Thread dumi_p
Hi Sergey,

Sorry for the late response, I could not work today on the issue - other
things to do :-(. I will reproduce it tomorrow and send you the full code,
together with the JMX for JMeter load test.

Note in my test, with 10 concurrent threads it was failing on more than 20
percent of the requests.

Best regards,
/Dumitru

On Wed, Jul 25, 2012 at 7:41 PM, Sergey Beryozkin-3 [via Camel] 
ml-node+s465427n5716473...@n5.nabble.com wrote:

 As a sanity check I've run the multi-threaded test on the trunk and
 2.9.x due to diff CXF versions being used there, still things work OK.

 Dumitru, I've been telling everyone CXF RS producer is broken :-), so
 need your help with reproducing the case. Are you having multiple
 threads running within a route builder itself ? Please provide more info

 Sergey
 On 25/07/12 14:44, Sergey Beryozkin wrote:

  Dumitru,
 
  I'm not seeing in
  http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
  how the route is initiated, can you provide the source of the updated
  org.apache.camel.example.cxf.CamelRoute ?
 
  I've updated one of the tests which Willem created to get 500 threads
  stressing the rs client code, can not reproduce the issue
 
  Cheers, Sergey
 
  On 24/07/12 02:45, Willem Jiang wrote:
  On Tue, Jul 24, 2012 at 6:16 AM, Sergey
  Beryozkin[hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5716473i=0wrote:

 
  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.*
  *txthttp://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
 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.
 
 
  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-
  **ConfiguringHTTPclientsinSpring
 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
 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
 http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html

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



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

 http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716473.html
  To unsubscribe from CxfRsProducer is not thread safe, click 
 herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5716351code=ZHVtaXRydS5wYXNjdUBnbWFpbC5jb218NTcxNjM1MXwtMTk2Nzc0NjQwNQ==
 .
 

Re: Rest client

2012-07-25 Thread bitter geek
Hi Sergey,

I'm quite new to Camel, still trying to get my head around a few concepts.

How do you create a CXFR producer? Or for that matter, how do you
specify what type of producer to create?

Does this have anything to do with the header
CxfConstants.CAMEL_CXF_RS_USING_HTTP_API as shown below?

Thanks!

Exchange exchange = template.send(direct://proxy, new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOut);
Message inMessage = exchange.getIn();
setupDestinationURL(inMessage);
// set the operation name
inMessage.setHeader(CxfConstants.OPERATION_NAME, getCustomer);
// using the proxy client API
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
Boolean.FALSE);
// set a customer header
inMessage.setHeader(key, value);
// set the parameters , if you just have one parameter
// camel will put this object into an Object[] itself
inMessage.setBody(123);
}
});

On 7/25/12, Sergey Beryozkin sberyoz...@gmail.com wrote:
 On 25/07/12 09:30, bitter geek wrote:
 Hi Sergey,

 Can you elaborate on how to use CXF RS endpoint without using the
 producer?


 The CXFRS producer is a component built on top of the CXF RS client
 code, however you do not have to use it in order to talk to a RS service
 given the way that service is implemented is not important (could be
 CXFRS on the other end or could be a PHP-based web app),
 Here are some links:

 http://camel.apache.org/restlet.html
 http://camel.apache.org/jetty.html
 http://camel.apache.org/http.html

 Try one of those (I haven't tried). In meantime we'll work on getting
 the CXFRS client component thread-safe

 Sergey

 You help is much appreciated.

 Thanks,

 Bing

 On 7/24/12, Sergey Beryozkinsberyoz...@gmail.com  wrote:
 I lost your private email,

 the CXF RS endpoint is safe, only the producer is not right now

 Cheers, Sergey

 On 24/07/12 15:00, Sergey Beryozkin wrote:
 Hi
 On 24/07/12 14:52, bitter geek wrote:
 Hi All,

 I'm a bit confused with the sample code for creating rest endpoint.

 I do not have access to the rest service class but only want to create
 a rest endpoint to use with camel.

 Do I only need to create rsClient tag? If so, what class do I put
 there for serviceClass? Why does it need a serviceClass if this
 endpoint is just used to make an http request?

 I believe this option is there to make a proxy based invocation, for
 the
 produce/consumes types be derived from specific operations available on
 the service class.

 However, the cxf rs producer is not thread safe right now.
 So I'd recommend you try one of the other Camel HTTP components which
 can make outbound calls till we get it fixed (http, jetty, etc - I'm
 assuming they are thread-safe on the client side), or please experiment
 with embedding direct thread-safe cxf jaxrs/web client references into
 the root

 Sergey

 In addition, how do I get hold of this endpoint in Java?

 Thanks a lot for your help!

 Bing

 /
 !-- Defined the server endpoint to create the cxf-rs consumer --
 cxf:rsServer id=rsServer
 address=http://localhost:${CXFTestSupport.port1}/CxfRsRouterTest/route;
 serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

 loggingFeatureEnabled=true loggingSizeLimit=20/

 !-- Defined the client endpoint to create the cxf-rs consumer --
 cxf:rsClient id=rsClient
 address=http://localhost:${CXFTestSupport.port2}/CxfRsRouterTest/rest;
 serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

 loggingFeatureEnabled=true /




 --
 Sergey Beryozkin

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

 Blog: http://sberyozkin.blogspot.com



 --
 Sergey Beryozkin

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

 Blog: http://sberyozkin.blogspot.com



Re: Camel SEDA queue size not setting up

2012-07-25 Thread Babak Vahdat

Hi

While using the XML DSL you should escape the  character with amp;

So can you try with:

to uri=seda:processMsg?size=100amp;blockWhenFull=true /


Babak

Am 25.07.12 20:25 schrieb wantastic unter wan@barclays.com:

Hello all,

I set up the seda endpoint and tried to monitor the status.
to uri=seda:processMsg?size=100;blockWhenFull=true /
However, when I look at the seda endpoint with jConsole, I see that the
size
and blockWhenFull is not set up.

Is this a known bug or am I doing something wrong?

Screenshot:
http://camel.465427.n5.nabble.com/file/n5716474/seda.jpg



--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-SEDA-queue-size-not-setting-up-tp5
716474.html
Sent from the Camel - Users mailing list archive at Nabble.com.




Exception handling in consumer of my custom component

2012-07-25 Thread gilboy
Hi

Assume I have a route which goes:

*from(custom:component).process().to()..etc*

Lets also assume I have an exception/error/retry policy set on this route.
In my custom component consumer I need to invoke something like:
*
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody(socketMessage.getAsString());
getProcessor().process(exchange);
*

Now the call to process requires me to catch an exception. However, I want
exceptions to be handled via the exception handling policy defined in the
route. In other words, I don't want my consumer to have to implement
exception handling logic.

Just wondering how I can get round this

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-handling-in-consumer-of-my-custom-component-tp5716479.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Question regarding SEDA threadpool

2012-07-25 Thread Christian Müller
Hello Wan!

Use the concurrentConsumers option [1].
camelContext
  route
from uri=pns-jms:queue:blahblah?concurrentConsumers=10 /
wireTap uri=dataLogger /
to uri=myValidationProcess /
to uri=myConvertProcess /
  route
/camelContext

[1] http://camel.apache.org/jms.html

Best,
Christian

On Wed, Jul 25, 2012 at 12:40 AM, wantastic wan@barclays.com wrote:

 Hello all,

 I am a beginner of Camel and trying to figure out how to create route
 properly.
 What I'm trying to do is pretty simple. I have a JMS queue listener which
 takes message one by one. Then this message will be logged by WireTap and
 gets thrown into a threadpool(a pool of worker threads) to be processed. My
 first approach was like this:
 camelContext --
 route
 threadPool id=myThreadPool threadName=MyThread poolSize=10
 maxPoolSize=20 maxQueueSize=1000 /
 threadPool id=dataLoggerPool threadName=DataLogger
 poolSize=1
 maxPoolSize=1 maxQueueSize=1000 /

 from uri=pns-jms:queue:blahblah /
 wireTap uri=dataLogger executorServiceRef=dataLoggerPool/
 threads executorServiceRef=myThreadPool
 to uri=myValidationProcess /
 to uri=myConvertProcess /
 /threads
 /camelContext

 However, this turned out to be a wrong implementation since I realized that
 messages are not being distributed to multiple threads concurrently. For
 example, if I'm doing Thread.currentThread.sleep(3000) inside
 myConvertProcess, I see threads are being invoked one at a time, not 10
 threads at the same time. In order to solve this problem, I had to use SEDA
 to send message to the threadpool asynchronously. So my second
 implementation came out like this:

 route
 from uri=pns-jms:queue:blahblah /
 to uri=seda:processMsg?size=1000;blockWhenFull=true /
 /route
 route
 from uri=seda:processMsg /
 threads executorServiceRef=myThreadPool
 to uri=myValidationProcess /
 to uri=myConvertProcess /
 /threads
 /route

 This seems to be working, however, I get two blocking queues, SEDA and
 threadpool, which is not so desirable. Therefore, I decided to go with
 SEDA's concurrentConsumers.

 route
 from uri=pns-jms:queue:blahblah /
 to uri=seda:processMsg?size=1000;blockWhenFull=true /
 /route
 route
 from uri=seda:processMsg?concurrentConsumers=10 /
 to uri=myValidationProcess /
 to uri=myConvertProcess /
 /route

 This seems to be working okay but I came to another question: What if the
 seda queue is full? Will SEDA block from queue to get message when its
 queue
 is full?
 Does anyone have a better suggestion for implementation? It is a simple
 model: get message, throw it into a threadpool to be picked up by a worker
 thread to process it.

 If anyone can give feedback on this, I will be very grateful.

 Thank you,
 Wan




 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Question-regarding-SEDA-threadpool-tp5716431.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Question regarding SEDA threadpool

2012-07-25 Thread wantastic
Christian,
Thank you for your feedback. Unfortunately, I am not able to use
concurrentConsumer because the queue is exclusive and only allow one
consumer. Do you see any other way to use the model that I explained above,
which has one consumer distributing messages to other worker threads to
process messages.

Cheers,
Wan



--
View this message in context: 
http://camel.465427.n5.nabble.com/Question-regarding-SEDA-threadpool-tp5716431p5716481.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-nmr for camel 2.10

2012-07-25 Thread Christian Müller
There is also a synchronous vm component [1].
However, using asynchronous routing has nothing to do with the message
exchange pattern (MEP), e.g. request/reply. Asynchronous means the request
is processed in a separate thread. If you use the inOut MEP
(request/reply), Camel will take care of correlating the request and
response. Try it out!

[1] http://camel.apache.org/direct-vm.html

Best,
Christian

On Wed, Jul 25, 2012 at 2:39 AM, helander leh...@gmail.com wrote:

 When reading about the vm component it is described to be asynchronous, so
 it would not fit the request/reply case. Unless you build two separate
 paths, one for request and one for reply. Or did I miss something?

 /Lars



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



Re: Rest client

2012-07-25 Thread Sergey Beryozkin

Hi
On 25/07/12 20:00, bitter geek wrote:

Hi Sergey,

I'm quite new to Camel, still trying to get my head around a few concepts.



Well, even though a CXFRS component has been around for few years now, I 
haven't had any contributions done, very minor ones, it really works 
thanks to all the work from Willem. Also, I've had a very limited 
exposure to working with Camel recently - I look forward to working with 
it more but to be honest I have to catch up myself too



How do you create a CXFR producer? Or for that matter, how do you
specify what type of producer to create?
This is FAQ, please review the tutorials/books. I believe you typically 
start from something, say from direct:something, if the producer is at 
the top of the route, and they you say 
from(direct:something).to(cxfrs://somebeanOrsomeaddres), etc


Does this have anything to do with the header
CxfConstants.CAMEL_CXF_RS_USING_HTTP_API as shown below?


AFAIK, CxfConstants.CAMEL_CXF_RS_USING_HTTP_API is typically redundant
given it's a default value. It's a CXFRS-specific configuration property 
so it does not affect the way producers are picked up


Cheers, Sergey


Thanks!

Exchange exchange = template.send(direct://proxy, new Processor() {
 public void process(Exchange exchange) throws Exception {
 exchange.setPattern(ExchangePattern.InOut);
 Message inMessage = exchange.getIn();
 setupDestinationURL(inMessage);
 // set the operation name
 inMessage.setHeader(CxfConstants.OPERATION_NAME, getCustomer);
 // using the proxy client API
 inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
Boolean.FALSE);
 // set a customer header
 inMessage.setHeader(key, value);
 // set the parameters , if you just have one parameter
 // camel will put this object into an Object[] itself
 inMessage.setBody(123);
 }
});

On 7/25/12, Sergey Beryozkinsberyoz...@gmail.com  wrote:

On 25/07/12 09:30, bitter geek wrote:

Hi Sergey,

Can you elaborate on how to use CXF RS endpoint without using the
producer?



The CXFRS producer is a component built on top of the CXF RS client
code, however you do not have to use it in order to talk to a RS service
given the way that service is implemented is not important (could be
CXFRS on the other end or could be a PHP-based web app),
Here are some links:

http://camel.apache.org/restlet.html
http://camel.apache.org/jetty.html
http://camel.apache.org/http.html

Try one of those (I haven't tried). In meantime we'll work on getting
the CXFRS client component thread-safe

Sergey


You help is much appreciated.

Thanks,

Bing

On 7/24/12, Sergey Beryozkinsberyoz...@gmail.com   wrote:

I lost your private email,

the CXF RS endpoint is safe, only the producer is not right now

Cheers, Sergey

On 24/07/12 15:00, Sergey Beryozkin wrote:

Hi
On 24/07/12 14:52, bitter geek wrote:

Hi All,

I'm a bit confused with the sample code for creating rest endpoint.

I do not have access to the rest service class but only want to create
a rest endpoint to use with camel.

Do I only need to create rsClient tag? If so, what class do I put
there for serviceClass? Why does it need a serviceClass if this
endpoint is just used to make an http request?


I believe this option is there to make a proxy based invocation, for
the
produce/consumes types be derived from specific operations available on
the service class.

However, the cxf rs producer is not thread safe right now.
So I'd recommend you try one of the other Camel HTTP components which
can make outbound calls till we get it fixed (http, jetty, etc - I'm
assuming they are thread-safe on the client side), or please experiment
with embedding direct thread-safe cxf jaxrs/web client references into
the root

Sergey


In addition, how do I get hold of this endpoint in Java?

Thanks a lot for your help!

Bing

/
!-- Defined the server endpoint to create the cxf-rs consumer --
cxf:rsServer id=rsServer
address=http://localhost:${CXFTestSupport.port1}/CxfRsRouterTest/route;
serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

loggingFeatureEnabled=true loggingSizeLimit=20/

!-- Defined the client endpoint to create the cxf-rs consumer --
cxf:rsClient id=rsClient
address=http://localhost:${CXFTestSupport.port2}/CxfRsRouterTest/rest;
serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

loggingFeatureEnabled=true /






--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com




--
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com



Re: Splitting large binary file into chunks

2012-07-25 Thread Christian Müller
Checkout http://camel.apache.org/splitter.html
I'm not sure whether .streaming() has any effect, if you provide your own
splitter bean...
Your custom splitter bean (the Iterator) could receive the file handle and
use a FileInputStream to read the file content in chunks. For each next()
method call on your Iterator reads one chunk.

Best,
Christian

On Wed, Jul 25, 2012 at 8:35 AM, sushil_vsk5 sushil_v...@yahoo.co.inwrote:

 Hello:
 Is it possible to use the camel splitter in a streaming mode to split a
 large binary file (for example an Mp4 file) into fixed sized chunks? Or
 does
 the file always have to be text based?
 Regards,
 Sushil



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Splitting-large-binary-file-into-chunks-tp5716434.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Not writing to Error queue

2012-07-25 Thread Christian Müller
With MQ, do you mean what? WebSphere MQ (I assume), ActiveMQ, RabittMQ, ...
If you use WebSphere MQ, you have to create the ERROR queue upfront, did
you?

Best,
Christian

On Wed, Jul 25, 2012 at 8:53 AM, nishant.rupani 
nishant.rup...@morganstanley.com wrote:

 I am usign a router to consume messages from MQ. On exception, I want write
 the incoming message to the error queue. However, it is not writing message
 to error queue.

 For testing, I called a method of a bean on exception and that worked fine.
 but it is not publishing the message to error queue.

 We are using camel 2.9.0



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Not-writing-to-Error-queue-tp5716435.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Route stops if more than one message is sent

2012-07-25 Thread Christian Müller
Hello Alistair!

I do not think you found the real issue. But as Vincent already wrote,
without more detailed information, we cannot really help.
I recommend again you should study http://camel.apache.org/support.html

Best,
Christian

On Wed, Jul 25, 2012 at 12:51 PM, Alistair Young
alistair.yo...@uhi.ac.ukwrote:

 good idea! I've tracked the missing messages to transactions. I had
 ActiveMQConnectionFactory and ActiveMQComponent both defined in
 camel.xml. If I only use ActiveMQConnectionFactory with
 JmsTransactionManager the routing works perfectly with transactions
 enabled.

 I've just run 2 messages through the header checking route and it worked
 too. So it seems down to my incomprehension of transactions and why
 there were both ActiveMQConnectionFactory and ActiveMQComponent defined.

 thanks for listening though.

 Alistair


 ---
 Alistair Young
 Senior Software Engineer
 UHI@Sabhal Mòr Ostaig
  Vincent Nonnenmacher  25/07/12 11:37 AM 
 You could use github to post a GIST of your routes DSL and post its URL
 here, so you CAN get help.


 On Wednesday, July 25, 2012, Alistair Young wrote:

  I've removed all routes and now I'm getting random messages
 disappearing
  from the simplest possible route:
 
  excuse the lack of xml format - the email client is the worst in the
  world and won't let me send plain text.
 
  route
  from uri=activemq:topic:topicA
  to uri=activemq:topic:topicB
  route
 
  send 10 message, between 3 and 4 disappear and never reach topicB. No
  errors logged.
 
  Alistair
 
 
  ---
  Alistair Young
  Senior Software Engineer
  UHI@Sabhal Mòr Ostaig
   Alistair Young  25/07/12 9:52 AM 
  I have a route that adds a header to an incoming message and if the
  header already exists and is less than a certain value the message is
  delayed by 1s and sent back to the original topic. The flow is:
 
  route1 : producer - topicA - consumer
  route2: consumer - topicB - check header - delay 1s - topicA
 
  it works fine if I send one message in route1. If I send 2 messages in
  route1, route2 stops after the check header stage of the first message
  and never sends to topicA.
 
  Is there a config setting I'm missing? I've looked at producer flow
  control but can't get the route to take more than one message. Non
  transacted routes. I have an errorHandlerRef but it's never called.
 The
  route just stops.
 
  thanks,
 
  Alistair
 
 
 
  ---
  Alistair Young
  Senior Software Engineer
  UHI@Sabhal Mòr Ostaig
 
 




Re: ClassCastException using cxf:bean

2012-07-25 Thread Christian Müller
Cool you could resolve the issue by yourself.

Best,
Christian

On Wed, Jul 25, 2012 at 1:10 PM, cgiera christoph.gi...@mic-cust.comwrote:

 I've added the synchronized modifier to the RegistryBean.getBean() method
 and
 the problem is fixed for now.
 Hopefully I can upgrade to a newer version of camel in the near future.

 kind regards,
 Christoph



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/ClassCastException-using-cxf-bean-tp5599810p5716454.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: camel-nmr for camel 2.10

2012-07-25 Thread helander
Ok, thanks.

The description of *vm* does not state anything about being able to use in
an osgi container, while the *direct-vm* page is very explicit about this.
My interpretation was that *vm* did not support crossing bundle boundaries.
Whatever the capability is for *vm*, maybe it woul be nice to make that
explicit on the *vm page*.

I will try out *vm *as well.

Thanks

Lars



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


Re: Using ActiveMQConnectionFactory and ActiveMQComponent together

2012-07-25 Thread Christian Müller
Checkout [1].
There is a test which tests JMS transaction in Camel with the configuration
you can find here [2].

[1] https://github.com/muellerc/camel-in-transaction/
[2]
https://github.com/muellerc/camel-in-transaction/blob/master/src/test/resources/META-INF/spring/JmsTransactionSampleTest-context.xml

Best,
Christian

On Wed, Jul 25, 2012 at 2:44 PM, Alistair Young alistair.yo...@uhi.ac.ukwrote:

 this is my camel.xml:

 https://gist.github.com/3175958

 The commented out ActiveMQComponent section for transactions, if used,
 causes almost 100% message loss in the 'blackboard' route. I can only
 use JmsTransactionManager + ActiveMQConnectionFactory. The commented out
 section is from Camel in Action and is also on the camel site but I
 can't use it with that route.

 Although I have the route working with transactions, I'd really like to
 understand why the documentation uses both ActiveMQConnectionFactory and
 ActiveMQComponent. That works fine with simple transacted routes but not
 with the filter/simple in the route.

 any help would be appreciated.

 thanks,

 Alistair


 ---
 Alistair Young
 Senior Software Engineer
 UHI@Sabhal Mòr Ostaig
  Alistair Young  25/07/12 12:59 PM 
 I've been following the Camel in Action book which uses
 ActiveMQConnectionFactory and ActiveMQComponent in the same camel.xml
 for transactions. If I use this config about 80% of messages are lost. I
 have to use ActiveMQConnectionFactory and remove ActiveMQComponent. Is
 the use of both only for standalone Camel use and only use one when it's
 running inside ActiveMQ?

 thanks,

 Alistair



 ---
 Alistair Young
 Senior Software Engineer
 UHI@Sabhal Mòr Ostaig




Re: camel-nmr for camel 2.10

2012-07-25 Thread Christian Müller
All Camel components are designed to run in an OSGI environment.
The cool think with direct-vm is it use the same thread which means both
routes can share the same transaction context (which is not the case with
vm).

Best,
Christian

On Wed, Jul 25, 2012 at 11:43 PM, helander leh...@gmail.com wrote:

 Ok, thanks.

 The description of *vm* does not state anything about being able to use in
 an osgi container, while the *direct-vm* page is very explicit about this.
 My interpretation was that *vm* did not support crossing bundle boundaries.
 Whatever the capability is for *vm*, maybe it woul be nice to make that
 explicit on the *vm page*.

 I will try out *vm *as well.

 Thanks

 Lars



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



Re: Camel ActiveMQ consumers do not consume after restart

2012-07-25 Thread Christian Müller
I don't think this was the issue. But without to know which version of
Camel and ActiveMQ do you use and how your ActiveMQ component is
configured, I cannot help...

Best,
Christian

On Wed, Jul 25, 2012 at 6:22 PM, Marco Zapletal marco.zaple...@gmail.comwrote:

 For producing messages to AMQ, we are using the InOnly pattern only.

 The routes in C1 look quite easy, one is consuming from the file system
 and producing to AMQ, the other one is consuming from AMQ and producing to
 the file system.

 Within C2, we have now about 20 routes, which basically consume/produce
 from/to a queue and and process messages within beans.

 Anyway, it seems that I have solved my problem now: I set the prefetch
 limit to zero on the connection string and all tests have worked since then
 (actually I thought I have tried this before by setting the prefetch in the
 Spring config to 0 ...). Maybe this helps others in the future.

 Thanks and regards,

 Marco



 On 23.07.2012 04:07, Willem Jiang wrote:

 It could be more easy for us to understand your case by looking at the
 routes you have.

 On Sat Jul 21 06:40:34 2012, Christian Müller wrote:

 Which version of Camel and ActiveMQ do you use?
 Which MEP do you use?

 Best,
 Christian

 Sent from a mobile device
 Am 20.07.2012 16:26 schrieb Marco Zapletal marco.zaple...@gmail.com:

  Hi folks,

 We have an application where we have two Camel contexts (C1, C2) which
 exchange messages via two queues (Q1, Q2). These queues are located
 on the
 same ActiveMQ broker. Thereby, the message flow goes as follows:

 C1 - Q1 - C2
 C2 - Q2 - C1

 C2 uses furthermore some internal queues on the AMQ broker, but I
 guess
 they are not relevant to the problem.

 The issue we are facing can be described as follows and happens only
 when
 C1 or C2 go down or have to be restarted

 - In case, no messages are produced of either C1/C2 while the other one
 restarts, everything is fine - i.e., there is no problem with consuming
 messages

 - In case, messages are produced of either C1/C2 and are put in the
 respective queue, during the absence of the other Camel application, we
 gonna face problems with consuming messages from the queues.
 We have especially tested this scenario by stopping C2. C1 produces
 messages to Q1. Then we restart C2 again and (almost) nothing happened.

 - By almost I mean, that the context of C2 starts up without errors.
 What
 is also observed is that when we have 1 concurrentConsumer defined in
 the
 AMQ consumer configuration in C2, 1 message is consumed (if 3
 concurrentConsumers are defined, 3 messages are consumed). Afterwards,
 consumption stops.

 - When restarting C2 again, 1 message is consumed from Q1 (in case of 1
 concurrentConsumer)

 - C2 exposes also two CXF services as producers of routes. Both of
 the two
 routes have one of those internal AMQ queues as their final
 destination.
 When we want to access their respective WSDL URL, the request hangs.

 - We have an admin Web application monitoring C2 via JMX. The admin
 application hangs due to no response from C2's JMX services (although
 the
 C2 context starts up properly according to the logs).

 - Nothing special can be seen in the logs. We examined the logs on DEBUG
 level (on Camel as well as on AMQ side) and nothing special could be
 seen.

 - We went back to a rather base config. No transactions, no connection
 pools, no caching of consumers/producers. We have experimented with the
 prefetch (setting it to 1 or even 0) without success.

 - In order to reach proper behavior again, Q1/Q2 (and maybe even the
 internal queues of C2) have to be purged. Then C2 has be to be
 restarted
 again. After this procedure, message passing is back to normal.


 Sorry for the long post, but I want to describe the problem as
 detailed as
 possible. Since we have been working on this now for days any help
 would be
 highly appreciated.


 Thanks and best regards,


 Marco











Re: Exception handling in consumer of my custom component

2012-07-25 Thread Christian Müller
In your consumer, you could call

getExceptionHandler().handleException(e);

Best,
Christian

On Wed, Jul 25, 2012 at 11:01 PM, gilboy josephoto...@gmail.com wrote:

 Hi

 Assume I have a route which goes:

 *from(custom:component).process().to()..etc*

 Lets also assume I have an exception/error/retry policy set on this route.
 In my custom component consumer I need to invoke something like:
 *
 Exchange exchange = endpoint.createExchange();
 exchange.getIn().setBody(socketMessage.getAsString());
 getProcessor().process(exchange);
 *

 Now the call to process requires me to catch an exception. However, I want
 exceptions to be handled via the exception handling policy defined in the
 route. In other words, I don't want my consumer to have to implement
 exception handling logic.

 Just wondering how I can get round this

 Thanks



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Exception-handling-in-consumer-of-my-custom-component-tp5716479.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: ClassCastException using cxf:bean

2012-07-25 Thread Willem Jiang
Just FYI, I logged a JIRA[1] and committed the patch into camel.

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

On Thu, Jul 26, 2012 at 5:41 AM, Christian Müller
christian.muel...@gmail.com wrote:
 Cool you could resolve the issue by yourself.

 Best,
 Christian

 On Wed, Jul 25, 2012 at 1:10 PM, cgiera christoph.gi...@mic-cust.comwrote:

 I've added the synchronized modifier to the RegistryBean.getBean() method
 and
 the problem is fixed for now.
 Hopefully I can upgrade to a newer version of camel in the near future.

 kind regards,
 Christoph



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/ClassCastException-using-cxf-bean-tp5599810p5716454.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Rest client

2012-07-25 Thread Willem Jiang
Please check out my comments in the mail.

On Thu, Jul 26, 2012 at 3:00 AM, bitter geek bitterg...@gmail.com wrote:
 Hi Sergey,

 I'm quite new to Camel, still trying to get my head around a few concepts.

 How do you create a camel-cxfrs producer? Or for that matter, how do you
 specify what type of producer to create?

You can setup the camel-cxfrs endpoint from Spring configuration which
you already know about it.
Camel will create the producer for you as the definition shows.


 Does this have anything to do with the header
 CxfConstants.CAMEL_CXF_RS_USING_HTTP_API as shown below?

Camel will create the client dynamically per request, and the header
setting will help camel to decide which kind of client it should use.
As Sergey said, the HTTP_API client is used by default, and Camel can
create a proxy type client if you set the header value to be false.


 Thanks!

 Exchange exchange = template.send(direct://proxy, new Processor() {
 public void process(Exchange exchange) throws Exception {
 exchange.setPattern(ExchangePattern.InOut);
 Message inMessage = exchange.getIn();
 setupDestinationURL(inMessage);
 // set the operation name
 inMessage.setHeader(CxfConstants.OPERATION_NAME, getCustomer);
 // using the proxy client API
 inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API,
 Boolean.FALSE);
 // set a customer header
 inMessage.setHeader(key, value);
 // set the parameters , if you just have one parameter
 // camel will put this object into an Object[] itself
 inMessage.setBody(123);
 }
 });

 On 7/25/12, Sergey Beryozkin sberyoz...@gmail.com wrote:
 On 25/07/12 09:30, bitter geek wrote:
 Hi Sergey,

 Can you elaborate on how to use CXF RS endpoint without using the
 producer?


 The CXFRS producer is a component built on top of the CXF RS client
 code, however you do not have to use it in order to talk to a RS service
 given the way that service is implemented is not important (could be
 CXFRS on the other end or could be a PHP-based web app),
 Here are some links:

 http://camel.apache.org/restlet.html
 http://camel.apache.org/jetty.html
 http://camel.apache.org/http.html

 Try one of those (I haven't tried). In meantime we'll work on getting
 the CXFRS client component thread-safe

 Sergey

 You help is much appreciated.

 Thanks,

 Bing

 On 7/24/12, Sergey Beryozkinsberyoz...@gmail.com  wrote:
 I lost your private email,

 the CXF RS endpoint is safe, only the producer is not right now

 Cheers, Sergey

 On 24/07/12 15:00, Sergey Beryozkin wrote:
 Hi
 On 24/07/12 14:52, bitter geek wrote:
 Hi All,

 I'm a bit confused with the sample code for creating rest endpoint.

 I do not have access to the rest service class but only want to create
 a rest endpoint to use with camel.

 Do I only need to create rsClient tag? If so, what class do I put
 there for serviceClass? Why does it need a serviceClass if this
 endpoint is just used to make an http request?

 I believe this option is there to make a proxy based invocation, for
 the
 produce/consumes types be derived from specific operations available on
 the service class.

 However, the cxf rs producer is not thread safe right now.
 So I'd recommend you try one of the other Camel HTTP components which
 can make outbound calls till we get it fixed (http, jetty, etc - I'm
 assuming they are thread-safe on the client side), or please experiment
 with embedding direct thread-safe cxf jaxrs/web client references into
 the root

 Sergey

 In addition, how do I get hold of this endpoint in Java?

 Thanks a lot for your help!

 Bing

 /
 !-- Defined the server endpoint to create the cxf-rs consumer --
 cxf:rsServer id=rsServer
 address=http://localhost:${CXFTestSupport.port1}/CxfRsRouterTest/route;
 serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

 loggingFeatureEnabled=true loggingSizeLimit=20/

 !-- Defined the client endpoint to create the cxf-rs consumer --
 cxf:rsClient id=rsClient
 address=http://localhost:${CXFTestSupport.port2}/CxfRsRouterTest/rest;
 serviceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService

 loggingFeatureEnabled=true /




 --
 Sergey Beryozkin

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

 Blog: http://sberyozkin.blogspot.com



 --
 Sergey Beryozkin

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

 Blog: http://sberyozkin.blogspot.com



Re: Question regarding SEDA threadpool

2012-07-25 Thread Willem Jiang
On Wed, Jul 25, 2012 at 6:40 AM, wantastic wan@barclays.com wrote:
 Hello all,

 I am a beginner of Camel and trying to figure out how to create route
 properly.
 What I'm trying to do is pretty simple. I have a JMS queue listener which
 takes message one by one. Then this message will be logged by WireTap and
 gets thrown into a threadpool(a pool of worker threads) to be processed. My
 first approach was like this:
 camelContext --
 route
 threadPool id=myThreadPool threadName=MyThread poolSize=10
 maxPoolSize=20 maxQueueSize=1000 /
 threadPool id=dataLoggerPool threadName=DataLogger poolSize=1
 maxPoolSize=1 maxQueueSize=1000 /

 from uri=pns-jms:queue:blahblah /
 wireTap uri=dataLogger executorServiceRef=dataLoggerPool/
 threads executorServiceRef=myThreadPool
 to uri=myValidationProcess /
 to uri=myConvertProcess /
 /threads
 /camelContext

 However, this turned out to be a wrong implementation since I realized that
 messages are not being distributed to multiple threads concurrently. For
 example, if I'm doing Thread.currentThread.sleep(3000) inside
 myConvertProcess, I see threads are being invoked one at a time, not 10
 threads at the same time. In order to solve this problem, I had to use SEDA
 to send message to the threadpool asynchronously. So my second
 implementation came out like this:

 route
 from uri=pns-jms:queue:blahblah /
 to uri=seda:processMsg?size=1000;blockWhenFull=true /
 /route
 route
 from uri=seda:processMsg /
 threads executorServiceRef=myThreadPool
 to uri=myValidationProcess /
 to uri=myConvertProcess /
 /threads
 /route

 This seems to be working, however, I get two blocking queues, SEDA and
 threadpool, which is not so desirable. Therefore, I decided to go with
 SEDA's concurrentConsumers.

 route
 from uri=pns-jms:queue:blahblah /
 to uri=seda:processMsg?size=1000;blockWhenFull=true /
 /route
 route
 from uri=seda:processMsg?concurrentConsumers=10 /
 to uri=myValidationProcess /
 to uri=myConvertProcess /
 /route

 This seems to be working okay but I came to another question: What if the
 seda queue is full? Will SEDA block from queue to get message when its queue
 is full?

It's a typical issue of the Queue, you can use the throttler to do the
flow control work.

[1]http://camel.apache.org/throttler.html

 Does anyone have a better suggestion for implementation? It is a simple
 model: get message, throw it into a threadpool to be picked up by a worker
 thread to process it.

Yes, that is the simpler implementation of SEDA.


 If anyone can give feedback on this, I will be very grateful.

 Thank you,
 Wan




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Question-regarding-SEDA-threadpool-tp5716431.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CxfRsProducer is not thread safe

2012-07-25 Thread Willem Jiang
Dumitru do you mind to create a JIRA[1] here.
It will be helpful for us to trace the issue.

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

Willem

On Thu, Jul 26, 2012 at 2:55 AM, dumi_p dumitru.pa...@gmail.com wrote:
 Hi Sergey,

 Sorry for the late response, I could not work today on the issue - other
 things to do :-(. I will reproduce it tomorrow and send you the full code,
 together with the JMX for JMeter load test.

 Note in my test, with 10 concurrent threads it was failing on more than 20
 percent of the requests.

 Best regards,
 /Dumitru

 On Wed, Jul 25, 2012 at 7:41 PM, Sergey Beryozkin-3 [via Camel] 
 ml-node+s465427n5716473...@n5.nabble.com wrote:

 As a sanity check I've run the multi-threaded test on the trunk and
 2.9.x due to diff CXF versions being used there, still things work OK.

 Dumitru, I've been telling everyone CXF RS producer is broken :-), so
 need your help with reproducing the case. Are you having multiple
 threads running within a route builder itself ? Please provide more info

 Sergey
 On 25/07/12 14:44, Sergey Beryozkin wrote:

  Dumitru,
 
  I'm not seeing in
  http://camel.465427.n5.nabble.com/file/n5716351/camel-config.xml
  how the route is initiated, can you provide the source of the updated
  org.apache.camel.example.cxf.CamelRoute ?
 
  I've updated one of the tests which Willem created to get 500 threads
  stressing the rs client code, can not reproduce the issue
 
  Cheers, Sergey
 
  On 24/07/12 02:45, Willem Jiang wrote:
  On Tue, Jul 24, 2012 at 6:16 AM, Sergey
  Beryozkin[hidden 
  email]http://user/SendEmail.jtp?type=nodenode=5716473i=0wrote:

 
  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.*
  *txthttp://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
 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.
 
 
  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-
  **ConfiguringHTTPclientsinSpring
 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
 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
 http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351.html

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



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

 http://camel.465427.n5.nabble.com/CxfRsProducer-is-not-thread-safe-tp5716351p5716473.html
  To unsubscribe from CxfRsProducer is not thread safe, click 
 

Re: Add thread pool configuration for SEDA using xml

2012-07-25 Thread billy ding
Hi Claus,

Thanks for your reply.

So can we conclude, if we use xml configuration for seda, we can't have a
thread pool which can increase/shrink dynamically at runtime, is that right?

Thanks.
Billy



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