1

Right now the connector code looks like this:

// myConnector class
/**
 * Process item
 *
 * {@sample.xml ../../../doc/my-connector.xml.sample myConnector:process}
 *
 * @param binary
 *          the item to process
 * @param stuff
 *          key value pairs for processing
 *
 * @return the status as a string
 *
 * @throws NullPointerException
 *          when one of the parameters are 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 a HashMap stored in a session header inside my Mule flow (#[header:session:myHashMap]), but I can't figure out how to send it to the connector.

--- update ---

If I change the connector sample and the connector element to match I get an error when I built the connector.

// myConnector.sample
<!-- BEGIN_INCLUDE(myConnector:process) -->
    <myConnector:process stuff="#[stuff]"/>
<!-- END_INCLUDE(myConnector:process) —>

// my mule flow
<flow>
    <myConnector:process stuff="#[sessionVars.myHashMap]"/>
</flow>

// the error
[ERROR] Error validating example: cvc-complex-type.3.2.2: Attribute 'stuff' is not allowed to appear in element 'myConnector:process'. Failing example: <myConnector:process stuff="#[stuff]"/>
[ERROR] error on execute: An error ocurred while the DevKit was generating Java code. Check the logs for further details.
TERACytE
  • 7,553
  • 13
  • 75
  • 111

1 Answers1

2

What about:

<myConnector:process>
  <myConnector:stuff ref="#[sessionVars['myHashMap']]" />
</myConnector:process>
David Dossot
  • 33,403
  • 4
  • 38
  • 72
  • If I change the .sample and alter the connector element as you suggested, I get the following error: "[ERROR] Error validating example: cvc-complex-type.3.2.2: Attribute 'stuff' is not allowed to appear in element 'myConnector:process'. Failing example: [ERROR] error on execute: An error ocurred while the DevKit was generating Java code. Check the logs for further details. " – TERACytE Mar 11 '14 at 03:19
  • With some alteration your solution works David. Thank-you. Could please update your answer to reflect what worked for me? Then I'll mark yours as the answer: "" – TERACytE Mar 11 '14 at 04:06
  • Updated though I don't understand why `sessionVars.myHashMap` did not work. What Mule version is this? – David Dossot Mar 11 '14 at 04:43