Hi all,
I’m getting the following errors when I try to run my worker task. This is my first time doing so. Not sure how to correct the mis-mapped variable headers. Can someone advise?
^2019-04-25 14:34:43,338 [TopicSubscriptionManager] ERROR org.camunda.bpm.client - CAMUNDA_EXTERNAL_TASK_CLIENT-03005 Exception while deserializing variables 'org.camunda.bpm.client.impl.EngineClientException: CAMUNDA_EXTERNAL_TASK_CLIENT-02010 Exception while deserializing variable headers: value does not match to the type object'`
XML from BPMN regarding how the headers map is constructed:
<camunda:inputParameter name="headers">
<camunda:map>
<camunda:entry key="Content-Type">application/x-www-form-urlencoded</camunda:entry>
<camunda:entry key="Authorization">Basic **************************==</camunda:entry>
<camunda:entry key="method">POST</camunda:entry>
</camunda:map>
</camunda:inputParameter>
Worker code. The execute method is never called. Am I doing this wrong?
public static void main( String[] args ) {
log.info( 'Starting up worker node' )
// bootstrap the client
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl( "http://localhost:8080/engine-rest" )
.build()
client.subscribe( "ObtainAuthorization" )
.lockDuration( 5000 )
.handler( new ExternalTaskHandler() {
@Override
void execute( ExternalTask externalTask, ExternalTaskService externalTaskService ) {
log.info( "Worker node request received: ${externalTask.id}" )
// retrieve a variable from the Workflow Engine
Map vars = externalTask.getAllVariables()
if ( !vars.url ) throw new WorkerTaskException( "URL missing and required." )
HTTPSWorker httpsWorker = new HTTPSWorker()
String response = httpsWorker.callOAuth( ( String ) vars.url, ( Map ) vars.parameters, ( Map ) vars.headers )
externalTask.setVariable( "response", response )
externalTaskService.complete( externalTask )
log.info( "The External Task ${externalTask.getId()} has been completed!" )
}
} ).open()
Thread.sleep( 1000 * 60 * 5 ) // TODO Why does it need to sleep here?
}