dcsimg
<strong> How can I implement a PUSH service in Java?</strong>
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Luca_Ventura
Posted On:   Saturday, April 20, 2002 12:14 AM

Hello everybody! I would like implement a PUSH service in Java for my Web site. What I would like to di is: when a user connects to my web site he can compile a form where he chooses the type of data he wants to receive in his mailbox (eg. newsletters about sport, culture, and so on) or in his mobile-phone (through SMS messages) using Javamail and JMS technologies. As soon as the data that he needs is available I can send it to him by e-mail or SMS (as he prefers). I have some doubts about the following points: 1) How can I implement (in Java )the PUSH engine that collects the preferences of the users and sends information (by e-mail and sms) to them? I mean...must I use a servlet or a Java-program standalo   More>>

Hello everybody!



I would like implement a PUSH service in Java for my Web site. What I would like to di is: when a user connects to my web site he can compile a form where he chooses the type of data he wants to receive in his mailbox (eg. newsletters about sport, culture, and so on) or in his mobile-phone (through SMS messages) using Javamail and JMS technologies. As soon as the data that he needs is available I can send it to him by e-mail or SMS (as he prefers). I have some doubts about the following points:



1) How can I implement (in Java )the PUSH engine that collects the preferences of the users and sends information (by e-mail and sms) to them? I mean...must I use a servlet or a Java-program standalone always running (in this second case I can insert a "while (true) do..." cycle in the body so that the program never ending...)?



2) How can I store the information about the preferences of the user? I think I must use necessarily a dabatase: in fact the Java service (program) or the servlet could go down (for some reason) and all the information about the user would be lost. Am I right?



3) How can I detect when a new type of data for the user is available and I must send it to him? Of course I must store the data I can send to the user in a database (that is to say the news about sport, culture, etc), but how can I recognize when a particular type of information for a user is available and it is time to send it to him? I though the following solution:



a)After a fixed period of time T for every user I can periodically scan the database where I stored the information about the news.

b) I search the type of the news that the user is looking for and I get the up-tp-date news that I haven't sent to him yet.

c) I send the news to the user.



Anyway in this solution I have the following problems:



1) I can have thousands of users and of news in the database: so I have to do thousands of searches in the database after a period T (this can take seconds, minute, or hours) even if there is no new information to send to any user, and this isn't very efficient. Maybe the best solution would be to detect when a new information is inserted in the "database of the news" and only in that moment to search for the user that need it, or not?



2) In this second case....how can I listen (detect) when a new "information" arrives and is stored in the database?



3) I could search for the users to whom to send new data WHEN I am sure a new information is arrived AND AT LEAST WHEN a fixed period of time T is passed (I would combine the two techniques): in this way I could reduce the overhead fo the searches in the database. What do you think about?



4) How can get from the "database" ONLY that news I haven't already sent to the user? I think wouldn't be a good idea to send to the user two times the same news!!



Given that to implement a push engine is very difficult any hint (and any useful link) on the argument is appreciated.



I thank you for the help and the patience in advance.



Luca

   <<Less
About | Sitemap | Contact