How do I pass a Java HashMap to a custom Mule connector? -
right connector code looks this:
// myconnector class /** * process item * * {@sample.xml ../../../doc/my-connector.xml.sample myconnector:process} * * @param binary * item process * @param stuff * key value pairs processing * * @return status string * * @throws nullpointerexception * when 1 of parameters null */ @processor public string process ( @payload final byte[] binary, final hashmap<string,string> stuff) throws nullpointerexception {...} // myconnector.sample <!-- begin_include(myconnector:process) --> <myconnector:process> <myconnector:stuff> <item1>data1</item1> <item2>data2</item2> </myconnector:stuff> </myconnector:process> <!-- end_include(myconnector:process) —> i have hashmap stored in session header inside mule flow (#[header:session:myhashmap]), can't figure out how send connector.
--- update ---
if change connector sample , connector element match error when built connector.
// myconnector.sample <!-- begin_include(myconnector:process) --> <myconnector:process stuff="#[stuff]"/> <!-- end_include(myconnector:process) —> // mule flow <flow> <myconnector:process stuff="#[sessionvars.myhashmap]"/> </flow> // error [error] error validating example: cvc-complex-type.3.2.2: attribute 'stuff' not allowed appear in element 'myconnector:process'. failing example: <myconnector:process stuff="#[stuff]"/> [error] error on execute: error ocurred while devkit generating java code. check logs further details.
what about:
<myconnector:process> <myconnector:stuff ref="#[sessionvars['myhashmap']]" /> </myconnector:process>
Comments
Post a Comment