[EMAIL PROTECTED] wrote: > If we want to make a persistent TCP connection with a data queue, is > django the best place (or even a possible place) for this connection > layer to live? I see these options:
In a production environment, you need Django to run on Apache, so I think you can't expect anything to be persistent at the application level. > > 1) Write a separate TCP daemon app which accepts the input from django > and maintains a permanent connection to the remote proprietary > service. (Which IPC mechanism would work best is another question: > using a database table as a queue? Using a unix socket and a memory > queue on the daemon?) The problem with a daemon, is that, in the long run, it may crash or become unresponsive for various reasons. > 2) Find somewhere in django where I can create a persistent queue, > have the http transaction write to the queue and have a django service > persistently checking the queue while maintaining the outbound TCP > connection. This is where I am especially short on technical > knowledge. Is there any way to have code running persistently in the > django environment that starts when the web server is started, or is > everything entirely event driven? Correct me if I'm wrong, but to my understanding Django operates as a normal web application framework upon Apache, and so yes it is entirely "event driven". Running some code persistently, if possible, is going to be complicated, and may cause the same trouble mentioned above about a daemon. But if you can tolerate a little latency, the solution to your problem may be very simple: 1 - Make your Django app write the data that needs to be sent into to a database table 2 - Every minute (or hour, ...) run a cron job (a simple Python script) that checks the database table, establish the needed TCP connection, send it all and cleanup the sent entries from the table. Hope that helps, -- Olivier / Samalyse -- Olivier Guilyardi / Samalyse --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---