<div dir="ltr"><div><div><br><br>On Thu, Jul 30, 2015 at 12:22 PM, avinash D'silva <<a href="mailto:evnix.com@gmail.com">evnix.com@gmail.com</a>> wrote:<br>><br>> Hi,<br>><br>> I am trying to learn Erlang by implementing a small Queueing Server.<br>><br>> What have I done so far?<br>> I have created a basic websocket server using cowboy.<br>><br>> I am trying to implement a Queue which all processes can access.<br>><br>> I have used lists which can act as queues.<br>><br>> The basic insert function looks like this:<br>> Queue(Q) -><br>>         receive <br>>                Msg -><br>>                     Queue(lists:append(Q,[Msg]))<br>>         end.       <br>><br>> To create a Queue called "Q_1"<br>><br>> >  pg2:create(<<"Q_1">>).<br>> >  P = spawn(test,Queue,[[1]]). % spawn queue and insert 1.<br>> >  pg2:join(<<"Q_1">>,P).<br>> >  P ! 2.<br>> >  P ! 3. % add some elements to queue.<br>><br>> to retrieve the elements from the named Queue "Q_1":<br>> 1. I use [Px|_]=pg2:get_members()<br>> 2. then I would do something like: Px ! POP_ELEMENT<br>><br>><br>> Is there a better or more scalable way of doing this?<br>><br>> Will this work when a lot of clients are connected( around 60), having a insert rate of 100k elements per hour?<br>><br>> Any help is appreciated :)<br>><br><br>I did a search on yahoo for "erlang queue example" and this was the first hit:<br><br><a href="http://www.erlang.org/doc/man/queue.html">http://www.erlang.org/doc/man/queue.html</a><br><br></div>There were several other examples that might help.<br><br></div>-wes<br><div><div><br> </div></div></div>