PhoenixGenApi.Executor (PhoenixGenApi v0.0.13)

View Source

This module is the core of PhoenixGenApi. It will execute the request from client and return the response. Response can be sync, async, or stream.

This module will handle the request, check permission, convert args, and call the remote node.

If the function is local, it will call the function directly. If the function is remote, it will call the function via RPC.

If the function is sync, it will call the function and return the response immediately. If the function is async, it will spawn a new process to call the function and return the response immediately. If the function is stream, it will start a new process to handle the stream and return the response immediately.

for case async and stream, the response will be sent to the client later Channel process will receive the response and send it to the client.

Summary

Functions

Async call a request support for async/none response.

Execute a request.

Execute a request from params. Params is a map from playload in Phoenix Channel event (handle_in). Function will raise an error if something wrong.

Stream call a request support for stream response.

Functions

async_call(request, fun_config)

Async call a request support for async/none response.

call(request, fun_config)

execute!(request)

Execute a request.

execute_params!(params)

@spec execute_params!(map()) :: PhoenixGenApi.Structs.Response.t()

Execute a request from params. Params is a map from playload in Phoenix Channel event (handle_in). Function will raise an error if something wrong.

Params:

  • request_id: String.t()
  • request_type: String.t()
  • user_id: String.t()
  • device_id: String.t()
  • args: map()

stream_call(request, fun_config)

Stream call a request support for stream response.