powered by Jive Software

Newbie Question - Does component API allow sending stanzas

Hi everybody!

Sorry to bore you, but I have some basic questions:

I would like to write a component that should be able to receive messages/presence packets from and send them to a Openfire server. The component (or the plugin) API allows to receive packets only. How do I actively send packets? Is it necessary to use the smack-API for that and can I act as a gateway by using the smack-API? Smack seems to be a client-API only. Is there an Openfire API which allows acting as a gateway component?

Best regards,


You can send packets using the ComponentManager that you add your Component to. Something along the lines of:

ComponentManager componentManager = ComponentManagerFactory.getComponentManager();
        componentManager.sendPacket(MyComponent, MyPacket);

(don’t know what the structure of your code might be =) )

Ahh, thank you!

Another question in that context:

What is the suitable interface if I want to send packets via the “plugin” API.

If I register a component, a subdomain’ed addressing is required but I would prefer, that the client does not need to address a component. hat should be possible by using the plugin interface, isn’t it? How do I send packages as a plugin?



I believe you only have to implement Plugin and can simply add listeners to it to accomplish listening for packets. Likewise, I think you can PacketRouter to accomplish what you are after. (or PacketDeliverer? there’s a number of things you can access from XMPPServer)

A simple:


Should do the trick.





O.k.! Thank you jadestorm for the really fast responses!