[ejabberd] Jabber-RPC module : architecture questions

Eric Cestari eric at ohmforce.com
Tue Sep 11 20:06:42 MSD 2007

Hi all,

I am currently developping a Jabber-RPC module for ejabber, basically  
to use mnesia as a storage layer and ejabberd as the broker.

I have it working by reusing some parts of the xmlrpc module.

Basically, I have a mod_rpc in charge of parsing JabberRPC queries  
and transforming them into method calls.

When I send :

<iq type='set'
     from='cstar at localhost'
     to='mod_rpc_test at rpc.localhost'
   <query xmlns='jabber:iq:rpc'>

It will call the handle/2 method of the mod_rpc_test module (the  
username) with the following parameter :
	State, {mult, [6,6]}

which will return {ok, [36]} to my mod_rpc module, which will  
marshall it into xml.

For the time being,
- mod_rpc is gen_mod and gen_server, which means that I get only one  
process for mod_rpc and queries are queued on it (right ?)

- mod_rpc_test, containing my functions, is just a plain module, with  
no behaviors. so my mult method is called in the mod_rpc process  
(right ?)

Another approach, maybe :
Is there an OTP/ejabberd-approved way of creating a process for  each  
client RPC query  without queueing to a specific process ?
(pointers in ejabberd-trunk code welcome :)

I expect my xmlrpc queries to be stateless, so I think going the  
gen_fsm way is useless ...

I am still trying to get my head around it, so if you need  
precisions, please ask.


More information about the ejabberd mailing list