Get raw string from header without decosing?

2011-08-01 Thread heinrichheine
Hi there,

i have a simple jetty:http endpoint in my route that receives a http-GET
call.
This call contains a parameter message.
This parameter can include some german umlauts which are encoded in
URLEncoding.
Example: 
url request looks like this:
http://1.2.3.4/?message=Keine+g%FCltige+GPS-Daten%21otherparam=helloworld

I've written a Java processor class which reads the message param from the
exchange.in 

String message = exchange.getIn().getHeader(message, String.class);

Something strange is happening here because the result is Keine g?ltige
GPS-Daten!. I assume that somewhere in the camel core routines a decoding
takes place. But it's not doing it right. The ? should be an ü.
How do i prevent camel to do the decoding of the request parameter? Or how
do i tell camel to do the decoding the correct way? 

Thanks in advance

 martin

--
View this message in context: 
http://camel.465427.n5.nabble.com/Get-raw-string-from-header-without-decosing-tp4654493p4654493.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: EIP pattern for blocking messages or delaying messages

2011-08-01 Thread srimin
Hi


using FuseESB- apache-servicemix-4.4.0-fuse-00-43


'myroute'  should be opened from 13.00 to 13:50, but i see the messages are
pumping in every minute
as if there is no routePolicy applied.


myroute.xml looks like this



 bean id=startPolicy
 class=org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy
 property name=routeStartTime value=0 0/10 13 * * ?/
 /bean
 
 camelContext xmlns=http://camel.apache.org/schema/spring;
   route id=r1  startupOrder=1
   from uri=timer://MyTimer?fixedRate=trueamp;period=60s /
   setBody
   constantHell Zombie!/constant
   /setBody
   to uri=activemq:test /
   /route
   route id=myroute startupOrder=2  routePolicyRef=startPolicy
   from uri=activemq:test /
   to uri=file:///tmp/tests /
   /route
 /camelContext
 
 


It seems i'm doing something stupid here.




--
View this message in context: 
http://camel.465427.n5.nabble.com/EIP-pattern-for-blocking-messages-or-delaying-messages-tp4599813p4654580.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Route does not shut down if there is no message on poll.

2011-08-01 Thread cwhistler
I think I have this worked out now.  I found the PollingConsumerPollStrategy
interface so I created an EmptyPollStrategy class.  I changed the begin()
method to simply return true.  In the commit() method I checked the
numberPolled parameter and if it is 0 then I just stop the consumer.  I left
the rollback() method unchanged.

public boolean begin(Consumer consumer, Endpoint endpoint)
{
return true;
}

