Module service

Service Behaviour

A minimal behaviour for creating CloudI internal services.

Copyright © 2013-2015 Michael Truog

Version: 1.5.0 Dec 23 2015 13:50:35 ------------------------------------------------------------------------

This module defines the service behaviour.
Required callback functions: service_config/0, service_init/4, service_request/3, service_info/3, service_terminate/3.

Authors: Michael Truog (mjtruog [at] gmail (dot) com).

Description

Service Behaviour

A minimal behaviour for creating CloudI internal services.
   The user module should export:
  
     service_init(Args, Prefix, Timeout, Dispatcher)
      ==> {ok, State}
          {stop, Reason}
          {stop, Reason, State}
  
     service_request(ServiceReq, State, Dispatcher)
      ==> {reply, Response, NewState}
          {reply, ResponseInfo, Response, NewState}
          {forward, NextServiceReq, NewState}
          {noreply, NewState}
          {stop, Reason, NewState}
                 Reason = normal | shutdown | Term terminate(State) is called
  
     service_info(Request, State, Dispatcher)
  
      ==> {noreply, State}
          {stop, Reason, NewState}
                 Reason = normal | shutdown | Term, terminate(State) is called
  
     service_terminate(Reason, Timeout, State) Let the user module clean up
          always called when the service terminates
  
      ==> ok
  
  
   The work flow (of the service) can be described as follows:
  
      User module                                          Generic
      -----------                                          -------
      service_init                     <-----              .
  
                                                           loop
      service_request                  <-----              .
                                       ----->              reply
  
      service_info                     <-----              .
  
      service_terminate                <-----              .

Data Types

dict_proxy()

dict_proxy(Key, Value) = dict:dict(Key, Value)

dispatcher()

dispatcher() = cloudi_service:dispatcher()

key_values()

key_values() = cloudi_service:key_values()

pattern_pid()

pattern_pid() = cloudi_service:pattern_pid()

priority()

priority() = cloudi_service:priority()

request()

request() = cloudi_service:request()

request_info()

request_info() = cloudi_service:request_info()

request_type()

request_type() = cloudi_service:request_type()

response()

response() = cloudi_service:response()

response_info()

response_info() = cloudi_service:response_info()

service_name()

service_name() = cloudi_service:service_name()

service_name_pattern()

service_name_pattern() = cloudi_service:service_name_pattern()

service_req()

service_req() = #service_req{type = undefined | cloudi_service:request_type(), name = undefined | cloudi_service:service_name(), pattern = undefined | cloudi_service:service_name_pattern(), request_info = undefined | cloudi_service:request_info(), request = undefined | cloudi_service:request(), timeout = undefined | cloudi_service:timeout_milliseconds(), priority = undefined | cloudi_service:priority(), trans_id = undefined | cloudi_service:trans_id(), pid = undefined | cloudi_service:source() | cloudi_service:pattern_pid()}

source()

source() = cloudi_service:source()

timeout_milliseconds()

timeout_milliseconds() = cloudi_service:timeout_milliseconds()

trans_id()

trans_id() = cloudi_service:trans_id()

Function Index

'Module:service_info'/3

Handle an incoming Erlang message.

The info_pid_uses and info_pid_options service configuration options control the Erlang process used to call this function.
'Module:service_init'/4

Initialize the internal service.

Create the internal service state.
'Module:service_request'/3

Handle an incoming service request.

The request_pid_uses and request_pid_options service configuration options control the Erlang process used to call this function.
'Module:service_terminate'/3

Handle service termination.

cloudi_service_terminate/2 is always called, even when cloudi_service_init/3 returns a stop tuple.
add/1
add/2
context_options/1

Get the context options from the service's configuration.

A service would only use this when delaying the creation of a context for child processes.
destination_refresh_immediate/1

Configured service destination refresh is immediate.

.
destination_refresh_lazy/1

Configured service destination refresh is lazy.

.
forward/2

Forward a service request.

.
forward/9

Forward a service request.

.
forward_async/2

Forward an asynchronous service request.

.
forward_async/8

Forward an asynchronous service request.

.
forward_sync/2

Forward a synchronous service request.

.
forward_sync/8

Forward a synchronous service request.

.
get_pid/2

Get a service destination based on a service name.

.
get_pid/3

Get a service destination based on a service name.

.
get_pids/2

Get all service destinations based on a service name.

.
get_pids/3

