Simple external component

Hi,

I have to write a very simple component.It doesn’t need to be discovered, nor handle incoming messages.

It just has to connect to the server and send a simple message to a user.

I don’t know how to do that.

I don’t want to use smack, because I want to use a component (not a client), and I don’t want to send chat message (but a message of type “normal”).

I think I have to use Whack and/or Tinder but I don’t know how to adapt the Weather sample, which is a bot listening for request, to my needs.

Thanks in advance for your help

Vincent

What’s the trigger that is used to initiate the “sending of messages”?

It has to run standalone. (it is called as an runnable “agent” by a jboss web server, but it doesn’t matter)

Your Component implementation will get passed a ComponentManager instance (in the initialize method). You can use the sendPacket method of the ComponentManager to send your messages.

Component implementations typically either run inside an Openfire plugin, or as an external, stand alone process (using Whack). The latter seems more applicable to you. Whack used to feature war-like behavior (allowing you to turn it into a webapplication), but I’m not sure if that’s still functional.

I’d advise you to first create a simple Component implementation that uses an XMPP-provided trigger (for instance, have it respond to messages that it receives). You can implement the Component interface yourself - extending AbstractComponent (from Tinder) might be just as easy.

After you’ve done that, try hooking it up into the framework you want to use. Lastly, make it respond to the events that should trigger your functionality.

Thanks.

ok so there’s no way to do something like :

public class MyClass {

public static void main(){

ExternalComponent myComponent = new ExternalComponent();

myComponent.connect(host, port, secret);

myComponent.send(toJID, subject, body);

myComponent.disconnect();

}

}

I don’t want that my component runs in background and is triggered by something…

Do you think I should use a “client” library? The problem in that case, is that our client must filter incoming messages and not display those from this special contact…