Skip to content

Instantly share code, notes, and snippets.

@puzza007
Created June 4, 2013 19:47
Show Gist options
  • Save puzza007/5708935 to your computer and use it in GitHub Desktop.
Save puzza007/5708935 to your computer and use it in GitHub Desktop.
puzza@Pauls-MacBookPro ~/src/cloudi-quickstart $ cat !$
cat hello_world.erl
-module(hello_world).
-behaviour(cloudi_service).
%% cloudi_service callbacks
-export([cloudi_service_init/3,
cloudi_service_handle_request/11,
cloudi_service_handle_info/3,
cloudi_service_terminate/2]).
-include_lib("cloudi_core/include/cloudi_logger.hrl").
-record(state, {}).
cloudi_service_init(_Args, _Prefix, Dispatcher) ->
cloudi_service:subscribe(Dispatcher, "hello_world/get").
cloudi_service_handle_request(_Type, _Name, _Pattern, _RequestInfo, _Request,
_Timeout, _Priority, _TransId, _Pid,
#state{} = State, _Dispatcher) ->
{reply, <<"Hello World!">>, State}.
cloudi_service_handle_info(Request, State, _) ->
?LOG_WARN("Unknown info \"~p\"", [Request]),
{noreply, State}.
cloudi_service_terminate(_, #state{}) ->
ok.
puzza@Pauls-MacBookPro ~/src/cloudi-quickstart $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment