I have tried to execute above code , it executing first def get_invoice_amount when comes second get_invoice_approver it’s showing below error
Traceback (most recent call last):
File "invoice_approval_skk.py", line 145, in <module>
worker.run()
File "/home/applmgr/santhoshk/camundaWorker.py", line 97, in run
return_variables = self.topic_funcs[task.topic_name](**task.variables)
Below is python code and to process the flow and if i missed anything let me know
def get_invoice_amount(amount: pycamunda.variable.Variable) -> typing.Dict:
try:
print('in find inv amount input - ' + str(column2_value))
invoice_amount = column2_value
except (AttributeError, ValueError) as e:
raise worker.ExternalTaskException(message=f'Invalid input: {e}')
return {'amount': invoice_amount}
def get_invoice_approver(amount: pycamunda.variable.Variable , approver: pycamunda.variable.Variable) -> typing.Dict[int , str]:
print('in Getting invoice approver:')
return {'approver': str(column1_value)}
if __name__ == '__main__':
import pycamunda.processdef
print('Starting the process')
url = 'http://localhost:8080/engine-rest't'
worker_id = '3'
start_instance = pycamunda.processdef.StartInstance(url=url, key='Invoice_skk2')
print(column2_value)
start_instance.add_variable(name='invoice_id', value=1)
start_instance.add_variable(name='amount', value=column2_value)
start_instance.add_variable(name='approver', value=column1_value)
#start_instance.add_variable(name='attachment_file', value=None)
print('In Mail')
start_instance()
worker = worker.Worker(url=url, worker_id=worker_id)
print('getInvoiceAmountTopic')
worker.subscribe(
topic='getInvoiceAmountTopic',
func=get_invoice_amount,
variables=['amount']
)
print('getInvoiceApproverTopic')
worker.subscribe(
topic='getInvoiceApproverTopic',
func=get_invoice_approver,
variables=['amount','approver']
)
worker.run()