Behaviours: gen_server
.
active/1 | Sets the connection active. |
active/2 | Sets the connection active. |
down/1 | Sets the connection as down. |
is_active/1 | Checks an ID. |
passive/1 | Sets the connection passive. |
passive/2 | Sets the connection passive. |
resolve_id/1 | Resolve from group ID. |
send/1 | Select a connection and send the stanza. |
send/2 | Send the stanza to the specific connection. |
start_link/2 | Starts the connection. |
stop/0 | Stops the connection. |
active(ID::atom()) -> {active, atom()}
Sets the connection active. This function will be used for activate the connections.
active(ID::atom(), Group::atom()) -> {active, atom()}
Sets the connection active. This function will be used for activate the connections. Adds a new parameter named Group for use only this name instead of the specific (or generated) names in case of pool is used.
down(ID::atom()) -> {down, atom()}
Sets the connection as down. This function will be used to report a down from the worker connection.
is_active(ID::atom()) -> boolean()
Checks an ID. If the connection is available as passive or down returns true, otherwise false.
passive(ID::atom()) -> {passive, atom()}
Sets the connection passive. This function will be used for activate as passive a connection.
passive(ID::atom(), Group::atom()) -> {passive, atom()}
Sets the connection passive. This function will be used for activate as passive a connection. Adds a new parameter named Group for use only this name instead of the specific (or generated) names in case of pool is used.
resolve_id(ID::atom()) -> atom()
Resolve from group ID. If the ID passed as param is a group, this function returns an element inside the group in round-robin. Else, you get the same atom.
send(Info::exmpp_xml:xmlel()) -> ok
Select a connection and send the stanza.
send(Info::exmpp_xml:xmlel(), ID::atom()) -> ok
Send the stanza to the specific connection. If the connection is not available the stanza will be sent to the first available connection in the active pool. If the active pool is empty, try to send the stanza to a passive connection. And finally if this is impossible, waits a moment (2000ms) and try again.
start_link(JID::ecomponent:jid(), Conf::proplists:proplist()) -> {ok, pid()} | ignore | {error, {already_started, pid()}} | {error, term()}
Starts the connection. The params needed to start the connection are a JID in string format and a proplists of configurations with server or node keys available inside, and others configurations more.
stop() -> ok
Stops the connection.