ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/Intro.pod
(Generate patch)

Comparing AnyEvent-MP/MP/Intro.pod (file contents):
Revision 1.35 by root, Mon Aug 31 17:54:22 2009 UTC vs.
Revision 1.36 by root, Mon Aug 31 18:37:40 2009 UTC

995 995
996If your head is spinning by now, that's fine - just keep in mind, after 996If your head is spinning by now, that's fine - just keep in mind, after
997creating a port, monitor "the other side" from it, and all will be cleaned 997creating a port, monitor "the other side" from it, and all will be cleaned
998up just fine. 998up just fine.
999 999
1000=head1 PART 4: Services 1000=head2 Services
1001 1001
1002#TODO 1002Above it was mentioned that C<spawn> automatically loads modules, and this
1003can be exploited in various ways.
1004
1005Assume for a moment you put the server into a file called
1006F<mymod/chatserver.pm> reachable from the current directory. Then you
1007could run a node there with:
1008
1009 aemp run
1010
1011The other nodes could C<spawn> the server by using
1012C<mymod::chatserver::client_connect> as init function.
1013
1014Likewise, when you have some service that starts automatically (similar to
1015AnyEvent::MP::Global), then you can configure this service statically:
1016
1017 aemp profile mysrvnode services mymod::service::
1018 aemp run profile mysrvnode
1019
1020And the module will automatically be started in the node.
1021
1022Of course, you can also do it in the much more standard way by writing
1023a module (e.g. C<BK::Backend::IRC>), installing it as part of a module
1024distribution and then configure nodes, for example, if I want to run the
1025Bummskraut IRC backend on a machine named "ruth", I could do this:
1026
1027 aemp profile ruth addservice BK::Backend::IRC::
1028
1029And any F<aemp run> on that host will automaticlaly have the bummskraut
1030irc backend running.
1031
1032That's plenty of possibilities you can use - it's all up to you how you
1033structure your application.
1003 1034
1004=head1 SEE ALSO 1035=head1 SEE ALSO
1005 1036
1006L<AnyEvent::MP> 1037L<AnyEvent::MP>
1007 1038

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines