Re: Properties in Java DSL

2010-10-30 Thread Claus Ibsen
You should most likely use ref in the location to refer to that OSGi
property stuff.

        


On Fri, Oct 29, 2010 at 6:15 PM, Olivier.Roger  wrote:
>
> It appears that in both cases the Properties Object does not contains any
> entry.
> I use this to load it in the CamelContext.
>
>     location="classpath:properties/endpoints.properties" />
>    
>
>    http://camel.apache.org/schema/spring";
> trace="true">
>         location="classpath:properties/endpoints.properties" />
>
> Am I doing something wrong here ?
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Properties-in-Java-DSL-tp3242156p3242285.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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


Re: MINA component startup error

2010-10-30 Thread Richard Kettelerij

Nevermind it was just a rendering issue with Nabble.

-
Richard Kettelerij,
http://github.com/rkettelerij
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/MINA-component-startup-error-tp3239345p3243295.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: MINA component startup error

2010-10-30 Thread Richard Kettelerij

Shouldn't you escape the '&' characters in your route? That is change it to
'&'.

-
Richard Kettelerij,
http://github.com/rkettelerij
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/MINA-component-startup-error-tp3239345p3243294.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: ftp tempFile Name extension

2010-10-30 Thread Richard Kettelerij

This is possible using the simple language. You can use a date as a suffix,
e.g: tempFileName="somename.${date:now:MMdd}". This is the most easy
solution imho. 

If you don't want to use a date but need a number you can delegate to a
custom bean to generate a number (or you can use an UUID). Example:
tempFileName="somename.${bean:mynumbergenerator.generateid}"

Take a look at http://camel.apache.org/file-language.html

-
Richard Kettelerij,
http://github.com/rkettelerij
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/ftp-tempFile-Name-extension-tp3243271p3243285.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: ftp tempFile Name extension

2010-10-30 Thread Claus Ibsen
On Sat, Oct 30, 2010 at 2:29 PM, Sri  wrote:
>
> Hi All,
>
> I want to use tempFileName=somename.{somenumber} on the FTP URI.  is it
> possible to use it insted of
> tempFileName=somename.tmp
>

Yeah you can use a bean to compute the somenumber.

See here
http://camel.apache.org/file-language.html

The bean:myguidgenerator example

> Regards
> Sri
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/ftp-tempFile-Name-extension-tp3243271p3243271.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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


Re: Creating a Polling JMS consumer in Java DSL route

2010-10-30 Thread Claus Ibsen
On Fri, Oct 29, 2010 at 9:11 PM, Ilya S  wrote:
> I'm on Camel 2.3 with ActiveMQ 5.3.2.
>
> I am working with a set of slow JMS consumers, and I'd like to be able to
> create them as polling consumers in my route defined in Java DSL. Is this
> possible?
> Can anyone show an example?
>
> The reason I want polling jms consumers is because I cannot set "prefetch"
> option to 0 with regular consumers. My understanding is that when I define a
> route as follows:
>

Why not? Ask at AMQ forum what and how you can configure AMQ.

> from("activemq:queue ")
>  ...
>
> Camel creates a JMS consumer. Is there a way to instruct Camel to create a
> polling consumer here?
>

No you cant as the above syntax will create an event driven JMS consumer.

You can use a timer endpoint to trigger the poll at every X interval.
Then you can pollEnrich from a JMS queue to poll a message (which will
use the polling JMS consumer)
http://camel.apache.org/content-enricher.html

> Thank you very much for your help.
>
> Ilya
>



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


ftp tempFile Name extension

2010-10-30 Thread Sri

Hi All,

I want to use tempFileName=somename.{somenumber} on the FTP URI.  is it
possible to use it insted of 
tempFileName=somename.tmp

Regards
Sri
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/ftp-tempFile-Name-extension-tp3243271p3243271.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Simple

2010-10-30 Thread Claus Ibsen
Ad 2)
Try with Camel 2.5 I think its fixed in that version.