Get a service destination based on a service name.

.
key_value_erase/2(Deprecated.)
key_value_find/2(Deprecated.)
key_value_store/3(Deprecated.)
mcast_async/2

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async/3

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async/4

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async/6

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async_active/2

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async_active/3

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async_active/4

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async_active/6

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.
mcast_async_passive/2

Send a multicast asynchronous service request.

An alias for mcast_async.
mcast_async_passive/3

Send a multicast asynchronous service request.

An alias for mcast_async.
mcast_async_passive/4

Send a multicast asynchronous service request.

An alias for mcast_async.
mcast_async_passive/6

Send a multicast asynchronous service request.

An alias for mcast_async.
prefix/1

Configured service default prefix.

All subscribed/unsubscribed service names use this prefix.
priority_default/1

Configured service default priority.

.
process_index/1

Return the index of this instance of the service.

The configuration of the service defined how many instances should exist.
recv_async/1

Receive an asynchronous service request.

Use a null TransId to receive the oldest service request.
recv_async/2

Receive an asynchronous service request.

Either use the supplied TransId to receive the specific service request or use a null TransId to receive the oldest service request.
recv_async/3

Receive an asynchronous service request.

Either use the supplied TransId to receive the specific service request or use a null TransId to receive the oldest service request.
recv_async/4

Receive an asynchronous service request.

.
recv_asyncs/2

Receive asynchronous service requests.

.
recv_asyncs/3

Receive asynchronous service requests.

.
recv_asyncs/4

Receive asynchronous service requests.

.
remove/1
remove/2
request_http_qs_parse/1(Deprecated.)
request_info_key_value_new/1(Deprecated.)
request_info_key_value_parse/1(Deprecated.)
return/2

Return a service response.

.
return/3

Return a service response.

.
return/9

Return a service response.

.
return_async/8

Return an asynchronous service response.

.
return_nothrow/3

Return a service response without exiting the request handler.

Should rarely, if ever, be used.
return_nothrow/4

Return a service response without exiting the request handler.

Should rarely, if ever, be used.
return_nothrow/9

Return a service response without exiting the request handler.

Should rarely, if ever, be used.
return_sync/8

Return a synchronous service response.

.
self/1

Return the Erlang pid representing the service.

.
send/2

Send an asynchronous service request.

.
send_async/2

Send an asynchronous service request.

.
send_async/3

Send an asynchronous service request.

.
send_async/4

Send an asynchronous service request.

.
send_async/5

Send an asynchronous service request.

.
send_async/6

Send an asynchronous service request.

.
send_async/7

Send an asynchronous service request.

.
send_async_active/2

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}
send_async_active/3

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}
send_async_active/4

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}
send_async_active/5

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}
send_async_active/6

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}
send_async_active/7

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}
send_async_passive/2

Send an asynchronous service request.

An alias for send_async.
send_async_passive/3

Send an asynchronous service request.

An alias for send_async.
send_async_passive/4

Send an asynchronous service request.

An alias for send_async.
send_async_passive/5

Send an asynchronous service request.

An alias for send_async.
send_async_passive/6

Send an asynchronous service request.

An alias for send_async.
send_async_passive/7

Send an asynchronous service request.

An alias for send_async.
send_sync/2

Send a synchronous service request.

.
send_sync/3

Send a synchronous service request.

.
send_sync/4

Send a synchronous service request.

.
send_sync/5

Send a synchronous service request.

.
send_sync/6

Send a synchronous service request.

.
send_sync/7

Send a synchronous service request.

.
service_name_parse/2(Deprecated.)
service_name_parse_with_suffix/2(Deprecated.)
source_subscriptions/2

Get a list of all service name patterns a service request source is subscribed to.

.
subscribe/2

Subscribe to a service name pattern.

.
suffix/2

Service request suffix from a service name or service name pattern.

.
timeout_async/1

Configured service default asynchronous timeout (in milliseconds).

.
timeout_max/1

Maximum possible service request timeout (in milliseconds).

.
timeout_sync/1

Configured service default synchronous timeout (in milliseconds).

.
trans_id/1

Return a new transaction id.

The same data as used when sending service requests is used.
trans_id_age/1

Return the age of the transaction id.

The result is microseconds since the Unix epoch 1970-01-01 00:00:00.
unsubscribe/2

Unsubscribe from a service name pattern.

.

Function Details

'Module:service_info'/3

