[ejabberd] external component

Daniel Dormont dan at greywallsoftware.com
Mon Apr 4 18:28:26 MSD 2011


Moshin,

This isn't really specific to ejabberd but here is a snippet of the code I am using to connect using an external component. The class should implement org.xmpp.component.Component;


        try {
            ExternalComponentManager _mgr = new ExternalComponentManager(xmppServer, xmppPort);
            _mgr.setSecretKey(componentJid, secretKey);
            _mgr.addComponent(componentJid, this);
        } catch (ComponentException e) {
            log.error("Error setting up external component " + componentJid, e);
        }

The rest of the logic is in the processPacket method.

You really should read this blog post: http://oneminutedistraction.wordpress.com/2010/10/08/developing-xmpp-components-the-service-2/ and note that both the Whack and Tinder libraries are required. I recommend building the latest version of Whack from Subversion and using the JARs - including Tinder - that come in the build/lib/dist and build/lib/merge subdirectories of the Whack distribution. I also recommend using Maven because Whack has a *lot* of dependencies for a fairly simple API.

Dan

On Apr 4, 2011, at 4:15 AM, Mohsin wrote:

> Daniel Dormont <dan <at> greywallsoftware.com> writes:
> 
>> 
>> Hi all,
>> 
>> I'm starting to develop an external component using the Java Whack and Tinder
> APIs.
>> 
>> I have managed to register the component using the service listener and I have
> it configured as a "logger"
>> under mod_service_log. Packets are being delivered correctly, but I see that
> the packet is enclosed in a
>> "route" tag before it's sent out. May I ask why that's done?
>> 
>> I'm asking because as best I can tell this "route" tag isn't part of the XMPP
> standard and the Java APIs choke
>> on the packet. I'm working on modifying them to unwrap the "route" tag but I
> was wondering if there's a way to
>> tell mod_service_log not to send it in the first place.
>> 
>> thanks,
>> Dan
>> 
> 
> 
> Hi Dan;
> 
> I want to know how to got your service to listen to the ejabberd as I have been
> trygin to do this in java also by listening on port 5526, I am not that good at
> java and i want to knwo how to register my service my ejabberd conf is :
> 
> {5526, ejabberd_service, [{ip, {10, 0, 3, 164}}, {access, all}, 
>                  {hosts, ["trademate.ejabberd"]},
> [{password, "secret"}]]},
> 
> {mod_service_log,[{loggers, ["trademate.ejabberd"]}]},
> 
> I know tha ti must resister "trademate.ejabberd" somehow but i dont know how,
> can you please guide me here and see if i am configuring the module right
> 
> Ragards;
> Mohsin
> 
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd



More information about the ejabberd mailing list