On Fri, Oct 29, 2010 at 8:15 PM, simeon667  wrote:
>
>
> Hi there,
>
> I seem to have some basic understanding problem of Simple evaluations and it
> looks like I'm done searching the official docs without any success. Help
> appreciated.
>
> Code:
>
> 1 from("timer://twoSecTimer?fixedRate=true&period=6")
> 2                .to("sql:select * from messages?dataSourceRef=myDS")
> 3                .split(body())
> 4                .to("log:org.apache.camel?level=DEBUG")
> 5                .setHeader("partnerName",
> ExpressionBuilder.simpleExpression("${body[name]}"))
> 6
> .enrich("restlet:http://localhost:8081/PartnerStatus/resources/partnerStatus/{partnerName}?restletMethod=get";,
> new PartnerStatusAggregationStrategy())
> 7                .to("log:org.apache.camel?level=DEBUG");
>
> The query results in an Exchange like this:
>
> Exchange[BodyType:java.util.LinkedHashMap, Body:{id=0, sender=Sting,
> severity=0, message=Desert Rose, received=2010-10-29 13:08:14.0}]
>
> 1. Question: Why does line 5 result in ExpressionIllegalSyntaxException:
> Illegal syntax: body[name]. The body is a map, so why can't I lookup a value
> by [key]?
>
> 2. Question: Why doesn't the Simple expression in line 6
> (...{partnerName}...) get substituted. No matter if I prepend a $ - it
> doesn't. I did fix the issue from Question 1 by putting a constant as a
> header value - no success ...
>
> Thanks in advance!
>
> Best,
> Simeon
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Simple-tp3242568p3242568.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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


Re: Enabling tracing in production

2010-10-30 Thread Bengt Rodehav
Another problem I have is to reconfigure my tracer "on the fly". I was
hoping to use an OSGi configuration to configure my tracer.

My tracer presently extends org.apache.camel.processor.interceptor.Tracer
but allow me to configure the tracer; e g whether or not the body should be
included in the trace or not. I do that as follows:

DefaultTraceFormatter formatter = new DefaultTraceFormatter();

formatter.setShowBody(mIncludeBody);

setFormatter(formatter);


The "mIncludeBody" is taken from an OSGi configuration parameter. I do the
above once in the constructor. That works and my configuration parameter
determines whether the body is included or not.

However, when I later change my configuration, the new value does not seem
to take effect. I can see that the above code is run (with the correct
configuration parameter) but the behavior of the tracer doesn't change
accordingly.

Is it possible to change the formatter of a tracer after it has been
constructed?

/Bengt


2010/10/30 Bengt Rodehav 

> I have a similar situation but I'm not using Spring - I use Java DSL and
> iPOJO.
>
> I have my own tracer that I can publish as an OSGi service using iPOJO. I
> want to accomplish the following. My other services shall have optional
> service dependencies to my tracer. This means that if my custom tracer is
> available then it should be used, otherwise the default tracer should be
> used.
>
> However, just publishing my tracer and requiring it in my other components
> does not automatically cause Camel to use it. I have to to the following:
>
> getContext().addInterceptStrategy(mTracer);
>
> getContext().setTracing(false);
>
>
> In other words I explicitly set my tracer to be used, I then disable
> tracing since the first line seems to automatically enable tracing. I then
> use JMX to enable/disable tracing. I was hoping the above two lines were
> unnecessary and that merely the existence of a tracer should cause Camel to
> use it. Is that a Spring specific functionality? I was hoping that any way
> that an OSGi service was published/consumed would work?
>
> /Bengt
>
> 2010/10/30 Richard Kettelerij 
>
>
>> You don't have to add a Tracer to your Spring context yourself. Camel adds
>> one automatically if you have a CamelContext declared in Spring. Also your
>> don't have to do anything with the "trace" option in your Spring context.
>>
>> I find that the easiest way to enable/disable tracing in production is
>> through JMX. Just navigate to the CamelContext MBean and modify the
>> "tracing" attribute. Additionally you can determine what should be traced
>> by
>> modifying a few options in the Tracer MBean.
>>
>> -
>> Richard Kettelerij,
>> http://github.com/rkettelerij
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Enabling-tracing-in-production-tp3243013p3243143.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>


Re: Enabling tracing in production

2010-10-30 Thread huntc


Richard Kettelerij wrote:
> 
> You don't have to add a Tracer to your Spring context yourself. Camel adds
> one automatically if you have a CamelContext declared in Spring. Also your
> don't have to do anything with the "trace" option in your Spring context.
> 
This was not my experience. Are you certain?



> I find that the easiest way to enable/disable tracing in production is
> through JMX. Just navigate to the CamelContext MBean and modify the
> "tracing" attribute. Additionally you can determine what should be traced
> by modifying a few options in the Tracer MBean.
> 
That's a good idea. Thanks.
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Enabling-tracing-in-production-tp3243013p3243168.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Enabling tracing in production