'Module:service_info'(Request::any(), State::any(), Dispatcher::cloudi_service:dispatcher()) -> {noreply, NewState::any()} | {stop, Reason::any(), NewState::any()}

Handle an incoming Erlang message.

The info_pid_uses and info_pid_options service configuration options control the Erlang process used to call this function.

'Module:service_init'/4

'Module:service_init'(Args::list(), Prefix::cloudi_service:service_name_pattern(), Timeout::cloudi_service_api:timeout_milliseconds(), Dispatcher::cloudi_service:dispatcher()) -> {ok, State::any()} | {stop, Reason::any()} | {stop, Reason::any(), State::any()}

Initialize the internal service.

Create the internal service state. Do any initial service subscriptions necessary. Send service requests, if required for service initialization.

'Module:service_request'/3

'Module:service_request'(ServiceReq::service_req(), State::any(), Dispatcher::cloudi_service:dispatcher()) -> {reply, Response::cloudi_service:response(), NewState::any()} | {reply, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), NewState::any()} | {forward, NextServiceReq::service_req(), NewState::any()} | {noreply, NewState::any()} | {stop, Reason::any(), NewState::any()}

Handle an incoming service request.

The request_pid_uses and request_pid_options service configuration options control the Erlang process used to call this function.

'Module:service_terminate'/3

'Module:service_terminate'(Reason::any(), Timeout::cloudi_service_api:timeout_milliseconds(), State::any()) -> ok

Handle service termination.

cloudi_service_terminate/2 is always called, even when cloudi_service_init/3 returns a stop tuple. When State is unset in the stop tuple, the cloudi_service_terminate/2 function is called with State equal to 'undefined'. Always calling the cloudi_service_terminate/2 function differs from how Erlang/OTP behaviours handle the init/1 function returning a stop tuple, but this approach can help prevent problems managing any global state that might exist that is connected to a service, or simply services that are only partially initialized.

add/1

add(Module::module()) -> {ok, ServiceId::cloudi_service_api:service_id()} | {error, any()}

add/2

add(Module::module(), Timeout::cloudi_service_api:timeout_milliseconds() | infinity) -> {ok, ServiceId::cloudi_service_api:service_id()} | {error, any()}

context_options/1

context_options(Dispatcher::cloudi_service:dispatcher()) -> cloudi:options()

Get the context options from the service's configuration.

A service would only use this when delaying the creation of a context for child processes.

destination_refresh_immediate/1

destination_refresh_immediate(Context::cloudi_service:dispatcher()) -> boolean()

Configured service destination refresh is immediate.

destination_refresh_lazy/1

destination_refresh_lazy(Context::cloudi_service:dispatcher()) -> boolean()

Configured service destination refresh is lazy.

forward/2