public void commit(Consumer consumer, Endpoint endpoint, int numberPolled)
{
if (numberPolled == 0)
{
try
{
consumer.stop();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

public boolean rollback(Consumer arg0, Endpoint arg1, int arg2, Exception
arg3) throws Exception
{
// TODO Auto-generated method stub
return false;
}


OK so to run my route only at 9:35 every day I have setup the route as
follows.  The references to the filters and processors are all wired up with
Spring.

I created the StopRouteProcessor to stop the route when it has read all of
the files that were initially polled.

The .noAutoStartup() seemed to be required as the route always started with
camel and then at the scheduled time.

CronScheduledRoutePolicy policy = new CronScheduledRoutePolicy();
policy.setRouteStartTime(0 35 9 * * ?);

from(file://test/input?preMove=inprogresspollStrategy=#emptyPollStrategydelete=truefilter=#errorFileFilter)
.routePolicy(policy)
.noAutoStartup()
.routeId(timedroute)
.processRef(addHeadersProcessor)
.to(file://test/output)
.onCompletion().process(new StopRouteProcessor(timedroute).end()
;

The only problem I'm seeing now is when I have to schedule this route to run
more than once.  So for example I want 9:35 and then again at 11:35.  By
letting Spring wire up the EmptyPollStrategy, it is only effective with the
first scheduled execution.  It never runs on the 2nd schedule.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Route-does-not-shut-down-if-there-is-no-message-on-poll-tp476108p4654806.html
Sent from the Camel - Users mailing list archive at Nabble.com.


AW: Get raw string from header without decosing?

2011-08-01 Thread heinrichheine
An addition:

The resulting string is not Keine g?ltige GPS-Daten! but Keine g?tige 
GPS-Daten!. The „l“ is missing. I think the decoding has eaten it.

Von: Christian Mueller [via Camel] 
[mailto:ml-node+4654840-686073351-230...@n5.nabble.com]
Gesendet: Montag, 1. August 2011 13:57
An: Heinemann, Martin
Betreff: Re: Get raw string from header without decosing?

I will have a look on it later. But may be the header is set with a
different encoding then you/Camel uses (UTF-8 vs. ISO-8859-1)?

Best,
Christian

Sent from a mobile device
Am 01.08.2011 11:43 schrieb heinrichheine [hidden 
email]/user/SendEmail.jtp?type=nodenode=4654840i=0:

 Hi there,

 i have a simple jetty:http endpoint in my route that receives a http-GET
 call.
 This call contains a parameter message.
 This parameter can include some german umlauts which are encoded in
 URLEncoding.
 Example:
 url request looks like this:
 http://1.2.3.4/?message=Keine+g%FCltige+GPS-Daten%21otherparam=helloworld

 I've written a Java processor class which reads the message param from the
 exchange.in

 String message = exchange.getIn().getHeader(message, String.class);

 Something strange is happening here because the result is Keine g?ltige
 GPS-Daten!. I assume that somewhere in the camel core routines a decoding
 takes place. But it's not doing it right. The ? should be an ü.
 How do i prevent camel to do the decoding of the request parameter? Or how
 do i tell camel to do the decoding the correct way?

 Thanks in advance

 martin

 --
 View this message in context:
http://camel.465427.n5.nabble.com/Get-raw-string-from-header-without-decosing-tp4654493p4654493.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/Get-raw-string-from-header-without-decosing-tp4654493p4654840.html
To unsubscribe from Get raw string from header without decosing?, click 
herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4654493code=bWFydGluLmhlaW5lbWFubkB2aXRhcGhvbmUuZGV8NDY1NDQ5M3wtMTk5MzY2MzcxMw==.


Hinweis: Diese Email enthält evtl. vertrauliche und rechtlich geschützte
Informationen. Sollten Sie nicht der richtige Adressat sein oder diese
Email irrtümlich erhalten haben, informieren Sie bitte sofort den Absender,
und löschen Sie anschließend diese E-Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe des Inhalts dieser Email sind nicht gestattet.

Attention: This e-mail may contain confidential and/or privileged
information. If you are not the intended recipient or if you have received
this e-mail in error, please notify the sender immediately and delete this
e-mail. Any unauthorized copying, disclosure or distribution of the
contents of this e-mail is strictly prohibited.


--
View this message in context: 
http://camel.465427.n5.nabble.com/Get-raw-string-from-header-without-decosing-tp4654493p4654855.html
Sent from the Camel - Users mailing list archive at Nabble.com.

To set client authentication false in SSL communication using Camel-netty 2.6

2011-08-01 Thread Sachin
Hi,

Is there any specific reason to hard code the client authentication to true.
In SSLEngineFactory class i found below:
 serverEngine.setNeedClientAuth(true);

I have a specific requirement to send message from a java client which i
need not to be authenticated.
Please suggest if it's possible.

Regards
Sachin

--
View this message in context: 
http://camel.465427.n5.nabble.com/To-set-client-authentication-false-in-SSL-communication-using-Camel-netty-2-6-tp4654878p4654878.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Remote Write and Read

2011-08-01 Thread Gnanaguru S
Hi,

In the following code i am working with the files in my local machine. If i
want to read or write from remote machine or from some other node in the
network. What should i do.

Eg: to uri=activemq:queue:inputQueue/ i want to write into the
inputqueue which is present with the ip 10.200.208.129

?xml version=1.0 encoding=UTF-8?
blueprint
 xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=
   http://www.osgi.org/xmlns/blueprint/v1.0.0
   http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;
 camelContext xmlns=http://camel.apache.org/schema/blueprint;
trace=true
 
  route   
 
  from uri=file://inputdir//
  to uri=activemq:queue:inputQueue/
/route
   
route 
from uri=activemq:queue:inputQueue/
to
uri=xslt:file:C:\ESB\Fuse_ESB_4.4\apache-servicemix-4.4.0-fuse-00-27\design.xsl/
to uri=activemq:queue:outputQueue/
/route
 route
 from uri=activemq:queue:outputQueue/

  to uri=file:outputdir?fileName=output.xml/   
/route

 
 /camelContext
/blueprint 


Help out

Cheers
Guru 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Remote-Write-and-Read-tp4654906p4654906.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Remote Write and Read

2011-08-01 Thread Claus Ibsen
Hi

You need to setup your activemq component as documented here
http://camel.apache.org/activemq

Basically more or less just this

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

Where the brokerURL points to the remote ActiveMQ broker.


On Mon, Aug 1, 2011 at 2:31 PM, Gnanaguru S
gnanaguru.sattanat...@wipro.com wrote:
 Hi,

 In the following code i am working with the files in my local machine. If i
 want to read or write from remote machine or from some other node in the
 network. What should i do.

 Eg: to uri=activemq:queue:inputQueue/ i want to write into the
 inputqueue which is present with the ip 10.200.208.129

 ?xml version=1.0 encoding=UTF-8?
 blueprint
     xmlns=http://www.osgi.org/xmlns/blueprint/v1.0.0;
     xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
     xsi:schemaLocation=
       http://www.osgi.org/xmlns/blueprint/v1.0.0
       http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;
     camelContext xmlns=http://camel.apache.org/schema/blueprint;
 trace=true

          route

                  from uri=file://inputdir//
                  to uri=activemq:queue:inputQueue/
        /route

            route
                    from uri=activemq:queue:inputQueue/
                    to
 uri=xslt:file:C:\ESB\Fuse_ESB_4.4\apache-servicemix-4.4.0-fuse-00-27\design.xsl/
                    to uri=activemq:queue:outputQueue/
        /route
         route
                 from uri=activemq:queue:outputQueue/

  to uri=file:outputdir?fileName=output.xml/
        /route


     /camelContext
 /blueprint


 Help out

 Cheers
 Guru

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Remote-Write-and-Read-tp4654906p4654906.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.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: EIP pattern for blocking messages or delaying messages

2011-08-01 Thread Willem Jiang

How do you stop the route ?
The myroute route will keep running until you stop the route from the 
camel context.

On 8/1/11 6:10 PM, srimin wrote:

Hi


using FuseESB- apache-servicemix-4.4.0-fuse-00-43


'myroute'  should be opened from 13.00 to 13:50, but i see the messages are
pumping in every minute
as if there is no routePolicy applied.


myroute.xml looks like this




bean id=startPolicy
class=org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy
 property name=routeStartTime value=0 0/10 13 * * ?/
/bean

camelContext xmlns=http://camel.apache.org/schema/spring;
route id=r1  startupOrder=1
from uri=timer://MyTimer?fixedRate=trueamp;period=60s /
setBody
constantHell Zombie!/constant
/setBody
to uri=activemq:test /
/route
   route id=myroute startupOrder=2  routePolicyRef=startPolicy
from uri=activemq:test /
to uri=file:///tmp/tests /
   /route
/camelContext





It seems i'm doing something stupid here.




--
View this message in context: 
http://camel.465427.n5.nabble.com/EIP-pattern-for-blocking-messages-or-delaying-messages-tp4599813p4654580.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


cxf bean exposed via camel

2011-08-01 Thread Marcin Cylke

Hi

I'm trying to expose cxf service bean via cxf-camel transport. Basically 
I want my bean to be accessible via JBI in Servicemix 4 - some other 
services refer this service by jbi endpoints. Theses services are also 
camel routers.


Unfortunatelly the whole setup fails, the cxf bean never receives the 
request.


I'm using Camel 2.6 with servicemix 4.3 Fuse.

I have the following config:

#v+
beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:pc=http://some.endpoint.com;
   xmlns:cxf=http://camel.apache.org/schema/cxf;
   xmlns:camel=http://camel.apache.org/schema/spring;
   xmlns:jaxws=http://cxf.apache.org/jaxws;
   xmlns:cxfse=http://servicemix.apache.org/cxfse/1.0;
   xsi:schemaLocation=http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
   http://cxf.apache.org/jaxws 
http://cxf.apache.org/schemas/jaxws.xsd
   http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
   http://servicemix.apache.org/cxfse/1.0 
http://servicemix.apache.org/schema/servicemix-cxf-se-2009.01.xsd;



  import resource=classpath:META-INF/cxf/cxf.xml /
  import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /

  import resource=dao-context.xml/

bean class=org.apache.servicemix.common.osgi.EndpointExporter /


bean 
class=org.apache.camel.component.cxf.transport.CamelTransportFactory

  property name=bus ref=cxf /
  property name=camelContext ref=camelContext /
  property name=checkException value=true /
  property name=transportIds
list
  valuehttp://cxf.apache.org/transports/camel/value
/list
  /property
/bean

jaxws:endpoint
id=PCService
address=camel://direct:PCService
endpointName=default serviceName=pc:PCService-1
implementor=pl.service.PCServiceImpl
jaxws:features
logging xmlns=http://cxf.apache.org/core; /
/jaxws:features
/jaxws:endpoint

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

route
from 
uri=jbi:service:http://some.endpoint.com/Endpoint-1/default; /

to uri=direct:PCService /
/route
/camel:camelContext


/beans
#v-

Thanks in advance for any assistance.

Marcin


Re: Remote Write and Read

2011-08-01 Thread Gnanaguru S

Hi Thanks. 

By the way. i want to do the same between two different fuse runninf in same
machin or between two machines. Like clusters. What is the solution in that
way. 

Cheers
Guru

--
View this message in context: 
http://camel.465427.n5.nabble.com/Remote-Write-and-Read-tp4654906p4655016.html
Sent from the Camel - Users mailing list archive at Nabble.com.


using enums...

2011-08-01 Thread nizhnegorskiy
Hi,

Can you tell me please, how do I use enum with Camel?
F.e. I have something like this:
public class Profile{
public ArrayListDays daypart_targets;

public enum Days {
MONDAY(monday),
TUESDAY(tuesday);

private Days(String name) {
this.name = name;
}

private final String name;

@Override
public String toString() {
return name;
}
}
}
//...
context.addRoutes(new RouteBuilder() {
public void configure() {
JacksonDataFormat jacksonDataFormat = new 
JacksonDataFormat();
ObjectMapper objectMapper = 
jacksonDataFormat.getObjectMapper();
   
objectMapper.getDeserializationConfig().set(DeserializationConfig.Feature.READ_ENUMS_USING_TO_STRING,
true);


from(direct:testProfile)
.marshal().json(JsonLibrary.Jackson)
.to(file:///home/kirill/tmp)
;
}   

// ...
p.daypart_targets = new ArrayListProfile.Days();
p.daypart_targets.add(Profile.Days.MONDAY);
p.daypart_targets.add(Profile.Days.TUESDAY);
pt.requestBody(direct:testProfile, p);
How do I use this jacksonDataFormat? Is this the right way? Thanks in
advance!

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


Re: cxf bean exposed via camel

2011-08-01 Thread Willem Jiang

I cannot tell any thing is wrong from your configuration.
Can you double check the JBI endpoint uri[1] to make sure you servicemix 
client can access the enpdoint?


BTW, you may need to go through the servicemix log to check if there 
error message which is related to access the JBI endpoint.


Willm
On 8/1/11 9:11 PM, Marcin Cylke wrote:

Hi

I'm trying to expose cxf service bean via cxf-camel transport. Basically
I want my bean to be accessible via JBI in Servicemix 4 - some other
services refer this service by jbi endpoints. Theses services are also
camel routers.

Unfortunatelly the whole setup fails, the cxf bean never receives the
request.

I'm using Camel 2.6 with servicemix 4.3 Fuse.

I have the following config:

#v+
beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:pc=http://some.endpoint.com;
xmlns:cxf=http://camel.apache.org/schema/cxf;
xmlns:camel=http://camel.apache.org/schema/spring;
xmlns:jaxws=http://cxf.apache.org/jaxws;
xmlns:cxfse=http://servicemix.apache.org/cxfse/1.0;
xsi:schemaLocation=http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://servicemix.apache.org/cxfse/1.0
http://servicemix.apache.org/schema/servicemix-cxf-se-2009.01.xsd;


import resource=classpath:META-INF/cxf/cxf.xml /
import resource=classpath:META-INF/cxf/cxf-extension-soap.xml /

import resource=dao-context.xml/

bean class=org.apache.servicemix.common.osgi.EndpointExporter /


bean
class=org.apache.camel.component.cxf.transport.CamelTransportFactory
property name=bus ref=cxf /
property name=camelContext ref=camelContext /
property name=checkException value=true /
property name=transportIds
list
valuehttp://cxf.apache.org/transports/camel/value
/list
/property
/bean

jaxws:endpoint
id=PCService
address=camel://direct:PCService
endpointName=default serviceName=pc:PCService-1
implementor=pl.service.PCServiceImpl
jaxws:features
logging xmlns=http://cxf.apache.org/core; /
/jaxws:features
/jaxws:endpoint

camel:camelContext id=camelContext trace=true
xmlns=http://camel.apache.org/schema/spring;
route
from uri=jbi:service:http://some.endpoint.com/Endpoint-1/default; /
to uri=direct:PCService /
/route
/camel:camelContext


/beans
#v-

Thanks in advance for any assistance.

Marcin




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


Re: Remote Write and Read

2011-08-01 Thread Claus Ibsen
On Mon, Aug 1, 2011 at 3:21 PM, Gnanaguru S
gnanaguru.sattanat...@wipro.com wrote:

 Hi Thanks.

 By the way. i want to do the same between two different fuse runninf in same
 machin or between two machines. Like clusters. What is the solution in that
 way.

You can configure the activemq component to connect to a network of
brokers (clusters).
The brokerURL can for example have X+ number of servers listed.

Check the ActiveMQ documentation.
http://activemq.apache.org/

And FuseSource have a cluster guide as well
http://fusesource.com/products/enterprise-servicemix/#documentation


 Cheers
 Guru

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Remote-Write-and-Read-tp4654906p4655016.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.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: using enums...

2011-08-01 Thread Claus Ibsen
Hi

You should be able to use

marshal(jacksonDataFormat)

To use the data format you have configured.


On Mon, Aug 1, 2011 at 3:45 PM, nizhnegorskiy nizhnegors...@mail.ru wrote:
 Hi,

 Can you tell me please, how do I use enum with Camel?
 F.e. I have something like this:
 public class Profile{
        public ArrayListDays daypart_targets;

        public enum Days {
                MONDAY(monday),
                TUESDAY(tuesday);

                private Days(String name) {
                        this.name = name;
                }

                private final String name;

                @Override
                public String toString() {
                        return name;
                }
        }
 }
 //...
                context.addRoutes(new RouteBuilder() {
                        public void configure() {
                                JacksonDataFormat jacksonDataFormat = new 
 JacksonDataFormat();
                                ObjectMapper objectMapper = 
 jacksonDataFormat.getObjectMapper();

 objectMapper.getDeserializationConfig().set(DeserializationConfig.Feature.READ_ENUMS_USING_TO_STRING,
 true);


                                from(direct:testProfile)
                                .marshal().json(JsonLibrary.Jackson)
                                .to(file:///home/kirill/tmp)
                                ;
                }

 // ...
                p.daypart_targets = new ArrayListProfile.Days();
                p.daypart_targets.add(Profile.Days.MONDAY);
                p.daypart_targets.add(Profile.Days.TUESDAY);
                pt.requestBody(direct:testProfile, p);
 How do I use this jacksonDataFormat? Is this the right way? Thanks in
 advance!

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/using-enums-tp4655056p4655056.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.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


apache came with quartz - no concurrent execution

2011-08-01 Thread dattu.1729
Hi,

I am using camel-quartz component. My use case is Have to merge all
avaliable files for every 5 mins. In this example, I don't want to run
parallel thread.

final FileEndpoint enpoint = (FileEndpoint)endpoint(file:src/ip/ch1);
final RouteBuilder route = new Filecopy(mergeRoute,enpoint);
context.addRoutes(route);
from(quartz://myTimer/myTimerName?cron=5+*+*+*+*+?stateful=true)
.process(new Processor() {
   

@Override
public void process(Exchange exchange) 
throws Exception {
File[] files = 
enpoint.getFile().listFiles();
if(files != null  
files.length  0){

context.startRoute(mergeRoute);
} else {

System.out.println(--No Files--);
}
}

});

Filecopy class is another Route, which will do file merge and oncompletion
will stop Route.

If merging is taking more than 5mins, another Route is starting and merging
files parallel. To stop this parallel processing what i need to do? 



--
View this message in context: 
http://camel.465427.n5.nabble.com/apache-came-with-quartz-no-concurrent-execution-tp4655221p4655221.html
Sent from the Camel - Users mailing list archive at Nabble.com.


maxConcurrentConsumers and idling

2011-08-01 Thread Tommy Chheng
I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
concurrentConsumers=2maxConcurrentConsumers=20

Should the current # of concurrent consumers dynamically adjust due to
message volume from activemq?

At the start, when there are 0 messages, the # of consumers is 2.
When I have a large volume, the # of consumers goes up to 20, but after the
volume goes back to 0, the current # of consumers still remain at 20.

I'm checking the # of consumers using the activemq web console.

Any ideas how to make the # of consumers go back to 2 when there's no
volume?

-- 
@tommychheng
http://tommy.chheng.com


Re: maxConcurrentConsumers and idling

2011-08-01 Thread Claus Ibsen
On Mon, Aug 1, 2011 at 5:12 PM, Tommy Chheng tommy.chh...@gmail.com wrote:
 I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
 concurrentConsumers=2maxConcurrentConsumers=20

 Should the current # of concurrent consumers dynamically adjust due to
 message volume from activemq?

 At the start, when there are 0 messages, the # of consumers is 2.
 When I have a large volume, the # of consumers goes up to 20, but after the
 volume goes back to 0, the current # of consumers still remain at 20.


The threads should have a idel time, that after X period should cause
them to terminate.
Check the spring documentation as its the spring-jms message listener
container, that is used
when consuming messages.


 I'm checking the # of consumers using the activemq web console.

 Any ideas how to make the # of consumers go back to 2 when there's no
 volume?

 --
 @tommychheng
 http://tommy.chheng.com




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


Re: apache came with quartz - no concurrent execution

2011-08-01 Thread Claus Ibsen
Hi

You may want to try the simple trigger instead of cron based, to
indicate a 5 minute gap between tasks.

Or use the timer component instead?
http://camel.apache.org/timer
And use the fixedRate=true option.

On Mon, Aug 1, 2011 at 4:49 PM, dattu.1729 dattu.1...@gmail.com wrote:
 Hi,

 I am using camel-quartz component. My use case is Have to merge all
 avaliable files for every 5 mins. In this example, I don't want to run
 parallel thread.

 final FileEndpoint enpoint = (FileEndpoint)endpoint(file:src/ip/ch1);
 final RouteBuilder route = new Filecopy(mergeRoute,enpoint);
 context.addRoutes(route);
 from(quartz://myTimer/myTimerName?cron=5+*+*+*+*+?stateful=true)
                                .process(new Processor() {


                                        @Override
                                        public void process(Exchange exchange) 
 throws Exception {
                                                File[] files = 
 enpoint.getFile().listFiles();
                                                if(files != null  
 files.length  0){
                                                        
 context.startRoute(mergeRoute);
                                                } else {
                                                        
 System.out.println(--No Files--);
                                                }
                                        }

 });

 Filecopy class is another Route, which will do file merge and oncompletion
 will stop Route.

 If merging is taking more than 5mins, another Route is starting and merging
 files parallel. To stop this parallel processing what i need to do?



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/apache-came-with-quartz-no-concurrent-execution-tp4655221p4655221.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.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: To set client authentication false in SSL communication using Camel-netty 2.6

2011-08-01 Thread Jon Anstey
Most likely this was just the most common configuration used. Setting the
auth required to false is possible though. To do this you'll need to set the
sslHandler property on the producer URI. For example:

...to(netty:tcp://localhost:12345?sslHandler=#myHandler);

You can see how the default SSL handler is created in here
http://svn.apache.org/repos/asf/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java

http://svn.apache.org/repos/asf/camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/DefaultClientPipelineFactory.java
Cheers,
Jon

On Mon, Aug 1, 2011 at 9:43 AM, Sachin sachin2...@gmail.com wrote:

 Hi,

 Is there any specific reason to hard code the client authentication to
 true.
 In SSLEngineFactory class i found below:
  serverEngine.setNeedClientAuth(true);

 I have a specific requirement to send message from a java client which i
 need not to be authenticated.
 Please suggest if it's possible.

 Regards
 Sachin

 --
 View this message in context:
 http://camel.465427.n5.nabble.com/To-set-client-authentication-false-in-SSL-communication-using-Camel-netty-2-6-tp4654878p4654878.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Cheers,
Jon
---
FuseSource
Email: j...@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen


Re: maxConcurrentConsumers and idling

2011-08-01 Thread Tommy Chheng
Looking at
http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html,
it looks like the setting i need is idleConsumerLimit

idleConsumerLimit property specifies the limit on the number of idle
consumers
I think this means that after the message volume decreases, the consumers
will become idle and thus be limited to this parameter.

Unfortunately, I get a Unknown parameters=[{idleConsumerLimit=10}] when i
use it in the activemq connection for camel.

I notice this is parameter is not listed in http://camel.apache.org/jms.html

Is this the right parameter or is there a workaround?


On Mon, Aug 1, 2011 at 8:56 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 On Mon, Aug 1, 2011 at 5:12 PM, Tommy Chheng tommy.chh...@gmail.com
 wrote:
  I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
  concurrentConsumers=2maxConcurrentConsumers=20
 
  Should the current # of concurrent consumers dynamically adjust due to
  message volume from activemq?
 
  At the start, when there are 0 messages, the # of consumers is 2.
  When I have a large volume, the # of consumers goes up to 20, but after
 the
  volume goes back to 0, the current # of consumers still remain at 20.
 

 The threads should have a idel time, that after X period should cause
 them to terminate.
 Check the spring documentation as its the spring-jms message listener
 container, that is used
 when consuming messages.


  I'm checking the # of consumers using the activemq web console.
 
  Any ideas how to make the # of consumers go back to 2 when there's no
  volume?
 
  --
  @tommychheng
  http://tommy.chheng.com
 



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




-- 
@tommychheng
http://tommy.chheng.com


Re: maxConcurrentConsumers and idling

2011-08-01 Thread Jon Anstey
That looks like a new property in Spring 3... we should add that option to
camel-jms but for now you should be able to make your own custom
JmsConfiguration class (extending the Camel JmsConfiguration one) and
override configureMessageListenerContainer to set up your idleConsumerLimit
value. You can use a custom JmsConfiguration like this:

bean id=jmsConfig class=com.foo.MyJmsConfiguration
property name=connectionFactory ref=jmsConnectionFactory/
property name=idleConsumerLimit value=10/
property name=concurrentConsumers value=2/
property name=maxConcurrentConsumers value=20/
/bean

bean id=activemq
class=org.apache.activemq.camel.component.ActiveMQComponent
property name=configuration ref=jmsConfig/
/bean

Cheers,
Jon

On Mon, Aug 1, 2011 at 2:22 PM, Tommy Chheng tommy.chh...@gmail.com wrote:

 Looking at

 http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html
 ,
 it looks like the setting i need is idleConsumerLimit

 idleConsumerLimit property specifies the limit on the number of idle
 consumers
 I think this means that after the message volume decreases, the consumers
 will become idle and thus be limited to this parameter.

 Unfortunately, I get a Unknown parameters=[{idleConsumerLimit=10}] when i
 use it in the activemq connection for camel.

 I notice this is parameter is not listed in
 http://camel.apache.org/jms.html

 Is this the right parameter or is there a workaround?


 On Mon, Aug 1, 2011 at 8:56 AM, Claus Ibsen claus.ib...@gmail.com wrote:

  On Mon, Aug 1, 2011 at 5:12 PM, Tommy Chheng tommy.chh...@gmail.com
  wrote:
   I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
   concurrentConsumers=2maxConcurrentConsumers=20
  
   Should the current # of concurrent consumers dynamically adjust due to
   message volume from activemq?
  
   At the start, when there are 0 messages, the # of consumers is 2.
   When I have a large volume, the # of consumers goes up to 20, but after
  the
   volume goes back to 0, the current # of consumers still remain at 20.
  
 
  The threads should have a idel time, that after X period should cause
  them to terminate.
  Check the spring documentation as its the spring-jms message listener
  container, that is used
  when consuming messages.
 
 
   I'm checking the # of consumers using the activemq web console.
  
   Any ideas how to make the # of consumers go back to 2 when there's no
   volume?
  
   --
   @tommychheng
   http://tommy.chheng.com
  
 
 
 
  --
  Claus Ibsen
  -
  FuseSource
  Email: cib...@fusesource.com
  Web: http://fusesource.com
  Twitter: davsclaus, fusenews
  Blog: http://davsclaus.blogspot.com/
  Author of Camel in Action: http://www.manning.com/ibsen/
 



 --
 @tommychheng
 http://tommy.chheng.com




-- 
Cheers,
Jon
---
FuseSource
Email: j...@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen


Re: maxConcurrentConsumers and idling

2011-08-01 Thread Claus Ibsen
Hi Tommy

Fell free to create a JIRA ticket as I there may be new/missing
options from DMLC that we have not exposed in camel-jms yet.
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html



On Mon, Aug 1, 2011 at 6:52 PM, Tommy Chheng tommy.chh...@gmail.com wrote:
 Looking at
 http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html,
 it looks like the setting i need is idleConsumerLimit

 idleConsumerLimit property specifies the limit on the number of idle
 consumers
 I think this means that after the message volume decreases, the consumers
 will become idle and thus be limited to this parameter.

 Unfortunately, I get a Unknown parameters=[{idleConsumerLimit=10}] when i
 use it in the activemq connection for camel.

 I notice this is parameter is not listed in http://camel.apache.org/jms.html

 Is this the right parameter or is there a workaround?


 On Mon, Aug 1, 2011 at 8:56 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 On Mon, Aug 1, 2011 at 5:12 PM, Tommy Chheng tommy.chh...@gmail.com
 wrote:
  I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
  concurrentConsumers=2maxConcurrentConsumers=20
 
  Should the current # of concurrent consumers dynamically adjust due to
  message volume from activemq?
 
  At the start, when there are 0 messages, the # of consumers is 2.
  When I have a large volume, the # of consumers goes up to 20, but after
 the
  volume goes back to 0, the current # of consumers still remain at 20.
 

 The threads should have a idel time, that after X period should cause
 them to terminate.
 Check the spring documentation as its the spring-jms message listener
 container, that is used
 when consuming messages.


  I'm checking the # of consumers using the activemq web console.
 
  Any ideas how to make the # of consumers go back to 2 when there's no
  volume?
 
  --
  @tommychheng
  http://tommy.chheng.com
 



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




 --
 @tommychheng
 http://tommy.chheng.com




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


Re: maxConcurrentConsumers and idling

2011-08-01 Thread Jon Anstey
FYI idleConsumerLimit will be configurable in the next release of Camel
(2.9) see https://issues.apache.org/jira/browse/CAMEL-4290

On Mon, Aug 1, 2011 at 2:41 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi Tommy

 Fell free to create a JIRA ticket as I there may be new/missing
 options from DMLC that we have not exposed in camel-jms yet.

 http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html



 On Mon, Aug 1, 2011 at 6:52 PM, Tommy Chheng tommy.chh...@gmail.com
 wrote:
  Looking at
 
 http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html
 ,
  it looks like the setting i need is idleConsumerLimit
 
  idleConsumerLimit property specifies the limit on the number of idle
  consumers
  I think this means that after the message volume decreases, the consumers
  will become idle and thus be limited to this parameter.
 
  Unfortunately, I get a Unknown parameters=[{idleConsumerLimit=10}] when i
  use it in the activemq connection for camel.
 
  I notice this is parameter is not listed in
 http://camel.apache.org/jms.html
 
  Is this the right parameter or is there a workaround?
 
 
  On Mon, Aug 1, 2011 at 8:56 AM, Claus Ibsen claus.ib...@gmail.com
 wrote:
 
  On Mon, Aug 1, 2011 at 5:12 PM, Tommy Chheng tommy.chh...@gmail.com
  wrote:
   I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
   concurrentConsumers=2maxConcurrentConsumers=20
  
   Should the current # of concurrent consumers dynamically adjust due to
   message volume from activemq?
  
   At the start, when there are 0 messages, the # of consumers is 2.
   When I have a large volume, the # of consumers goes up to 20, but
 after
  the
   volume goes back to 0, the current # of consumers still remain at 20.
  
 
  The threads should have a idel time, that after X period should cause
  them to terminate.
  Check the spring documentation as its the spring-jms message listener
  container, that is used
  when consuming messages.
 
 
   I'm checking the # of consumers using the activemq web console.
  
   Any ideas how to make the # of consumers go back to 2 when there's no
   volume?
  
   --
   @tommychheng
   http://tommy.chheng.com
  
 
 
 
  --
  Claus Ibsen
  -
  FuseSource
  Email: cib...@fusesource.com
  Web: http://fusesource.com
  Twitter: davsclaus, fusenews
  Blog: http://davsclaus.blogspot.com/
  Author of Camel in Action: http://www.manning.com/ibsen/
 
 
 
 
  --
  @tommychheng
  http://tommy.chheng.com
 



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




-- 
Cheers,
Jon
---
FuseSource
Email: j...@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen


Re: maxConcurrentConsumers and idling

2011-08-01 Thread Tommy Chheng
Thanks Jon,
Upon reading the Spring documentation link, I'm a little confused about
dynamic scaling of consumers.

*There is another parameter IdleTaskExecutionLimit which states it
should close idle resources:*

The default is 1, closing idle resources early once a task didn't receive a
message. This applies to dynamic scheduling only; see the
maxConcurrentConsumershttp://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setMaxConcurrentConsumers(int)
setting.
The minimum number of consumers (see
concurrentConsumershttp://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setConcurrentConsumers(int))
will be kept around until shutdown in any case.


This one is currently supported in camel-jms but even with
concurrentConsumers=2maxConcurrentConsumers=20IdleTaskExecutionLimit=1,
the consumer count stays at 20 after idling  5 minutes.


On Mon, Aug 1, 2011 at 10:40 AM, Jon Anstey jans...@gmail.com wrote:

 FYI idleConsumerLimit will be configurable in the next release of Camel
 (2.9) see https://issues.apache.org/jira/browse/CAMEL-4290

 On Mon, Aug 1, 2011 at 2:41 PM, Claus Ibsen claus.ib...@gmail.com wrote:

  Hi Tommy
 
  Fell free to create a JIRA ticket as I there may be new/missing
  options from DMLC that we have not exposed in camel-jms yet.
 
 
 http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html
 
 
 
  On Mon, Aug 1, 2011 at 6:52 PM, Tommy Chheng tommy.chh...@gmail.com
  wrote:
   Looking at
  
 
 http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html
  ,
   it looks like the setting i need is idleConsumerLimit
  
   idleConsumerLimit property specifies the limit on the number of idle
   consumers
   I think this means that after the message volume decreases, the
 consumers
   will become idle and thus be limited to this parameter.
  
   Unfortunately, I get a Unknown parameters=[{idleConsumerLimit=10}] when
 i
   use it in the activemq connection for camel.
  
   I notice this is parameter is not listed in
  http://camel.apache.org/jms.html
  
   Is this the right parameter or is there a workaround?
  
  
   On Mon, Aug 1, 2011 at 8:56 AM, Claus Ibsen claus.ib...@gmail.com
  wrote:
  
   On Mon, Aug 1, 2011 at 5:12 PM, Tommy Chheng tommy.chh...@gmail.com
   wrote:
I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
concurrentConsumers=2maxConcurrentConsumers=20
   
Should the current # of concurrent consumers dynamically adjust due
 to
message volume from activemq?
   
At the start, when there are 0 messages, the # of consumers is 2.
When I have a large volume, the # of consumers goes up to 20, but
  after
   the
volume goes back to 0, the current # of consumers still remain at
 20.
   
  
   The threads should have a idel time, that after X period should cause
   them to terminate.
   Check the spring documentation as its the spring-jms message listener
   container, that is used
   when consuming messages.
  
  
I'm checking the # of consumers using the activemq web console.
   
Any ideas how to make the # of consumers go back to 2 when there's
 no
volume?
   
--
@tommychheng
http://tommy.chheng.com
   
  
  
  
   --
   Claus Ibsen
   -
   FuseSource
   Email: cib...@fusesource.com
   Web: http://fusesource.com
   Twitter: davsclaus, fusenews
   Blog: http://davsclaus.blogspot.com/
   Author of Camel in Action: http://www.manning.com/ibsen/
  
  
  
  
   --
   @tommychheng
   http://tommy.chheng.com
  
 
 
 
  --
  Claus Ibsen
  -
  FuseSource
  Email: cib...@fusesource.com
  Web: http://fusesource.com
  Twitter: davsclaus, fusenews
  Blog: http://davsclaus.blogspot.com/
  Author of Camel in Action: http://www.manning.com/ibsen/
 



 --
 Cheers,
 Jon
 ---
 FuseSource
 Email: j...@fusesource.com
 Web: fusesource.com
 Twitter: jon_anstey
 Blog: http://janstey.blogspot.com
 Author of Camel in Action: http://manning.com/ibsen




-- 
@tommychheng
http://tommy.chheng.com


Re: Xquery endpoing with Import Module

2011-08-01 Thread David Karlsen
Could it be useful to have an spring implementation which follow their
Resource abstraction?

2011/7/30 jmandawg jmand...@hotmail.com

 It looks like you might be able to do something even simpler by calling
 resolveMandatoryResource from within the ModuleURIResolver.  That way it
 will resolve the import in the same way it resolves the endpoint xquery.



 I can take a shot at writing a patch if you guys want.



 From: J- MAN [mailto:jmand...@hotmail.com]
 Sent: Friday, July 29, 2011 11:29 AM
 To: ml-node+4646571-592493739-235...@n5.nabble.com
 Subject: RE: Xquery endpoing with Import Module



 You are right, after doing more research i discovered that saxon allows you
 to define your own import module URI resolver to resolve the import
 statements.
 All you have to do is implement it a ModuleURIResolver and set it with
 staticQueryContext.setModuleURIResolver.

 http://www.saxonica.com/documentation9.1/javadoc/net/sf/saxon/query/ModuleUR
 IResolver.html

 Can i submit a patch to camel-xquery that will allow urls like this:

                camel:to
 uri=xquery:com/test/xquery/manual.xq?moduleResolver=classpath/

 And then imports will be resolved using absolute classpaths (must include
 leading slash):

              import module namespace utils = myutils at
 /com/test/xquery/utils.xq;

 This should only affect imports inside xquery files.



  _

 Date: Fri, 29 Jul 2011 04:21:37 -0700
 From: ml-node+4646571-592493739-235...@n5.nabble.com
 To: jmand...@hotmail.com
 Subject: Re: Xquery endpoing with Import Module

 camel-saxon will create a input stream to load the xquery file.
 I think it's more like saxon issue, saxon should support to load the
 file from class path.

 On 7/29/11 1:04 AM, jmandawg wrote:


  Hi all,
 
  I'm trying to use an XQuery endpoint which looks like this:
 
  camel:to uri=xquery:com/test/xquery/manual.xq/
 
  Where com/test/xquery/manual.xq is located in my src/main/resources
  folder.
 
  When i try to put an import inside the manual.xq file like this:
 
  import module namespace utils = myutils at utils.xq;
 
  It cannot resolve the file.  If i give it a absolute uri to the file it
 can
  resolve it.  But the files need to live in my package.
 
  I'm running this inside servicemix.
 
  Thanks.
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp46433
 85p4643385.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



  _

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

 http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp46433
 85p4646571.html

 To unsubscribe from Xquery endpoing with Import Module, click here
 http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
 e_by_codenode=4643385code=am1hbmRhd2dAaG90bWFpbC5jb218NDY0MzM4NXwtMTk3Njc2
 ODA4OA== .



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Xquery-endpoing-with-Import-Module-tp4643385p4648515.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen


Re: maxConcurrentConsumers and idling

2011-08-01 Thread Tommy Chheng
Ah, that's the parameter i needed.

Thanks Jon!

On Mon, Aug 1, 2011 at 11:16 AM, Jon Anstey jans...@gmail.com wrote:

 Maybe try setting maxMessagesPerTask to a positive value? Seems to imply
 that this is required here when the feature was introduced:
 https://jira.springsource.org/browse/SPR-2814 I haven't tried this for
 myself though :)

 On Mon, Aug 1, 2011 at 3:19 PM, Tommy Chheng tommy.chh...@gmail.com
 wrote:

  Thanks Jon,
  Upon reading the Spring documentation link, I'm a little confused about
  dynamic scaling of consumers.
 
  *There is another parameter IdleTaskExecutionLimit which states it
  should close idle resources:*
 
  The default is 1, closing idle resources early once a task didn't receive
 a
  message. This applies to dynamic scheduling only; see the
  maxConcurrentConsumers
 
 http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setMaxConcurrentConsumers(int)
  
  setting.
  The minimum number of consumers (see
  concurrentConsumers
 
 http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setConcurrentConsumers(int)
  )
  will be kept around until shutdown in any case.
 
 
  This one is currently supported in camel-jms but even with
  concurrentConsumers=2maxConcurrentConsumers=20IdleTaskExecutionLimit=1,
  the consumer count stays at 20 after idling  5 minutes.
 
 
  On Mon, Aug 1, 2011 at 10:40 AM, Jon Anstey jans...@gmail.com wrote:
 
   FYI idleConsumerLimit will be configurable in the next release of Camel
   (2.9) see https://issues.apache.org/jira/browse/CAMEL-4290
  
   On Mon, Aug 1, 2011 at 2:41 PM, Claus Ibsen claus.ib...@gmail.com
  wrote:
  
Hi Tommy
   
Fell free to create a JIRA ticket as I there may be new/missing
options from DMLC that we have not exposed in camel-jms yet.
   
   
  
 
 http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html
   
   
   
On Mon, Aug 1, 2011 at 6:52 PM, Tommy Chheng tommy.chh...@gmail.com
 
wrote:
 Looking at

   
  
 
 http://bsnyderblog.blogspot.com/2010/05/tuning-jms-message-consumption-in.html
,
 it looks like the setting i need is idleConsumerLimit

 idleConsumerLimit property specifies the limit on the number of
 idle
 consumers
 I think this means that after the message volume decreases, the
   consumers
 will become idle and thus be limited to this parameter.

 Unfortunately, I get a Unknown parameters=[{idleConsumerLimit=10}]
  when
   i
 use it in the activemq connection for camel.

 I notice this is parameter is not listed in
http://camel.apache.org/jms.html

 Is this the right parameter or is there a workaround?


 On Mon, Aug 1, 2011 at 8:56 AM, Claus Ibsen claus.ib...@gmail.com
 
wrote:

 On Mon, Aug 1, 2011 at 5:12 PM, Tommy Chheng 
  tommy.chh...@gmail.com
 wrote:
  I'm using camel 2.7.2 and connecting to an ActiveMQ queue with
  concurrentConsumers=2maxConcurrentConsumers=20
 
  Should the current # of concurrent consumers dynamically adjust
  due
   to
  message volume from activemq?
 
  At the start, when there are 0 messages, the # of consumers is
 2.
  When I have a large volume, the # of consumers goes up to 20,
 but
after
 the
  volume goes back to 0, the current # of consumers still remain
 at
   20.
 

 The threads should have a idel time, that after X period should
  cause
 them to terminate.
 Check the spring documentation as its the spring-jms message
  listener
 container, that is used
 when consuming messages.


  I'm checking the # of consumers using the activemq web console.
 
  Any ideas how to make the # of consumers go back to 2 when
 there's
   no
  volume?
 
  --
  @tommychheng
  http://tommy.chheng.com
 



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




 --
 @tommychheng
 http://tommy.chheng.com

   
   
   
--
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
   
  
  
  
   --
   Cheers,
   Jon
   ---
   FuseSource
   Email: j...@fusesource.com
   Web: fusesource.com
   Twitter: jon_anstey
   Blog: http://janstey.blogspot.com
   Author of Camel in Action: http://manning.com/ibsen
  
 
 
 
  --
  @tommychheng
  http://tommy.chheng.com
 



 --
 Cheers,
 Jon
 

Re: apache came with quartz - no concurrent execution

2011-08-01 Thread Magnus Palmér
In Quartz the first parameter is seconds.
To execute every 5 min cron-style use this cron expression (works for me):
cron=0+0/5+*+*+*+?

Brgds, Magnus Palmér

2011/8/1 dattu.1729 dattu.1...@gmail.com

 Hi,

 I am using camel-quartz component. My use case is Have to merge all
 avaliable files for every 5 mins. In this example, I don't want to run
 parallel thread.

 final FileEndpoint enpoint = (FileEndpoint)endpoint(file:src/ip/ch1);
 final RouteBuilder route = new Filecopy(mergeRoute,enpoint);
 context.addRoutes(route);
 from(quartz://myTimer/myTimerName?cron=5+*+*+*+*+?stateful=true)
.process(new Processor() {


@Override
public void process(Exchange
 exchange) throws Exception {
File[] files =
 enpoint.getFile().listFiles();
if(files != null 
 files.length  0){

  context.startRoute(mergeRoute);
} else {

  System.out.println(--No Files--);
}
}

 });

 Filecopy class is another Route, which will do file merge and oncompletion
 will stop Route.

 If merging is taking more than 5mins, another Route is starting and merging
 files parallel. To stop this parallel processing what i need to do?



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/apache-came-with-quartz-no-concurrent-execution-tp4655221p4655221.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Get raw string from header without decosing?

2011-08-01 Thread Christian Müller
Which version of Camel do you use?
Will have a look into TRUNK (2.9-SNAPSHOT)...

Best,
Christian


Re: Get raw string from header without decosing?

2011-08-01 Thread Christian Müller
Martin, you use the ISO-8859-1 URL encoding, the String Keine gültige
GPS-Daten! is converted to Keine+g%FCltige+GPS-Daten%21.

If you use UTF-8 URL encoding (which is what Jetty use by default), you will
get Keine%20g%C3%BCltige%20GPS-Daten!. And this works well in Camel (I
added a unit test for it [1]). The received header is Keine gültige
GPS-Daten! Is this an option/workaround for you?

I found the following Jetty JIRA issue, where this problem was discussed
[2].

I try to get the test with ISO-8859-1 URL encoding working (at present, it
has the @Ignore annotation), but until now without success. I will give it a
try again tomorrow. It should be possible...

[1] http://svn.apache.org/viewvc?view=revisionrevision=1152948
[2] http://jira.codehaus.org/browse/JETTY-113

Best,
Christian


Re: Route does not shut down if there is no message on poll.

2011-08-01 Thread Willem Jiang

Hi,

Can you check the timedroute route states ?
CronScheduledRoutePolicy  start or resume the route when the route 
status is ready.


ServiceStatus routeStatus = 
route.getRouteContext().getCamelContext().getRouteStatus(route.getId());

if (action == Action.START) {
if (routeStatus == ServiceStatus.Stopped) {
startRoute(route);
} else if (routeStatus == ServiceStatus.Suspended) {
startConsumer(route.getConsumer());
}
}

Willem

On 8/1/11 7:33 PM, cwhistler wrote:

I think I have this worked out now.  I found the PollingConsumerPollStrategy
interface so I created an EmptyPollStrategy class.  I changed the begin()
method to simply return true.  In the commit() method I checked the
numberPolled parameter and if it is 0 then I just stop the consumer.  I left
the rollback() method unchanged.

public boolean begin(Consumer consumer, Endpoint endpoint)
{
 return true;
}

public void commit(Consumer consumer, Endpoint endpoint, int numberPolled)
{
 if (numberPolled == 0)
 {
try
{
consumer.stop();
}
catch(Exception e)
{
e.printStackTrace();
}
 }
}

public boolean rollback(Consumer arg0, Endpoint arg1, int arg2, Exception
arg3) throws Exception
{
 // TODO Auto-generated method stub
 return false;
}


OK so to run my route only at 9:35 every day I have setup the route as
follows.  The references to the filters and processors are all wired up with
Spring.

I created the StopRouteProcessor to stop the route when it has read all of
the files that were initially polled.

The .noAutoStartup() seemed to be required as the route always started with
camel and then at the scheduled time.

CronScheduledRoutePolicy policy = new CronScheduledRoutePolicy();
policy.setRouteStartTime(0 35 9 * * ?);

from(file://test/input?preMove=inprogresspollStrategy=#emptyPollStrategydelete=truefilter=#errorFileFilter)
 .routePolicy(policy)
 .noAutoStartup()
 .routeId(timedroute)
 .processRef(addHeadersProcessor)
 .to(file://test/output)
 .onCompletion().process(new StopRouteProcessor(timedroute).end()
;

The only problem I'm seeing now is when I have to schedule this route to run
more than once.  So for example I want 9:35 and then again at 11:35.  By
letting Spring wire up the EmptyPollStrategy, it is only effective with the
first scheduled execution.  It never runs on the 2nd schedule.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Route-does-not-shut-down-if-there-is-no-message-on-poll-tp476108p4654806.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