You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Müller <ch...@gmail.com> on 2012/01/01 15:53:58 UTC

Re: Camel SMPP - Setting Relative times for CamelSmppValidityPeriod

Hello Ranjit!

I'm pleased you use the Camel SMPP component to send your short messages.
You are right, at present Camel "only" supports absolute time formats (you
have to provide a java.util.Data object which is interpreted so). We could
also add the possibility to support relative time formats, but because you
can implement your requirements with the current solution with "only" two
more lines of code, I would like to let it as it is:

Imagine the current time is 01.01.2012 12:00:00 and the short message
should have a validity period of 3 days. If you use the relative time
format, you should do it like (if we support it):
exchange.getIn().setHeader(SmppConstants.VALIDITY_PERIOD, "000003000000R");

If you use the absolute time format (at present your only solution), you
can do it like:
Calendar now = Calendar.getInstance();
now.add(Calendar.DAY_OF_MONTH, 3);
exchange.getIn().setHeader(SmppConstants.VALIDITY_PERIOD, now.getTime());

Best,
Christian

On Fri, Dec 30, 2011 at 11:58 AM, ranjitkumarm <rm...@gmail.com> wrote:

> Hi,
>   I am using Camel version 2.8.3 for sending short messages to SMSC. I have
> a requirement to set a relative time as the message validity period. But I
> think camel only supports absolute time formats, eventhough the
> documentation at  http://camel.apache.org/smpp.html
> http://camel.apache.org/smpp.html  talks about supporting both absolute
> and
> relative formats.
>
> I am adding the 'CamelSmppValidityPeriod' header value using
> <code>exchange.getIn().setHeader(SmppBinding.VALIDITY_PERIOD, new
> Date());</code>
>
>  I am new to Camel and  not sure whether my understanding is correct.
>
> Thanks in advance.
> - Ranjit
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5109818.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel SMPP - Setting Relative times for CamelSmppValidityPeriod

Posted by ranjitkumarm <rm...@gmail.com>.
Hi Christian,
             Thats great, thank you for fixing.

Regards,
Ranjit


On Thursday, January 5, 2012, Christian Mueller [via Camel] <
ml-node+s465427n5120793h95@n5.nabble.com> wrote:
> I created the issue [1] and applied a patch to trunk and the 2.9.1 branch.
> Will update the WIKI soon.
> Now you can set the validity period (absolute and relative) also as
string.
>
> [1] https://issues.apache.org/jira/browse/CAMEL-4862
>
> Best,
> Christian
>
> On Wed, Jan 4, 2012 at 2:15 PM, ranjitkumarm <[hidden email]> wrote:
>
>> Hi Claus,
>>
>> Sorry for the delay in responding.
>>
>> The most convenient way to fix this issue will be to accept those headers
>> (that support relative time) as string objects rather than date objects,
>> but the tradeoff here will be that the developer has to construct the
date
>> string in SMPP format or depend on the time formatter classes in JSMPP to
>> construct the string.
>> I would like to have your views on the above before proceeding to build
the
>> patch.
>>
>> Regards,
>> Ranjit
>>
>> On Monday, January 2, 2012, Claus Ibsen-2 [via Camel] <
>> [hidden email]> wrote:
>> > On Mon, Jan 2, 2012 at 6:18 AM, ranjitkumarm <[hidden email]> wrote:
>> >> Hi Christian,
>> >>
>> >>           Thank you for you reply. I had already explored the second
>> option
>> >> you had suggested, but unfortunately it does not hold good for me,
>> reason
>> >> being the time of the SMSC server and and the machine on which my
client
>> >> program is running may not be in synch which will lead to undesirable
>> >> results.
>> >>
>> >
>> > The wiki documentation do say that relative time is supported. I think
>> > we should fix the wiki page.
>> >
>> > Also I think if there is a relative syntax from the spec, we should
>> > support it. So I suggest to create a JIRA ticket.
>> > And we love contributions, so patches is welcome.
>> > http://camel.apache.org/contributing.html
>> >
>> > And yeah the clock sync issue is also a problem with messaging with
>> > eg. JMS. Where clients and brokers can also be not in sync.
>> > For example the AMQ broker have a timestamp plugin, that will force
>> > using the timestamp from the server as offset.
>> > http://activemq.apache.org/timestampplugin.html
>> >
>> >
>> >> Regards,
>> >> Ranjit
>> >>
>> >> --
>> >> View this message in context:
>>
>>
http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114077.html
>> >> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >
>> >
>> >
>> > --
>> > Claus Ibsen
>> > -----------------
>> > FuseSource
>> > Email: [hidden email]
>> > Web: http://fusesource.com
>> > Twitter: davsclaus, fusenews
>> > Blog: http://davsclaus.blogspot.com/
>> > Author of Camel in Action: http://www.manning.com/ibsen/
>> >
>> >
>> > ________________________________
>> > If you reply to this email, your message will be added to the
discussion
>> below:
>> >
>>
>>
http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114292.html
>> > To unsubscribe from Camel SMPP - Setting Relative times for
>> CamelSmppValidityPeriod, click here.
>> > NAML
>>
>>
>> --
>> View this message in context:
>>
http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5119550.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/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5120793.html
> To unsubscribe from Camel SMPP - Setting Relative times for
CamelSmppValidityPeriod, click here.
> NAML


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5121640.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel SMPP - Setting Relative times for CamelSmppValidityPeriod

Posted by Christian Müller <ch...@gmail.com>.
I created the issue [1] and applied a patch to trunk and the 2.9.1 branch.
Will update the WIKI soon.
Now you can set the validity period (absolute and relative) also as string.

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

Best,
Christian

On Wed, Jan 4, 2012 at 2:15 PM, ranjitkumarm <rm...@gmail.com> wrote:

