You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ângelo Costa <an...@gmail.com> on 2015/04/17 13:27:50 UTC

Seconds since 1970

Hi Guys,

anyone know in camel how i can get current seconds since 1970? in Long
format?

Thanks in advance,

Ângelo Costa

Re: Seconds since 1970

Posted by Raul Kripalani <ra...@evosent.com>.
System.currentTimeMillis() / 1000. You will want to round up or round down
(use Math).

And please post only Camel-specific questions.

For general Java questions, Stack Overflow or Google are your best bets.

Regards,

*Raúl Kripalani*
Apache Camel PMC Member & Committer | Enterprise Architect, Open Source
Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Fri, Apr 17, 2015 at 12:27 PM, Ângelo Costa <an...@gmail.com>
wrote:

> Hi Guys,
>
> anyone know in camel how i can get current seconds since 1970? in Long
> format?
>
> Thanks in advance,
>
> Ângelo Costa
>

Re: Seconds since 1970

Posted by Claus Ibsen <cl...@gmail.com>.
You may need a newer Camel version for this with simple language.

What version of Camel do you use?

You can always use a more powerful language such as groovy instead to
write code in the xml file to use.




On Fri, Apr 17, 2015 at 5:10 PM, angelo.rlcosta
<an...@gmail.com> wrote:
> Hi Hans,
>
> .setBody().simple("bean:java.lang.System?method=currentTimeMillis")
>
> this is what im already trying to do.
>
> Any clue on the nosuchbean issue?
>
>
> Ângelo Costa
>
> On Fri, Apr 17, 2015 at 4:07 PM, Hans Orbaan [via Camel] <
> ml-node+s465427n5765971h38@n5.nabble.com> wrote:
>
>> Hi,
>>
>> Try java.lang.System
>>
>>
>> -----Oorspronkelijk bericht-----
>> Van: angelo.rlcosta [mailto:[hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=5765971&i=0>]
>> Verzonden: Friday 17 April 2015 16:49
>> Aan: [hidden email]
>> <http:///user/SendEmail.jtp?type=node&node=5765971&i=1>
>> Onderwerp: Re: Seconds since 1970
>>
>> Hi Guys,
>>
>> I'm doing as you told me but i am now getting a No bean could be found in
>> the registry for: java.lang:
>> org.apache.camel.NoSuchBea
>> nException: No bean could be found in the registry for: java.lang
>>
>>
>> Any idea?
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Seconds-since-1970-tp5765942p5765963.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/Seconds-since-1970-tp5765942p5765971.html
>>  To unsubscribe from Seconds since 1970, click here
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5765942&code=YW5nZWxvLnJsY29zdGFAZ21haWwuY29tfDU3NjU5NDJ8OTY0MzQzODU=>
>> .
>> NAML
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Seconds-since-1970-tp5765942p5765972.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Seconds since 1970

Posted by "angelo.rlcosta" <an...@gmail.com>.
Hi Hans,

.setBody().simple("bean:java.lang.System?method=currentTimeMillis")

this is what im already trying to do.

Any clue on the nosuchbean issue?


Ângelo Costa

On Fri, Apr 17, 2015 at 4:07 PM, Hans Orbaan [via Camel] <
ml-node+s465427n5765971h38@n5.nabble.com> wrote:

> Hi,
>
> Try java.lang.System
>
>
> -----Oorspronkelijk bericht-----
> Van: angelo.rlcosta [mailto:[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5765971&i=0>]
> Verzonden: Friday 17 April 2015 16:49
> Aan: [hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5765971&i=1>
> Onderwerp: Re: Seconds since 1970
>
> Hi Guys,
>
> I'm doing as you told me but i am now getting a No bean could be found in
> the registry for: java.lang:
> org.apache.camel.NoSuchBea
> nException: No bean could be found in the registry for: java.lang
>
>
> Any idea?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Seconds-since-1970-tp5765942p5765963.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/Seconds-since-1970-tp5765942p5765971.html
>  To unsubscribe from Seconds since 1970, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5765942&code=YW5nZWxvLnJsY29zdGFAZ21haWwuY29tfDU3NjU5NDJ8OTY0MzQzODU=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Seconds-since-1970-tp5765942p5765972.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: Seconds since 1970

Posted by Hans Orbaan <ha...@docdata.eu>.
Hi,

Try java.lang.System


-----Oorspronkelijk bericht-----
Van: angelo.rlcosta [mailto:angelo.rlcosta@gmail.com] 
Verzonden: Friday 17 April 2015 16:49
Aan: users@camel.apache.org
Onderwerp: Re: Seconds since 1970

Hi Guys,

I'm doing as you told me but i am now getting a No bean could be found in the registry for: java.lang:
org.apache.camel.NoSuchBea
nException: No bean could be found in the registry for: java.lang


Any idea?



--
View this message in context: http://camel.465427.n5.nabble.com/Seconds-since-1970-tp5765942p5765963.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Seconds since 1970

Posted by "angelo.rlcosta" <an...@gmail.com>.
Hi Guys,

I'm doing as you told me but i am now getting a 
No bean could be found in the registry for: java.lang:
org.apache.camel.NoSuchBea
nException: No bean could be found in the registry for: java.lang


Any idea?



--
View this message in context: http://camel.465427.n5.nabble.com/Seconds-since-1970-tp5765942p5765963.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Seconds since 1970

Posted by Giorgio Vespucci <gi...@gmail.com>.
Alexey,
Thank you very much.
I didn't realize early such a use of "bean:" component, for using Java lang
classes!
Chapeau :)

Il giorno ven 17 apr 2015 13:59 Alexey Markevich <am...@talend.com> ha
scritto:

> Simply .setBody().simple("bean:java.lang.System?method=currentTimeMillis")
> -> BodyType: Long, Body: 1429271715421
>
> On Fri, 17 Apr 2015 14:51:05 +0300, Morgan Hautman
> <mo...@gmail.com> wrote:
>
> > Hi Angelo,
> >
> > in a procesor you could do
> >
> > System.currentTimeMillis();
> >
> >
> http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#currentTimeMillis%28%29
> >
> > Regards,
> >
> > Morgan
> >
> > On 17/04/2015 13:27, Ângelo Costa wrote:
> >> Hi Guys,
> >>
> >> anyone know in camel how i can get current seconds since 1970? in Long
> >> format?
> >>
> >> Thanks in advance,
> >>
> >> Ângelo Costa
> >>
> >
>
>
> --
> Regards, Alexey.
>

Re: Seconds since 1970

Posted by Alexey Markevich <am...@talend.com>.
Simply .setBody().simple("bean:java.lang.System?method=currentTimeMillis")  
-> BodyType: Long, Body: 1429271715421

On Fri, 17 Apr 2015 14:51:05 +0300, Morgan Hautman  
<mo...@gmail.com> wrote:

> Hi Angelo,
>
> in a procesor you could do
>
> System.currentTimeMillis();
>
> http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#currentTimeMillis%28%29
>
> Regards,
>
> Morgan
>
> On 17/04/2015 13:27, Ângelo Costa wrote:
>> Hi Guys,
>>
>> anyone know in camel how i can get current seconds since 1970? in Long
>> format?
>>
>> Thanks in advance,
>>
>> Ângelo Costa
>>
>


-- 
Regards, Alexey.

Re: Seconds since 1970

Posted by Morgan Hautman <mo...@gmail.com>.
Hi Angelo,

in a procesor you could do

System.currentTimeMillis();

http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#currentTimeMillis%28%29

Regards,

Morgan

On 17/04/2015 13:27, Ângelo Costa wrote:
> Hi Guys,
>
> anyone know in camel how i can get current seconds since 1970? in Long
> format?
>
> Thanks in advance,
>
> Ângelo Costa
>