Setting up Component::External
mart at degeneration.co.uk
Tue Dec 11 07:56:58 UTC 2007
Guillermo Roditi wrote:
>> The above is roughly equivalent to:
>> <VHost example.com>
>> <Plugin DJabberd::Delivery::Local />
>> <Subdomain aim>
>> <Plugin DJabberd::Component::External>
>> ListenPort 5270
>> Secret some_secret
> Yeah. the config stuff is nice, but unfortunately I went the other
> route since my config would have to be updated a whole lot otherwise.
> I just pull all my vhost info from the database now since it's
If nothing else, your question has reminded me that there should
probably be a nicer way to do the above with the API. I guess the most
obvious parallel to the configuration file would be
$vhost->create_subdomain($aim) which does the necessary configuration
and returns a DJabberd::VHost. Should probably get rid of the remants of
the old and broken "subdomain" support as well, since it's confusing.
>> It's probably also worth noting that as you've written this, with it
>> creating a new AIM component each time, only the first will actually
>> work because they'll all independently try to listen on the same port.
>> For it to work, you'll need to run each instance on a separate port and
>> connect one pyAIMt to each.
> Right, I get it. Hmmm that sucks. Too bad I can't have all the vhosts
> share a single component like I do with RosterStorage, Delivery, and
> Authen, or can I? I have no objection to some gritty devel work if
> necessary. I don't really want to run 200 connections to PyAIMt (i
> have about 220 or so VHosts with a few users each, all very low
Even in the RosterStorage and Delivery cases you usually have one
instance per vhost, though I guess with some of them you can probably
get away with sharing because their ->register() methods just register
hooks (with closures) and don't store anything in $self. That's not
really by design, though.
Component::External could potentially be a bit more clever about how it
manages its sockets, and not have such a strong connection between one
listen socket and a particular VHost. It'd just have to maintain some
global (rather than per-instance) state and then dispatch to the right
instance based on the hostname given in the stream element once the
component connects. I wasn't actually aware that pyAIMt was able to
serve multiple domains with a single running instance, though. Can this
be done, or would you have to run 200 instances of PyAIMt anyway?
(I must admit I don't know much about PyAIMt; I run it on my personal,
low-traffic DJabberd instance, but I've not really looked at it in any
> If you use IRC I can often be found in #POE (irc.perl.org) as groditi,
> so feel free to hit me up if you'd like to discuss the POE thing. I
> would love to see DJabberD play nicely alongside POE. I never was able
> to figure out how to integrate my own events and event handlers etc.
> into Danga::Socket so I never got to use a lot of the Danga code I
> wanted to try out.
I haven't been looking at it for a few days since I've been a little
unwell, but hopefully I should be able to get back into it soon. I'll
bear this in mind if I get stuck. Thanks!
More information about the Djabberd