From: Robert Klemme Date: 2005-10-11T17:31:52+09:00 Subject: Re: event based model - best way to implement? snacktime wrote: > I am currently using perl's POE to communicate with the asterisk > manager interface, but I would like a ruby implementation. Concluding from a quick glance at POE all it does is already built into Ruby (Threads, Queue, synchronization). > A server > will connect to asterisk and read events as they become available. > The webserver will connnect periodically to retrieve any available > events and to optionally send more requests. > > My first thought was to use a simple select loop in the server > combined with observers, and have the webserver communicate via drb. > I could use http for the server also to make it easy for ajax calls > to communicate directly to the server (proxied via apache). > > The asterisk manager interface sends events to the connected client > (my server) pretty much ad hoc whenever asterisk has something to > report. In other words requests and responses are not necessarily > sequential. > > Does a simple select loop sound like the way to go here? You architecture is not fully clear to me, but given the small about of sources and sinks I'd use a thread per source and either do the processing directly in that thread or push tasks down a queue. IMHO this is far easier in this case than writing a select loop that does the multiplexing. Does that sound reasonable to you? Kind regards robert