powered by Jive Software

Plugin : Component vs IQHandler

Hi,

I’‘m working on a plugin and the basic functions are almost done. What I need to do now is to build an interface for it so it could communicate with a future client. I’'m really not an expert of the jabber protocol and I would like to know what is the big difference between registering a plugin as a Component and as an IQHandler. Somebody can help me or suggest me a way to know more about it?

I already ask a question on this forum and if you would like to know what kind of plugin I’'m writing, go see my post:

http://www.jivesoftware.org/forums/thread.jspa?threadID=14671&tstart=0

Thanks in advance

JA

Hey JA,

When creating a component you are saying that the server will provide a new service and packets should be routed to the component to execute the new service. Therefore, each component will provide a new subdomain (eg. search.myserver.com) for the server (eg. myserver.com). So packets whose domain matches the subdomain that your component is handling will be routed to your component. This includes Presence, Message and IQ packets. Moreover, when you build a component you may be able to run your component as an external component. That means that it will be a different process in the OS and that the component will connect to the server using sockets.

On the other hand, IQHandler is an internal class of Jive Messenger where each subclass will handle a certain type of IQ packet. So IQ packets sent to the server whose domain matches the server domain or IQ packets with no TO attribute will be handled by the server. The server will delegate the responsibility to an IQHandler subclass. The subclass to use will depend on the namespace of the child element in the IQ packet.

Hope that helps,

– Gato

Hi Gato,

Yes, it helps a lot.

I have another question: is it possible to send, via my plugin, specific customize data to my client? If so, how?

Thanks in advance

JA

Hey JA,

To send packets from your plugin you have two options. The first option could be used if your plugin will always run on the same JVM of JM.

XMPPServer.getInstance().getPacketRouter().route(<Packet>);

but, if your plugin contains a component that may be used as an external component then you should use the ComponentManager for sending packets:

componentManager.sendPacket(this, <Packet>);

Regards,

– Gato

Hi Gato,

Ok, great. Thank you very much fo your help.

Regards,

JA