Dispatch mode for method_lookup subrequests user/miker/respond_directly_mode
authorMike Rylander <mrylander@gmail.com>
Thu, 25 Aug 2016 21:42:31 +0000 (17:42 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 7 Oct 2016 20:35:59 +0000 (16:35 -0400)
commit3368736b16fe4da63649696946cb3f0de3e002dc
tree41c0b5c50246a464fdf24c41ece2477fdf970e92
parent1c8a7dcb24d4ea3a8aa7dc718d2e1f0b12430cb1
Dispatch mode for method_lookup subrequests

There is a pattern in the wild of using OpenSRF's method_lookup() facility
to decide between one of several local methods when delegating to pre-existing
logic.  Often times, we want to simply hand control over to another method,
but the output of a subrequest's run() is an array of results.  The caller has
to know if, and how, to restructure the result for the client.

Instead, we can now call dispatch() instead of run() and have OpenSRF session
control completely passed to the delegate code.  This way, the delegate code
need not know anything about its caller, and vice versa.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
src/perl/lib/OpenSRF/AppSession.pm
src/perl/lib/OpenSRF/Application.pm