forward(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> no_return()

Forward a service request.

forward/9

forward(Dispatcher::cloudi_service:dispatcher(), Type::cloudi_service:request_type(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds(), Priority::cloudi_service:priority(), TransId::cloudi_service:trans_id(), Pid::pid()) -> no_return()

Forward a service request.

forward_async/2

forward_async(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> no_return()

Forward an asynchronous service request.

forward_async/8

forward_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds(), Priority::cloudi_service:priority(), TransId::cloudi_service:trans_id(), Pid::pid()) -> no_return()

Forward an asynchronous service request.

forward_sync/2

forward_sync(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> no_return()

Forward a synchronous service request.

forward_sync/8

forward_sync(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds(), Priority::cloudi_service:priority(), TransId::cloudi_service:trans_id(), Pid::pid()) -> no_return()

Forward a synchronous service request.

get_pid/2

get_pid(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name()) -> {ok, PatternPid::cloudi_service:pattern_pid()} | {error, Reason::atom()}

Get a service destination based on a service name.

get_pid/3

get_pid(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, PatternPid::cloudi_service:pattern_pid()} | {error, Reason::atom()}

Get a service destination based on a service name.

get_pids/2

get_pids(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name()) -> {ok, PatternPids::[cloudi_service:pattern_pid()]} | {error, Reason::atom()}

Get all service destinations based on a service name.

get_pids/3

get_pids(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, PatternPids::[cloudi_service:pattern_pid()]} | {error, Reason::atom()}

Get a service destination based on a service name.

key_value_erase/2

key_value_erase(Key::any(), KeyValues::cloudi_service:key_values()) -> NewKeyValues::cloudi_service:key_values()

This function is deprecated: Use cloudi_key_value:erase/2 instead

key_value_find/2

key_value_find(Key::any(), KeyValues::cloudi_service:key_values()) -> {ok, Value::any()} | error

This function is deprecated: Use cloudi_key_value:find/2 instead

key_value_store/3

key_value_store(Key::any(), Value::any(), KeyValues::cloudi_service:key_values()) -> NewKeyValues::cloudi_service:key_values()

This function is deprecated: Use cloudi_key_value:store/3 instead

mcast_async/2

mcast_async(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.

mcast_async/3

mcast_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request()) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.

mcast_async/4

mcast_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.

mcast_async/6

mcast_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination.

mcast_async_active/2

mcast_async_active(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination. The responses are sent to the service as Erlang messages that are either: #return_async_active{} (or) #timeout_async_active{}

mcast_async_active/3

mcast_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request()) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination. The responses are sent to the service as Erlang messages that are either: #return_async_active{} (or) #timeout_async_active{}

mcast_async_active/4

mcast_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination. The responses are sent to the service as Erlang messages that are either: #return_async_active{} (or) #timeout_async_active{}

mcast_async_active/6

mcast_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

Asynchronous service requests are sent to all services that have subscribed to the service name pattern that matches the destination. The responses are sent to the service as Erlang messages that are either: #return_async_active{} (or) #timeout_async_active{}

mcast_async_passive/2

mcast_async_passive(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, TransId::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

An alias for mcast_async. The asynchronous service requests are returned and handled the same way as within external services.

mcast_async_passive/3

mcast_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request()) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

An alias for mcast_async. The asynchronous service requests are returned and handled the same way as within external services.

mcast_async_passive/4

mcast_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

An alias for mcast_async. The asynchronous service requests are returned and handled the same way as within external services.

mcast_async_passive/6

mcast_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined) -> {ok, TransIdList::[cloudi_service:trans_id()]} | {error, Reason::atom()}

Send a multicast asynchronous service request.

An alias for mcast_async. The asynchronous service requests are returned and handled the same way as within external services.

prefix/1

prefix(Dispatcher::cloudi_service:dispatcher()) -> Prefix::cloudi_service:service_name_pattern()

Configured service default prefix.

All subscribed/unsubscribed service names use this prefix. The prefix defines the scope of the service.

priority_default/1

priority_default(Context::cloudi_service:dispatcher()) -> PriorityDefault::cloudi_service_api:priority()

Configured service default priority.

process_index/1

process_index(Dispatcher::cloudi_service:dispatcher()) -> ProcessIndex::non_neg_integer()

Return the index of this instance of the service.

The configuration of the service defined how many instances should exist.

recv_async/1

recv_async(Dispatcher::cloudi_service:dispatcher()) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Receive an asynchronous service request.

Use a null TransId to receive the oldest service request.

recv_async/2

recv_async(Dispatcher::cloudi_service:dispatcher(), Param1::cloudi_service:timeout_milliseconds() | cloudi_service:trans_id()) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Receive an asynchronous service request.

Either use the supplied TransId to receive the specific service request or use a null TransId to receive the oldest service request.

recv_async/3

recv_async(Dispatcher::cloudi_service:dispatcher(), Param1::cloudi_service:timeout_milliseconds() | cloudi_service:trans_id(), Param2::cloudi_service:trans_id() | boolean()) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Receive an asynchronous service request.

Either use the supplied TransId to receive the specific service request or use a null TransId to receive the oldest service request.

recv_async/4

recv_async(Dispatcher::cloudi_service:dispatcher(), Timeout::cloudi_service:timeout_milliseconds(), TransId::cloudi_service:trans_id(), Consume::boolean()) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Receive an asynchronous service request.

recv_asyncs/2

recv_asyncs(Dispatcher::cloudi_service:dispatcher(), TransIdList::[cloudi_service:trans_id()]) -> {ok, [{ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), TransId::cloudi_service:trans_id()}]} | {error, Reason::atom()}

Receive asynchronous service requests.

recv_asyncs/3

recv_asyncs(Dispatcher::cloudi_service:dispatcher(), Timeout::cloudi_service:timeout_milliseconds() | undefined, TransIdList::[cloudi_service:trans_id()]) -> {ok, [{ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), TransId::cloudi_service:trans_id()}]} | {error, Reason::atom()}

