Can MUCListener listen to specific MUCService?

I’m working on a plugin that facilitates collaboration amongst XMPP clients.

  1. I want to intercept every packet destined for collaboration.domain.com so I can validate that the collaboration extention conforms to a given schema.

  2. I need to keep track of various things in regard to Multi-User chat rooms that are hosted at collaboration.domain.com. This also involes the use of a database (which is why I’m using a plugin instead of a component right now)

Can MUCListener listen to a specific MUCService?

Also, is there a way that I can only intercept messages bound for collaboration.domain.com? Right now I’m using a packet interceptor.

Would implementing the Component interface give me what I want? Right now I’m intercepting every packet and all MUC traffic and performance is pretty bad.

Any advice is appreciated.

Thanks,

Chris

Hi Chris,

There isn’t a way to filter packets destined for a particular sub-domain other than doing it yourself within the listener or interceptor. I’m not quite sure if I understand your second item, there is nothing that prevents a plugin that uses the Component interface from accessing a database.

Have you done any benchmarking on your plugin to see where the bottleneck is? Are you accessing the database each time a packet comes in, which would definitely cause some performance issues?

Thanks,

Ryan

Hi Ryan,

Thanks for your response.

As for my second item, I was referring to the plugin schema versioning goodness that I get automatically e.g. being able to hand someone v2 of my plugin and have the database update the schema from v1 to the latest version on install. Is this available with a component or would I have to roll this functionality myself?

I don’t hit the database with the interceptor. However, in the current code the database gets hit every time someone joins a chat room.

In the interceptor I have code that does something like this:

if packet contains extension

{

validate extension

}

I’m re-using the same validator object/not creating a new one each time a packet is intercepted.

Benchmarking: my plugin can process 3000 packets a second when synchronizing data between collaborators, and around 800/second when putting data into the database.

I haven’t done much code profiling except for the serialization/validation code (which was profiled and reused from my collaboration client application). My plugin doesn’t use the Openfire build script, although I think I might have to so that I can profile my plugin.

I think what is really killing me is just the MUC protocol in general. For a room with 30 users in it where 1 user sends out 30 messages the server sends out 900 messages. My network setup is basically a bunch of LANs connected via the internet (with only modest connections). Each LAN has its own Openfire server and the Openfire servers are connected via Server to Server connections.

The reason for asking my filtering questions was just trying to optimize where I could.

Chris

Hi Chris,

I see where you’re coming from with regards to the plugin database integration stuff. You could certainly roll your own versioning subsystem but it sounds like with what you’re doing it’s best if you just stick with using a plugin. I forgot to mention in my previous reply that you can’t add a second Component that processes packets on a previously defined sub-domain. If you try to do so Internal/ComponentManager will just silently return.

MUCs can be a bit of challenge to work with because of the multiplier effect; one packet in, many out. For the packets you’re that you’re intercepting are you modifying them in any way or are you just trying to track them? If it’s the latter, you might want to look into using a queue so you can process them later so the time spent intercepting them is minimized.

Hope that helps,
Ryan