2010-10-30 Thread Bengt Rodehav
I have a similar situation but I'm not using Spring - I use Java DSL and
iPOJO.

I have my own tracer that I can publish as an OSGi service using iPOJO. I
want to accomplish the following. My other services shall have optional
service dependencies to my tracer. This means that if my custom tracer is
available then it should be used, otherwise the default tracer should be
used.

However, just publishing my tracer and requiring it in my other components
does not automatically cause Camel to use it. I have to to the following:

getContext().addInterceptStrategy(mTracer);

getContext().setTracing(false);


In other words I explicitly set my tracer to be used, I then disable tracing
since the first line seems to automatically enable tracing. I then use JMX
to enable/disable tracing. I was hoping the above two lines were unnecessary
and that merely the existence of a tracer should cause Camel to use it. Is
that a Spring specific functionality? I was hoping that any way that an OSGi
service was published/consumed would work?

/Bengt

2010/10/30 Richard Kettelerij 

>
> You don't have to add a Tracer to your Spring context yourself. Camel adds
> one automatically if you have a CamelContext declared in Spring. Also your
> don't have to do anything with the "trace" option in your Spring context.
>
> I find that the easiest way to enable/disable tracing in production is
> through JMX. Just navigate to the CamelContext MBean and modify the
> "tracing" attribute. Additionally you can determine what should be traced
> by
> modifying a few options in the Tracer MBean.
>
> -
> Richard Kettelerij,
> http://github.com/rkettelerij
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Enabling-tracing-in-production-tp3243013p3243143.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Throttler in a Choice ?

2010-10-30 Thread Claus Ibsen
Hi

Yeah you can get such situations in the Java DSL. Java Generics is not
up for the task of a full fledged DSL.

In Camel 3.0 we should improve the throttle DSL to not require child
nodes and hence the Java DSL ought to work.

You can split the route into other routes and link using direct to
workaround this in Java DSL.

On Fri, Oct 29, 2010 at 4:47 PM, Olivier.Roger  wrote:
>
> Hello Camel,
>
> I am using Camel 2.4 and writting my first Java DSL route
> I would like to translate the following route from Spring DSL:
>
>                
>                        
>                            ${header.JMSPriority} < 5
>                     timePeriodMillis="6">
>                        
>                    
>                
>                
>                    
>                
>            
>
> Here is what I did :
>
>   �...@override
>    public void configure() throws Exception {
>        from("direct:throttler.in")
>            .choice()
>                .when(simple("header.JMSPriority >= 5"))
>                    .throttle(50).timePeriodMillis(6)
>                    .to("direct:nsResolved")
>                    //.end()
>                .otherwise()
>                    .to("direct:nsResolved")
>            .end();
>    }
>
> In both case I can use otherwise() because I dont have a ChoiceDefinition
> object.
> Like that I get a ThrottlerDefinition, which implements block, so I should
> close is with end() I suppose.
> In that case I get a ProcessDefinition not a ChoiceDefinition.
>
> Am I doing something wrong here ?
>
> Thanks for your help,
>
> Olivier
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Throttler-in-a-Choice-tp3242130p3242130.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



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


Re: Javadocs broken in ExpressionClause

2010-10-30 Thread Claus Ibsen
On Fri, Oct 29, 2010 at 9:13 PM, Krsmanovic, Dragisa
 wrote:
> Javadocs are messed up by line breaks in the middle of HTML markup:
> http://bit.ly/dta1wH
>

Can you pin point where the problem is? At first glance I cant see the problem


>
>



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


Re: Enabling tracing in production

2010-10-30 Thread Richard Kettelerij

You don't have to add a Tracer to your Spring context yourself. Camel adds
one automatically if you have a CamelContext declared in Spring. Also your
don't have to do anything with the "trace" option in your Spring context.

I find that the easiest way to enable/disable tracing in production is
through JMX. Just navigate to the CamelContext MBean and modify the
"tracing" attribute. Additionally you can determine what should be traced by
modifying a few options in the Tracer MBean.

-
Richard Kettelerij,
http://github.com/rkettelerij
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Enabling-tracing-in-production-tp3243013p3243143.html
Sent from the Camel - Users mailing list archive at Nabble.com.