Receive asynchronous service requests.

recv_asyncs/4

recv_asyncs(Dispatcher::cloudi_service:dispatcher(), Timeout::cloudi_service:timeout_milliseconds(), TransIdList::[cloudi_service:trans_id()], Consume::boolean()) -> {ok, [{ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), TransId::cloudi_service:trans_id()}]} | {error, Reason::atom()}

Receive asynchronous service requests.

remove/1

remove(ServiceId::cloudi_service_api:service_id()) -> ok | {error, any()}

remove/2

remove(ServiceId::cloudi_service_api:service_id(), Timeout::cloudi_service_api:timeout_milliseconds() | infinity) -> ok | {error, any()}

request_http_qs_parse/1

request_http_qs_parse(Request::binary()) -> Result::dict_proxy(binary(), binary())

This function is deprecated: Use cloudi_request:http_qs_parse/1 instead

request_info_key_value_new/1

request_info_key_value_new(RequestInfo::cloudi_service:key_values()) -> Result::binary()

This function is deprecated: Use cloudi_request_info:key_value_new/1 instead

request_info_key_value_parse/1

request_info_key_value_parse(RequestInfo::binary() | list()) -> Result::dict_proxy(any(), any())

This function is deprecated: Use cloudi_request_info:key_value_parse/1 instead

return/2

return(Dispatcher::cloudi_service:dispatcher(), Response::cloudi_service:response()) -> no_return()

Return a service response.

return/3

return(Dispatcher::cloudi_service:dispatcher(), ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response()) -> no_return()

Return a service response.

return/9

return(Dispatcher::cloudi_service:dispatcher(), Type::cloudi_service:request_type(), Name::cloudi_service:service_name(), Pattern::cloudi_service:service_name_pattern(), ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), Timeout::cloudi_service:timeout_milliseconds(), TransId::cloudi_service:trans_id(), Pid::pid()) -> no_return()

Return a service response.

return_async/8

return_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Pattern::cloudi_service:service_name_pattern(), ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), Timeout::cloudi_service:timeout_milliseconds(), TransId::cloudi_service:trans_id(), Pid::pid()) -> no_return()

Return an asynchronous service response.

return_nothrow/3

return_nothrow(Dispatcher::cloudi_service:dispatcher(), Response::cloudi_service:response(), ServiceReq::service_req()) -> ok

Return a service response without exiting the request handler.

Should rarely, if ever, be used. If the service has the option request_timeout_adjustment == true, the adjustment will not occur when this function is used.

return_nothrow/4

return_nothrow(Dispatcher::cloudi_service:dispatcher(), ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), ServiceReq::service_req()) -> ok

Return a service response without exiting the request handler.

Should rarely, if ever, be used. If the service has the option request_timeout_adjustment == true, the adjustment will not occur when this function is used.

return_nothrow/9

return_nothrow(Dispatcher::cloudi_service:dispatcher(), Type::cloudi_service:request_type(), Name::cloudi_service:service_name(), Pattern::cloudi_service:service_name_pattern(), ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), Timeout::cloudi_service:timeout_milliseconds(), TransId::cloudi_service:trans_id(), Pid::pid()) -> ok

Return a service response without exiting the request handler.

Should rarely, if ever, be used. If the service has the option request_timeout_adjustment == true, the adjustment will not occur when this function is used.

return_sync/8

return_sync(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Pattern::cloudi_service:service_name_pattern(), ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response(), Timeout::cloudi_service:timeout_milliseconds(), TransId::cloudi_service:trans_id(), Pid::pid()) -> no_return()

Return a synchronous service response.

self/1

self(Dispatcher::cloudi_service:dispatcher()) -> Self::pid()

Return the Erlang pid representing the service.

send/2

send(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

send_async/2

send_async(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

send_async/3

send_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request()) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

send_async/4

send_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

send_async/5

send_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

send_async/6

send_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

send_async/7

send_async(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

send_async_active/2

send_async_active(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}

send_async_active/3

send_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request()) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}

send_async_active/4

send_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}

send_async_active/5

send_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}

send_async_active/6

send_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}

send_async_active/7

