如何使用MongoDB存储ejabberd消息? [英] how to use MongoDB for storing ejabberd messages?

查看:114
本文介绍了如何使用MongoDB存储ejabberd消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将ejabberd用作XMPP服务器.但是我希望存储通过服务器的消息,以及消息何时发送以及发送给谁和发送给谁.我用谷歌搜索,但是找不到如何做.帮助吗?

I am using ejabberd as an XMPP server. But i wish to store the messages that go through the server and also when was the message sent and to whom and by who. I googled it but could not find how to do it. Help?

推荐答案

您可能需要在Erlang中编写一个钩子.有关事件和挂钩的信息,请参见 ejabberd文档具体来说:

You probably need to write a hook in Erlang. See the ejabberd documentation for events and hooks Specifically this one :

user_send_packet(From, To, Packet) -> ok

使用用于mongodb的erlang驱动程序.如果这不可能"/太困难",我建议您调用一个PHP/Python/Ruby脚本,该脚本仅将消息存储到mongodb中.它很容易做到,但扩展性不会很好.

Use the erlang driver for mongodb . If that's "not possible"/"too difficult", i suggest you call a PHP/Python/Ruby script that just stores the message into mongodb. Its easy to do, but won't scale too well.

希望这会有所帮助.

一些链接: mongodb-erlang Erlang驱动程序示例

PS:自从我使用eJabberd以来已经有一段时间了.欢迎进行任何更正.

PS : It's been sometime since i used eJabberd. Any corrections are welcome.

这篇关于如何使用MongoDB存储ejabberd消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