MySQL integration

ejabberd looks great and I'm interested in using it on a large project I am working on. The only sticking point I can currently see is the lack of integration with other databases.

My project will require integration with a MySQL user database. My current plan is to mirror relevant actions to the MySQL database in the Mnesia database. What would be the best way to do this? Should I connect from PHP through Jabber to the server or could ejabberd implement a SOAP interface?

I realise that it would be better is to use Jabber as a stand alone service, but this is not suitable for this project.

Thanks

What about a module that serves XML-RPC?

My project will require integration with a MySQL user database. My current plan is to mirror relevant actions to the MySQL database in the Mnesia database.

I understand as 'relevant actions':

  • create, remove user
  • change password
  • change name, surname, telephone... in the vcard
  • add/remove a new item to a user roster
All this is already available in ejabberd as functions, and can be called from anywhere in ejabberd: the web administration, ejabberd_ctl command line tool, Discovery...

For example, several of these actions are available from the ejabberd_ctl command line tool. It's easy to add new commands that fulfill your requirements. However, ejabberd_ctl starts a new Erlang virtual machine for every call, so if you plan to call it a lot (several times every minute), it's not the best solution.

Other possibility is to write a new module for ejabberd that starts a XML-RPC or SOAP server and provides functions to everything you want.

Should I connect from PHP through Jabber to the server or could ejabberd implement a SOAP interface?

That depends on what do you want to do and what information do you have:

  • Jabber: If you have the user password, you can act as if you were the legitimate user.
  • Jabber-admin: There's JEP-0133: Service Administration, but ejabberd does not implement it, I think.
  • XML-RPC, SOAP...: Full access, customizability...

I'm writting a XML-RPC server in Erlang (not related to ejabberd). Once I get some experience, I'd like to convert it as an ejabberd module. With minimum changes you'd have what you want, right?

XML-RPC

Thanks both for your feedback, I wrote a long reply here a little while ago, but it seems my post didn't show up.

All the options here seem to be good. Just a few more questions about each.

* ODBC - Would this have a major effect on the speed of the server? If calls were made on on log in and log out then this would not be an issue. In all probability the MySQL server will be on a seperate machine.
* XML-RPC - This seems to be the best option at the moment. Badlop, you said in another post (http://www.ejabberd.im/node/136) that you had finished the module. What features have been implemented? I would like to mirror changes in friends lists across the website and the Jabber, but if this is not possible then I can deal with that.

Thanks again for your help. I haven't ever dealt with erlang before, and I'm more for a web developer than a programmer so I'm slowly trying to figure this out.

consider releasing an example client

I've published it as mod_xmlrpc.

What features have been implemented?

Some calls to create user, change password and add roster item. Tell me if you need aditional calls like 'remove roster item', 'remove user' etc. There's no security in it yet.

Consider releasing the basic part of your client (only the section of it that deals with XML-RPC) so I can publish it as an example client to complement my server module.

"Consider releasing the basic

"Consider releasing the basic part of your client (only the section of it that deals with XML-RPC) so I can publish it as an example client to complement my server module."

No need to do that - we are planning to license Pandion, but the XMP-RPC calls would be made from the PHP code. If I did decide to use your module I could release the relevant parts.

I assume a roster item is a contact? If so then your feature list looks fine. I would like to be able to delete contacts and add groups (does ejabberd support groups?), but that is not too important.

I still haven't decided between XML-RPC or ODBC though. Can anyone tell me how running through ODBC would affect the performance.

You might be interested to kn

You might be interested to know that the odbc directory in cvs of ejabberd will use xdb_sql (Alexey said me). It will be only tested against PostgreSQL, but it probably will work (with maybe a few changes/patches) with every database supported by xdb_sql.

--
sander

"me too!"

I'm in a similiar boat here..what i want to do is modify a bot query and have a !search blah got and query a mysql database and return the information. I've got the python stuff working ok (i'm a newbie to python) but i'm struggling to work out how to make this execute as a bot query.any help would be splendid :)

Convert your Python code to a Neutron plugin

What about converting your Python code into a plugin for Neutron? There are a lot of plugins already written, so you have examples to look at.

Syndicate content