Thanks for the direction, guys!

-bob

-----Original Message-----
From: Bernd Fondermann [mailto:[email protected]] 
Sent: Monday, August 29, 2011 5:11 AM
To: [email protected]
Subject: Re: HOW TO: write custom IQ module(s) for Vysper

On Sat, Aug 27, 2011 at 17:31, Niklas Gustavsson <[email protected]> wrote:
> On Fri, Aug 26, 2011 at 7:27 PM, Bob DeRemer <[email protected]> 
> wrote:
>> I looking into creating my own IQ processing logic.  We're embedding Vysper 
>> in our own JAVA webapp [running in Tomcat] and we have some .Net client 
>> software that we would like to modify to use custom IQ(s) for communication 
>> with our server application.  By using XMPP, we can achieve the benefits of 
>> a persistent connection.
>>
>> Thanks in advance for any documentation, samples, etc. that show how to 
>> create custom IQ(s) that plug into Vysper.
>
> I'm afraid the documentation is lacking, but have a look at one of the 
> existing modules, like that for MUC or a simpler one like XMPP ping, 
> they probably do exactly what you need.

That is the right way indeed.

For example, have a look at the VCard extension here:
http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0054_vcardtemp/

Foremost, I'd recommend to subclass
  org.apache.vysper.xmpp.modules.core.base.handler.DefaultIQHandler
This is like implementing your own Servlet by subclassing DefaultServlet.
It contains the XMPP stanza logic you want to provide.

Additionally, you need to plug your handler into the server. This is best done 
by following the example in VcardTempModule, which
+ provides a Handler instance and registers it initializes persistence 
+ (or any other backend connection you might need) makes your 
+ extension's namespace known and announces your IQ stuff
in the Service Discovery

If you need persistence, have a look at the VcardTempPersistenceManager.

What remains to be done is to make your Module known to the server.
If you use Spring, add one line to the Spring configuration.
If you use an embedded approach, you'd need to call the equivalent to
  server.addModule(new VcardTempModule()); like it is done in
  org.apache.vysper.xmpp.server.ServerMain

HTH, please keep asking,

   Bernd

Reply via email to