Jabber::PubSub::JEAI - Perl extension for Erlang's J-EAI server


Jabber-PubSub-JEAI documentation  | view source Contained in the Jabber-PubSub-JEAI distribution.

Index


NAME

Top

Jabber::PubSub::JEAI - Perl extension for Erlang's J-EAI server

SYNOPSIS

Top

  use Jabber::PubSub::JEAI;

It is important that you put Jabber connection and pub/sub parameters in a hash reference and pass it to the subroutines. Although not all of the pamameters are necessary for each subroutine. Example for channel creation:

	my $param = {
	    'uid'      => 'admin',
	    'pwd'      => 'nimda',
	    'host'     => 'localhost', 		# default is 'localhost'
	    'port'     => 5222, 		# default is 5222
	    'resource' => '', 			# use default
	    'channel'  => 'home/localhost/admin/sport',
	    'to'       => 'pubsub.localhost', 
	    'iq_id'    => '', 			# use default
	    'payload'  => '', 			# N/A for channel creation
	};
	Jabber::PubSub::JEAI::create_channel($param);

Example for channel deletion:

	my $param = {
	    'uid'      => 'admin',
	    'pwd'      => 'nimda',
	    'host'     => 'localhost', 		# default is 'localhost'
	    'port'     => 5222, 		# default is 5222
	    'resource' => '', 			# use default
	    'channel'  => 'home/localhost/admin/sport',
	    'to'       => 'pubsub.localhost', 
	    'iq_id'    => '', 			# use default
	    'payload'  => '', 			# N/A for channel creation
	};
	Jabber::PubSub::JEAI::delete_channel($param);

Example for subscription to the channel:

	$param = {
	    'uid'      => 'app2',
	    'pwd'      => 'app2',
	    'host'     => 'localhost',		# default is 'localhost'
	    'port'     => 5222,			# default is 5222
	    'resource' => '',			# used default
	    'channel'  => 'home/localhost/admin/sport',
	    'to'       => 'pubsub.localhost',
	    'iq_id'    => '', 			# use default
	    'payload'  => '', 			# N/A for channel subscription
	};
	Jabber::PubSub::JEAI::subscribe($param);




To receive the publised messages you can use any Jabber client. All subscribers to the same channel will get the same messages simultaneously if they are all listening, or get the messages later but in correct sequence. Here is an example for polling a Jabber box and show the payloads in the published messages with Jabber::PubSub::JEAI:

	$param = {
	    'uid'      => 'app2',
	    'pwd'      => 'app2',
	    'host'     => 'localhost',		# default is 'localhost'
	    'port'     => 5222,			# default is 5222
	    'resoirce' => 'Test',
	    'channel'  => '', 			# N/A for this purpose
	    'to'       => '', 			# N/A for this purpose
	    'iq_id'    => '', 			# N/A for this purpose
	    'payload'  => '', 			# N/A for this purpose
	};
	Jabber::PubSub::JEAI::listen($param);

Example for publication to the channel:

	$param = {
	    'uid'      => 'admin', 
	    'pwd'      => 'nimda',
	    'host'     => 'localhost',		# default is 'localhost'
	    'port'     => 5222,			# default is 5222
	    'resource' => 'Test',
	    'channel'  => 'home/localhost/admin/sport',
	    'to'       => 'pubsub.localhost',
	    'iq_id'    => '', 			# use default
	    'payload'  => 'Breaking news! ...',
	};
	Jabber::PubSub::JEAI::publish($param);	




DESCRIPTION

Top

This package offers some utilities for interfacing with Erlang's J-EAI server 1.0.

EXPORT

None by default.

ACKNOWLEDGMENT

Top

The author wishes to thank to "Thierry Mallard" <thierry.mallard@erlang-fr.org> and "Mickael Remond" <mickael.remond@erlang-fr.org>, leaders of J-EAI development team, for their support.

AUTHOR

Top

Kai Li, <kaili@cpan.org>

COPYRIGHT AND LICENSE

Top


Jabber-PubSub-JEAI documentation  | view source Contained in the Jabber-PubSub-JEAI distribution.