<div dir="ltr">Sorry, that wasn't meant to be a put down. It contains the answer to your other question though (what "permanent" means).<div><br></div><div>As for the second question, try it and see :)</div><div class="gmail_extra"><br><div class="gmail_quote">On 15 October 2014 17:04, Curtis J Schofield (ram9) <span dir="ltr"><<a href="mailto:curtis@ram9.cc" target="_blank">curtis@ram9.cc</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you Graham.<br>
<br>
I have read this page - in the example it uses a 'gen_server' for the<br>
module - which still leaves me with my above question. I'm not sure<br>
what you are trying to communicate with this webpage.<br>
<br>
Learn You Some Erlang has been a helpful resource.<br>
<br>
For example from the page:<br>
"StartFunc is a tuple that tells how to start the supervisor. It's the<br>
standard {M,F,A} format we've used a few times already. Note that it<br>
is very important that the starting function here is OTP-compliant and<br>
links to its caller when executed (hint: use gen_*:start_link()<br>
wrapped in your own module, all the time)."<br>
<br>
<br>
for example<br>
<a href="https://github.com/robotarmy/amqresearch/blob/master/send/src/sender_worker.erl" target="_blank">https://github.com/robotarmy/amqresearch/blob/master/send/src/sender_worker.erl</a><br>
<br>
What I am trying to learn is how to make sure that my function 'F'<br>
boot_send() is correctly compliant, or my module is correctly<br>
compliant.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Wed, Oct 15, 2014 at 8:47 AM, Graham Hay <<a href="mailto:grahamrhay@gmail.com">grahamrhay@gmail.com</a>> wrote:<br>
> <a href="http://learnyousomeerlang.com/supervisors" target="_blank">http://learnyousomeerlang.com/supervisors</a><br>
><br>
> On 15 October 2014 16:32, Curtis J Schofield (ram9) <curtis@ram9.cc> wrote:<br>
>><br>
>> Thank you Vance. That does indeed work - I think I want 'permanent' so<br>
>> that the worker comes back if the application crashes - is it as<br>
>> simple as that?<br>
>><br>
>> My question about ChildSpec is about 'Module' and the erlang docs.<br>
>><br>
>> From the erlang docs:<br>
>> "Modules is used by the release handler during code replacement to<br>
>> determine which processes are using a certain module. As a rule of<br>
>> thumb Modules should be a list with one element [Module], where Module<br>
>> is the callback module, if the child process is a supervisor,<br>
>> gen_server or gen_fsm."<br>
>><br>
>> My 'sender_worker' is just a module - it is not a supervisor,<br>
>> gen_server or gen_fsm. Is there some specific interface that the<br>
>> module function 'boot_send' needs to conform to - or is returning {ok,<br>
>> Pid} what it needs to do?<br>
>><br>
>><br>
>><br>
>> On Tue, Oct 14, 2014 at 9:34 PM, Vance Shipley <<a href="mailto:vances@motivity.ca">vances@motivity.ca</a>> wrote:<br>
>> ><br>
>> > On Wed, Oct 15, 2014 at 5:50 AM, Curtis J Schofield (ram9)<br>
>> > <curtis@ram9.cc><br>
>> > wrote:<br>
>> >><br>
>> >> I have been able to create a simple application with a supervisor and<br>
>> >> spawn<br>
>> >> and link a child process. I feel like I have 'hacked' it and would<br>
>> >> like to hear what the ideomatic way of this is.<br>
>> >><br>
>> >      init([]) -><br>
>> >          {ok, Pid} = sender_worker:boot_send(),<br>
>> >          link(Pid),<br>
>> >          Pids = [],<br>
>> >          {ok, {{one_for_one, 1, 5}, Pids}}.<br>
>> ><br>
>> > The supervisor behaviour encapsulates process creation and linking.  All<br>
>> > you<br>
>> > need to do is specify the process to create in a child specification:<br>
>> ><br>
>> >      {Id, StartFunc, Restart, Shutdown, Type, Modules}<br>
>> ><br>
>> > So just:<br>
>> ><br>
>> >      init([]) -><br>
>> >           StartMod = sender_worker,<br>
>> >           ChildSpec = {StartMod, {StartMod, boot_send, []}, temporary,<br>
>> > 4,<br>
>> > worker, [StartMod]},<br>
>> >           {ok, {{one_for_one, 1, 5}, [ChildSpec]}}.<br>
>> ><br>
>> > --<br>
>> >      -Vance<br>
>> ><br>
>> > On Wed, Oct 15, 2014 at 5:50 AM, Curtis J Schofield (ram9)<br>
>> > <curtis@ram9.cc><br>
>> > wrote:<br>
>> >><br>
>> >> Hi - I'm a beginner and am requesting feedback on some code I wrote.<br>
>> >><br>
>> >> I haven't  been able to deduce 'the otp way' to build a worker process.<br>
>> >>  ( this worker generates some garbage and puts it into rabbitmq)<br>
>> >><br>
>> >> I have been able to create a simple application with a supervisor and<br>
>> >> spawn<br>
>> >> and link a child process. I feel like I have 'hacked' it and would<br>
>> >> like to hear what the ideomatic way of this is.<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> <a href="https://github.com/robotarmy/amqresearch/blob/master/send/src/sender_sup.erl" target="_blank">https://github.com/robotarmy/amqresearch/blob/master/send/src/sender_sup.erl</a><br>
>> >><br>
>> >><br>
>> >><br>
>> >> <a href="https://github.com/robotarmy/amqresearch/blob/master/send/src/sender_worker.erl" target="_blank">https://github.com/robotarmy/amqresearch/blob/master/send/src/sender_worker.erl</a><br>
>> >><br>
>> >><br>
>> >> Feedback on my code would be appreciated.<br>
>> >><br>
>> >><br>
>> >> --<br>
>> >> ---<br>
>> >> Modern Yoga vs Traditional Yoga<br>
>> >> <a href="http://swamij.com/traditional-yoga.htm#swamirama" target="_blank">http://swamij.com/traditional-yoga.htm#swamirama</a><br>
>> >> _______________________________________________<br>
>> >> erlang-questions mailing list<br>
>> >> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> >> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > --<br>
>> >      -Vance<br>
>><br>
>><br>
>><br>
>> --<br>
>> ---<br>
>> Modern Yoga vs Traditional Yoga<br>
>> <a href="http://swamij.com/traditional-yoga.htm#swamirama" target="_blank">http://swamij.com/traditional-yoga.htm#swamirama</a><br>
>> _______________________________________________<br>
>> erlang-questions mailing list<br>
>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
---<br>
Modern Yoga vs Traditional Yoga<br>
<a href="http://swamij.com/traditional-yoga.htm#swamirama" target="_blank">http://swamij.com/traditional-yoga.htm#swamirama</a><br>
</div></div></blockquote></div><br></div></div>