I agree with everything everyone's said so far in this thread.

Another thought; if all the messages are added to the queue in the
order they want to be delivered; its just there needs to be an hour
lag from the message send, to the message receive,  you could do this
just using a sleep in your consumer.

e.g.

Message message = consumer.receive();
sleep();
sendEmail()


Where the consumer just sleeps the current thread until enough time
has elapsed (1 hour since the send).


This strategy doesn't work for messages with random delays on each
message though :)

On 6/15/07, Mario Siegenthaler <[EMAIL PROTECTED]> wrote:
Somebody proposed in a different thread to use a MessageSelector to
only select the messages that are at least an hour old. You could set
a message-property to System.currentTimeMillis() and then create a
selector with "SendTime < "+(System.currentTimeMillis()-3600000).
You'd have to recreate your consumer in a certain interval since
unfortunatly time passes by itself :)

Mario

On 6/15/07, Gaurav Hariani <[EMAIL PROTECTED]> wrote:
> I would approach this using persistent messages.
>
> Your webapp creates a persistent message adds the time (as a property
> maybe) at which the message should be sent as email and puts it on a queue.
>
> Another application can regularly poll the queue for messages that are
> ready to be emailed.
>
> That way if the webapp, the application that does the mailing or the
> broker dies and comes back up, the messages are not lost.
>
> Gaurav
>
>
> Hehl, Thomas wrote:
> > I new to JMS and messaging in general and would like a little advice.
> >
> >
> >
> > In my application, I have a java webapp that sends e-mails. For reasons too
> > complicated to explain, my client wants an hour lag time between the time
> > the e-mail is created and the time it is sent, so I need to park it
> > somewhere.
> >
> >
> >
> > The problem is that I want them to be able to shutdown (or even crash) my
> > server, re-start, then have the messages take back off again like nothing
> > ever happened. It seemed like something activeMQ might be well suited for.
> >
> >
> >
> > Am I barking up the wrong tree? Has anyone done anything like this?
> >
> >
> >
> > Thanks.
> >
> >
> >
> > Thom Hehl
> > Sr. eJuror Architect
> >
> > * Office (859) 277-8800 x 144
> >
> > * [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> > ACS, Inc.
> >
> > Government Solutions
> >
> > 1733 Harrodsburg Road
> > Lexington, KY 40504-3617
> >
> > This e-mail message, including any attachments, is for the sole use of the
> > intended recipient(s) and may contain confidential and privileged
> > information. Any unauthorized review, use, disclosure or distribution is
> > prohibited. If you are not the intended recipient, please contact the sender
> > by reply e-mail and destroy all copies of the original message and notify
> > sender via e-mail at [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>  or by telephone at 859-277-8800 ext. 144.
> > Thank you.
> >
> >
> >
> >
> >
>



--
James
-------
http://macstrac.blogspot.com/

Reply via email to