> Hi Claus,
>
> Sorry for the delay in responding.
>
> The most convenient way to fix this issue will be to accept those headers
> (that support relative time) as string objects rather than date objects,
> but the tradeoff here will be that the developer has to construct the date
> string in SMPP format or depend on the time formatter classes in JSMPP to
> construct the string.
> I would like to have your views on the above before proceeding to build the
> patch.
>
> Regards,
> Ranjit
>
> On Monday, January 2, 2012, Claus Ibsen-2 [via Camel] <
> ml-node+s465427n5114292h64@n5.nabble.com> wrote:
> > On Mon, Jan 2, 2012 at 6:18 AM, ranjitkumarm <[hidden email]> wrote:
> >> Hi Christian,
> >>
> >>           Thank you for you reply. I had already explored the second
> option
> >> you had suggested, but unfortunately it does not hold good for me,
> reason
> >> being the time of the SMSC server and and the machine on which my client
> >> program is running may not be in synch which will lead to undesirable
> >> results.
> >>
> >
> > The wiki documentation do say that relative time is supported. I think
> > we should fix the wiki page.
> >
> > Also I think if there is a relative syntax from the spec, we should
> > support it. So I suggest to create a JIRA ticket.
> > And we love contributions, so patches is welcome.
> > http://camel.apache.org/contributing.html
> >
> > And yeah the clock sync issue is also a problem with messaging with
> > eg. JMS. Where clients and brokers can also be not in sync.
> > For example the AMQ broker have a timestamp plugin, that will force
> > using the timestamp from the server as offset.
> > http://activemq.apache.org/timestampplugin.html
> >
> >
> >> Regards,
> >> Ranjit
> >>
> >> --
> >> View this message in context:
>
> http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114077.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > FuseSource
> > Email: [hidden email]
> > Web: http://fusesource.com
> > Twitter: davsclaus, fusenews
> > Blog: http://davsclaus.blogspot.com/
> > Author of Camel in Action: http://www.manning.com/ibsen/
> >
> >
> > ________________________________
> > If you reply to this email, your message will be added to the discussion
> below:
> >
>
> http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114292.html
> > To unsubscribe from Camel SMPP - Setting Relative times for
> CamelSmppValidityPeriod, click here.
> > NAML
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5119550.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel SMPP - Setting Relative times for CamelSmppValidityPeriod

Posted by ranjitkumarm <rm...@gmail.com>.
Hi Claus,

Sorry for the delay in responding.

The most convenient way to fix this issue will be to accept those headers
(that support relative time) as string objects rather than date objects,
but the tradeoff here will be that the developer has to construct the date
string in SMPP format or depend on the time formatter classes in JSMPP to
construct the string.
I would like to have your views on the above before proceeding to build the
patch.

Regards,
Ranjit

On Monday, January 2, 2012, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5114292h64@n5.nabble.com> wrote:
> On Mon, Jan 2, 2012 at 6:18 AM, ranjitkumarm <[hidden email]> wrote:
>> Hi Christian,
>>
>>           Thank you for you reply. I had already explored the second
option
>> you had suggested, but unfortunately it does not hold good for me, reason
>> being the time of the SMSC server and and the machine on which my client
>> program is running may not be in synch which will lead to undesirable
>> results.
>>
>
> The wiki documentation do say that relative time is supported. I think
> we should fix the wiki page.
>
> Also I think if there is a relative syntax from the spec, we should
> support it. So I suggest to create a JIRA ticket.
> And we love contributions, so patches is welcome.
> http://camel.apache.org/contributing.html
>
> And yeah the clock sync issue is also a problem with messaging with
> eg. JMS. Where clients and brokers can also be not in sync.
> For example the AMQ broker have a timestamp plugin, that will force
> using the timestamp from the server as offset.
> http://activemq.apache.org/timestampplugin.html
>
>
>> Regards,
>> Ranjit
>>
>> --
>> View this message in context:
http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114077.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: [hidden email]
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
below:
>
http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114292.html
> To unsubscribe from Camel SMPP - Setting Relative times for
CamelSmppValidityPeriod, click here.
> NAML


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5119550.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel SMPP - Setting Relative times for CamelSmppValidityPeriod

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 2, 2012 at 6:18 AM, ranjitkumarm <rm...@gmail.com> wrote:
> Hi Christian,
>
>           Thank you for you reply. I had already explored the second option
> you had suggested, but unfortunately it does not hold good for me, reason
> being the time of the SMSC server and and the machine on which my client
> program is running may not be in synch which will lead to undesirable
> results.
>

The wiki documentation do say that relative time is supported. I think
we should fix the wiki page.

Also I think if there is a relative syntax from the spec, we should
support it. So I suggest to create a JIRA ticket.
And we love contributions, so patches is welcome.
http://camel.apache.org/contributing.html

And yeah the clock sync issue is also a problem with messaging with
eg. JMS. Where clients and brokers can also be not in sync.
For example the AMQ broker have a timestamp plugin, that will force
using the timestamp from the server as offset.
http://activemq.apache.org/timestampplugin.html


> Regards,
> Ranjit
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114077.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@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: Camel SMPP - Setting Relative times for CamelSmppValidityPeriod

Posted by ranjitkumarm <rm...@gmail.com>.
Hi Christian,

           Thank you for you reply. I had already explored the second option
you had suggested, but unfortunately it does not hold good for me, reason
being the time of the SMSC server and and the machine on which my client
program is running may not be in synch which will lead to undesirable
results.

Regards,
Ranjit

--
View this message in context: http://camel.465427.n5.nabble.com/Camel-SMPP-Setting-Relative-times-for-CamelSmppValidityPeriod-tp5109818p5114077.html
Sent from the Camel - Users mailing list archive at Nabble.com.