leo_mq_server

The gen_server process for the process of a mq as part of a supervision tree.

Behaviours: `gen_server <gen_server.html>`__.

References

Description

The gen_server process for the process of a mq as part of a supervision tree

Function Index

close/1 get state from the queue.
code_change/3 Convert process state when code is changed.
consume/1 Consume a message from the queue.
handle_call/3 gen_server callback - Module:handle_call(Request, From, State) -> Result.
handle_cast/2 gen_server callback - Module:handle_cast(Request, State) -> Result.
handle_info/2 gen_server callback - Module:handle_info(Info, State) -> Result.
init/1 gen_server callback - Module:init(Args) -> Result.
publish/3 Register a queuing data.
start_link/2 Creates the gen_server process as part of a supervision tree.
status/1 Retrieve the current state from the queue.
stop/1 Close the process.
terminate/2 This function is called by a gen_server when it is about to terminate.

Function Details

close/1

close(Id) -> ok

  • Id = atom()

get state from the queue.

code_change/3

code_change(OldVsn, State, Extra) -> any()

Convert process state when code is changed

gen_server callback - Module:code_change(OldVsn, State, Extra) -> {ok, NewState} | {error, Reason}.

consume/1

consume(Id) -> ok | {error, any()}

  • Id = atom()

Consume a message from the queue.

handle_call/3

handle_call(X1, From, State) -> any()

gen_server callback - Module:handle_call(Request, From, State) -> Result

handle_cast/2

handle_cast(Msg, State) -> any()

gen_server callback - Module:handle_cast(Request, State) -> Result

handle_info/2

handle_info(Info, State) -> any()

gen_server callback - Module:handle_info(Info, State) -> Result

init/1

init(X1) -> any()

gen_server callback - Module:init(Args) -> Result

publish/3

publish(Id, KeyBin, MessageBin) -> ok | {error, any()}

  • Id = atom()
  • KeyBin = binary()
  • MessageBin = binary()

Register a queuing data.

status/1

status(Id) -> {ok, list()}

  • Id = atom()

Retrieve the current state from the queue.

stop/1

stop(Id) -> ok | {error, any()}

  • Id = atom()

Close the process

terminate/2

terminate(Reason, State) -> any()

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

gen_server callback - Module:terminate(Reason, State)