send_async_active(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

The response is sent to the service as an Erlang message which is either: #return_async_active{} (or) #timeout_async_active{}

send_async_passive/2

send_async_passive(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

An alias for send_async. The asynchronous service request is returned and handled the same way as within external services.

send_async_passive/3

send_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request()) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

An alias for send_async. The asynchronous service request is returned and handled the same way as within external services.

send_async_passive/4

send_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

An alias for send_async. The asynchronous service request is returned and handled the same way as within external services.

send_async_passive/5

send_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

An alias for send_async. The asynchronous service request is returned and handled the same way as within external services.

send_async_passive/6

send_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

An alias for send_async. The asynchronous service request is returned and handled the same way as within external services.

send_async_passive/7

send_async_passive(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, TransId::cloudi_service:trans_id()} | {error, Reason::atom()}

Send an asynchronous service request.

An alias for send_async. The asynchronous service request is returned and handled the same way as within external services.

send_sync/2

send_sync(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response()} | {ok, Response::cloudi_service:response()} | {error, Reason::atom()}

Send a synchronous service request.

send_sync/3

send_sync(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request()) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response()} | {ok, Response::cloudi_service:response()} | {error, Reason::atom()}

Send a synchronous service request.

send_sync/4

send_sync(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response()} | {ok, Response::cloudi_service:response()} | {error, Reason::atom()}

Send a synchronous service request.

send_sync/5

send_sync(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response()} | {ok, Response::cloudi_service:response()} | {error, Reason::atom()}

Send a synchronous service request.

send_sync/6

send_sync(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response()} | {ok, Response::cloudi_service:response()} | {error, Reason::atom()}

Send a synchronous service request.

send_sync/7

send_sync(Dispatcher::cloudi_service:dispatcher(), Name::cloudi_service:service_name(), RequestInfo::cloudi_service:request_info(), Request::cloudi_service:request(), Timeout::cloudi_service:timeout_milliseconds() | undefined, Priority::cloudi_service:priority() | undefined, PatternPid::cloudi_service:pattern_pid() | undefined) -> {ok, ResponseInfo::cloudi_service:response_info(), Response::cloudi_service:response()} | {ok, Response::cloudi_service:response()} | {error, Reason::atom()}

Send a synchronous service request.

service_name_parse/2

service_name_parse(Name::string(), Pattern::string()) -> [string()] | error

This function is deprecated: Use cloudi_service_name:parse/2 instead

service_name_parse_with_suffix/2

service_name_parse_with_suffix(Name::string(), Pattern::string()) -> {[string()], string()} | error

This function is deprecated: Use cloudi_service_name:parse_with_suffix/2 instead

source_subscriptions/2

source_subscriptions(Dispatcher::cloudi_service:dispatcher(), ServiceReq::service_req()) -> [cloudi_service:service_name_pattern()]

Get a list of all service name patterns a service request source is subscribed to.

subscribe/2

subscribe(Dispatcher::cloudi_service:dispatcher(), Pattern::cloudi_service:service_name_pattern()) -> ok

Subscribe to a service name pattern.

suffix/2

suffix(Dispatcher::cloudi_service:dispatcher(), NameOrPattern::cloudi_service:service_name() | cloudi_service:service_name_pattern()) -> Suffix::cloudi_service:service_name() | cloudi_service:service_name_pattern()

Service request suffix from a service name or service name pattern.

timeout_async/1

timeout_async(Dispatcher::cloudi_service:dispatcher()) -> TimeoutAsync::cloudi_service_api:timeout_milliseconds()

Configured service default asynchronous timeout (in milliseconds).

timeout_max/1

timeout_max(Context::cloudi_service:dispatcher()) -> TimeoutMax::cloudi_service_api:timeout_milliseconds()

Maximum possible service request timeout (in milliseconds).

timeout_sync/1

timeout_sync(Dispatcher::cloudi_service:dispatcher()) -> TimeoutSync::cloudi_service_api:timeout_milliseconds()

Configured service default synchronous timeout (in milliseconds).

trans_id/1

trans_id(Dispatcher::cloudi_service:dispatcher()) -> trans_id()

Return a new transaction id.

The same data as used when sending service requests is used.

trans_id_age/1

trans_id_age(TransId::trans_id()) -> non_neg_integer()

Return the age of the transaction id.

The result is microseconds since the Unix epoch 1970-01-01 00:00:00.

unsubscribe/2

unsubscribe(Dispatcher::cloudi_service:dispatcher(), Pattern::cloudi_service:service_name_pattern()) -> ok | error

Unsubscribe from a service name pattern.


Generated by EDoc, Dec 23 2015, 13:50:35.