User Tools

Site Tools


osrf-devel:perl-server-dev

User Comments

OpenSRF Application development Perl API

OpenSRF offers a very simple Application development API to users of the framework. All that is required is to create a Perl module that subclasses the OpenSRF::Application package and register it's methods with the Method Dispatcher framework.

Each method executes in the OpenSRF::Application namespace as an instance of the custom Application. There are some instance methods on this object which can be used by the method to alter the behavior or response that the method sends to the client:

  $self->api_name  # returns the name of the method as called by the client
 
  $self->method    # returns the actual perl name of the sub implementing the
                   # method
 
  my $meth = $self->method_lookup( 'api_name' )
                   # constructs a new instance object implementing another
                   # method in the same Application package as a subrequest
 
  my ($subresult) = $meth->run( @params )
                   # runs the subrequest method and returns the array of
                   # results

All that is required to register an Application with OpenSRF is to place a setting in the configuration file that names the module that implements the new Application, and to add the new Application's symbolic name to the list of servers that should be started by OpenSRF. See Appendix A for more information on the central config file.

See here for a simple example server.

osrf-devel/perl-server-dev.txt · Last modified: 2022/02/10 13:34 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.