[JDEV] Interesting "service" vs "xdb" vs "agent" thing

Dennis Noordsij dennis.noordsij at wiral.com
Tue Jan 9 16:25:19 CST 2001


On Tuesday 09 January 2001 22:51, you wrote:
> Depends on how attached you are to XDB packets, and
> if you can build your handler to accept other
> types of packets. Put simply, the way a
> base_accept service functions is the exact same
> way that a base_accept xdb functions. Meaning,
> set it up as a service (just change your xdb tags to
> service), and direct your user directory requests to it.
>
> Basically, build a second handler to handle iq's or
> whatever type of request and have it talk
> to the db... You're not bound to using XDB packets
> for messages that simply QUERY a database, so set
> up a similar handler that will accept <iq> requests.
>
> Matthew D. Diez


So basically duplicate all the code into a new handler? I don't want to 
divide the system into one program handling xdb requests and one handling 
search requests. The handler pools a bunch of threads with connections to the 
database, I would like the pools and connections to handle both xdb and 
search. (ie more effective pool)

Yes, I can add a service section, and run the exact same program twice. Or I 
can add a new send/receive thread in the program that connects to jabber 
again on a different port for the search requests and still distribute them 
among the same threads. 

Probably best way to do it. 

2 incoming sockets (to jabber), all xml goes onto the same stack.

Threads grab them, process them, they know about both <iq> and <xdb>, then 
put them on an outgoing queue.

Outgoing queue handler knows that <iq> replies to go socket A and <xdb> 
replies to go socket B. 

But it would be nicer if I could add 
<agent id="name_of_xdb_component">
 <search/>
  <etc../>
</agent>
 
and have <iq> packets go to the name_of_xdb_component :-)


Regards,
Dennis




More information about the JDev mailing list