You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Kaj <ka...@finally.se> on 2008/10/23 22:57:07 UTC

Small API change suggestion, TimeUnit

Hi all,

I just went to Bruce Snyder's presentation on Camel at Software Summit. It
was a great session, and it looks like Camel is really great, but I saw that
something could be made a bit better :)

Some methods in the API takes a time value. The time value is in
milliseconds, and some of the methods are named something like fooMs, while
some others only are named foo. 

Knowing how much 24000 ms is isn't the easiest thing. Why not overload the
metods, or change the API so that the methods instead takes a TimeUnit and a
value as argument. E.g. TimeUnit.MINUTES, 5.

(I didn't know if I should have posted this in the user list or the
developer list so I posted it here).

Kaj


-- 
View this message in context: http://www.nabble.com/Small-API-change-suggestion%2C-TimeUnit-tp20139112s22882p20139112.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Small API change suggestion, TimeUnit

Posted by Gert Vanthienen <ge...@skynet.be>.
Kay, Claus,

This looks like a nice addition to the Java DSL and URI syntax, so 
please do create a JIRA issue for it.  For the short-hand syntax 
parsing, there are a few options out there but we might get away with 
something as simple as 
http://johannburkard.de/blog/programming/java/date-formatting-parsing-humans-humantime.html, 
which is just one class.

BTW, we already have a nice syntax for expressing time in the Scala DSL 
(cfr. Delayer and Throttler on 
http://activemq.apache.org/camel/scala-dsl-eip.html).

Regards,

Gert

Claus Ibsen wrote:
> Hi Kay
>
> Welcome. Glad you enjoyed Bruce's presentation. I had the pleasure of attending his presentation at JavaPolis last year. 
>
> That is a great idea to allow end-users to setup timing in a unit of choice. However Camel also supports setting options in the well known URI style (like http request parameters with ? and &). So if we could come up with a short hand syntax and a parser, so you can write: "deplay=5000ms", "delay=5s" for 5 seconds. I was wondering if there was such a framework or feature already? It should also work with the Spring XSD configuration where you use XML.
>
> But personally I love the builder pattern and I see something in common here with a DSL for scheduling, that we would like to get in Camel 2.0. Here you also need to express time units as well.
>
> Kaj, please feel free to create a ticket on our JIRA for this good idea:
> http://activemq.apache.org/camel/support.html
>
> http://issues.apache.org/activemq/browse/CAMEL
>
>
>
>
>
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Kaj [mailto:kaj@finally.se] 
> Sent: 23. oktober 2008 22:57
> To: camel-user@activemq.apache.org
> Subject: Small API change suggestion, TimeUnit
>
>
> Hi all,
>
> I just went to Bruce Snyder's presentation on Camel at Software Summit. It
> was a great session, and it looks like Camel is really great, but I saw that
> something could be made a bit better :)
>
> Some methods in the API takes a time value. The time value is in
> milliseconds, and some of the methods are named something like fooMs, while
> some others only are named foo. 
>
> Knowing how much 24000 ms is isn't the easiest thing. Why not overload the
> metods, or change the API so that the methods instead takes a TimeUnit and a
> value as argument. E.g. TimeUnit.MINUTES, 5.
>
> (I didn't know if I should have posted this in the user list or the
> developer list so I posted it here).
>
> Kaj
>
>
>   


RE: Small API change suggestion, TimeUnit

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Kay

Welcome. Glad you enjoyed Bruce's presentation. I had the pleasure of attending his presentation at JavaPolis last year. 

That is a great idea to allow end-users to setup timing in a unit of choice. However Camel also supports setting options in the well known URI style (like http request parameters with ? and &). So if we could come up with a short hand syntax and a parser, so you can write: "deplay=5000ms", "delay=5s" for 5 seconds. I was wondering if there was such a framework or feature already? It should also work with the Spring XSD configuration where you use XML.

But personally I love the builder pattern and I see something in common here with a DSL for scheduling, that we would like to get in Camel 2.0. Here you also need to express time units as well.

Kaj, please feel free to create a ticket on our JIRA for this good idea:
http://activemq.apache.org/camel/support.html

http://issues.apache.org/activemq/browse/CAMEL





Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Kaj [mailto:kaj@finally.se] 
Sent: 23. oktober 2008 22:57
To: camel-user@activemq.apache.org
Subject: Small API change suggestion, TimeUnit


Hi all,

I just went to Bruce Snyder's presentation on Camel at Software Summit. It
was a great session, and it looks like Camel is really great, but I saw that
something could be made a bit better :)

Some methods in the API takes a time value. The time value is in
milliseconds, and some of the methods are named something like fooMs, while
some others only are named foo. 

Knowing how much 24000 ms is isn't the easiest thing. Why not overload the
metods, or change the API so that the methods instead takes a TimeUnit and a
value as argument. E.g. TimeUnit.MINUTES, 5.

(I didn't know if I should have posted this in the user list or the
developer list so I posted it here).

Kaj


-- 
View this message in context: http://www.nabble.com/Small-API-change-suggestion%2C-TimeUnit-tp20139112s22882p20139112.html
Sent from the Camel - Users mailing list archive at Nabble.com.