Re: Jabber Interface - Mailing list pgsql-general

From Aspire
Subject Re: Jabber Interface
Date
Msg-id 001301c35510$95aee290$31c832c0@keepaway
Whole thread Raw
In response to Re: Jabber Interface  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
Dear Bruce and others ,

Thanks For the responce and your kind help
I have a little problem i hope you would be intrested in troubleshooting it

I am using plperl  and
NET::Jabber  for the postgresql  connection to jabber and walah!! it realy
connects and sends messages to all the targets users.

I have created a function
pgjabber(text,text) as following
<code>
CREATE FUNCTION "public"."pgjabber" (text, text) RETURNS text AS'
#This module helps to deliver message to the jabber user
#usage pgjabber(touser@server,message);
use Net::Jabber qw(Client);
$toid = $_[0]; # the target uset
$body = $_[1]; # the message for that ass
my $jabconn = Net::Jabber::Client->new();
$jabconn->Connect( "hostname" => "someserver.who","port" => 5222 ) or die
"Cannot connect ($!)\\n";
my @result = $jabconn->AuthSend( "username" =>
''sender@some.who'',"password" => "why_to_tell '',"resource" => ''work'' );
my $msg = Net::Jabber::Message->new();
$msg->SetMessage( "to"=> $toid,"subject" => "Money Deduction","body"=>
$body );
$jabconn->Send($msg);
$jabconn->Disconnect();
return sucess;
'LANGUAGE 'plperl' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
</code>
Yes the  the langauge was duly created  and instaled perl is 5.6.1 on RH 7.2
i386 ,gcc 3.x, Postgresql 7.3.4

Now My problem is that if i use this function pgjabber(text,text) for
sending 1 message at a time then it works
if I use this function in a loop of      plpgsql function   it does not
executes more than 4  times also
if i do "Select pgjabber(someplace@server,message); " 10 number of times as
a consecutive query it only executes and delivers message for 4 time and at
5 instance it returns the error
<error>

plperl: error from function:    (in cleanup) Cannot connect ()

</error>




Would be greatful to any soul who comes to help :-)))



Regards to All readers,
Aspire .








----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Aspire" <aspire@mail15.com>
Cc: <pgsql-general@postgresql.org>
Sent: Saturday, July 26, 2003 02:44
Subject: Re: [GENERAL] Jabber Interface


>
> You can use one of the server-side languages, like plperl, or use plsh,
> which I think is on gborg.  Either can call a shell script.
>
> --------------------------------------------------------------------------
-
>
> Aspire wrote:
> > Dear all ,
> >
> > This could have been a wish list but ..
> >
> >
> > Do any one have any idea how could one send messages to jabber server
via
> > postgresql i.e a trigr function that if invoked sends a message to
specific
> > user.
> >
> >
> > Please all information provided would be apreciated
> >
> >
> > Regards,
> > V Kashyap
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> >       subscribe-nomail command to majordomo@postgresql.org so that your
> >       message can get through to the mailing list cleanly
> >
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
19073
>


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.3.3 array_out tweak
Next
From: nolan@celery.tssi.com
Date:
Subject: Re: psql -e