On Fri, Jun 1, 2018 at 5:30 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:
The irritating part is that the Python is essentially a perfectly
self-contained unit of work. I just need to plumb it in for a finished
application and I worry that the plumbing will be ugly. Maybe I should
stop worrying and keep writing code :-)
Indeed. Often plumbing is simply ugly. That's why we generally hide it
behind more attractive exterior layers. ;)
Prettier plumbing can be expensive. Sometimes prohibitively so.
I'm looking for options to be able to have an RPG program fire off
these Python 'services', have them work with the web service, and pass
the results back to RPG.
Do you need something "tighter" than dropping off the return values in
a stream file or database table?
Ultimately, I think if you're going to rely on Python (or other
technologies of a similar nature, such as Node.js, Ruby, PHP, etc.)
then you will have to accept that "calling" and "retrieving values"
are two separate steps performed by the caller. The caller can poll
the designated drop-off site to see when the returned data is ready,
or there can be some kind of arrangement where the callee notifies the
caller that the data is ready to be picked up. Off the top of my head,
having Python populate a data queue via iToolKit is the tightest thing
which still seems "kinda simple" to me. (I don't personally use data
queues; I'm just imagining that folks experienced with them would find
them easy to use, and they seem to be a decent fit, conceptually.)
If you really want that immediacy and "single-step" feel of a call
with output parameters or return value, you have to use something
other than Python. I think the main choices are probably Scott's
HTTPAPI (which of course is a lower-level programming interface than
the Requests library, but there are examples and people who can
support you) or perhaps some Java stuff, since RPG can receive output
parameters or return values from Java, if I understand correctly.
For green-field (not green-screen!) programming, of course just using
Python throughout would be a good option. (And you *can* plumb a *PGM
or *SRVPGM into surrounding Python quite cleanly.)
John Y.
As an Amazon Associate we earn from qualifying purchases.