-
Notifications
You must be signed in to change notification settings - Fork 1
iService
tr4n2uil edited this page Dec 9, 2012
·
15 revisions
A service is defined by any class that implements the iservice interface.
The iservice interface defines three methods to be implemented by the concrete services: input(), run() and output().
returns: {
'required': [], // array of arguments which are required to be passed into the service
'optional': {}, // map of keys which are optional arguments to be passed into the service
with the default value as the value of the key in the map
'set': [] // array of values to be set by positional arguments
}
implements the service which processes an invoking message and returns results in same message
params: memory = {} // iobject representing the message invoking the service
in case of python, specified arguments obtained as keyword arguments and
memory used for unspecified arguments only
return: [] // array of keys whose values are to be used as output in a workflow
The following is an example service in python:
class Greet( snowblozm.iService ):
def input( self ):
return {
'optional': {
'name': 'Krishna'
},
'set': [ 'name' ]
}
def run( self, name, **memory ):
print 'Hello World', name, '!'
return snowblozm.utils( memory )
def output( self ):
return []
Learn more about our other core interfaces: