I'm trying to make use of @attachment http properties
I have a devkit method called validate in a flow that is called like so
<http:connector name="httpConnector" doc:name="HTTP\HTTPS">
<service-overrides
messageFactory="org.mule.transport.http.HttpMultipartMuleMessageFactory" />
</http:connector>
<flow name="AttachmentTestFlow1" doc:name="AttachmentTestFlow1">
<http:inbound-endpoint connector-ref="httpConnector" doc:name="HTTP" exchange-pattern="request-response" host="localhost" port="8100"/>
<Foo:validate config-ref="TestMessageSizeHappy" />
</flow>
In Devkit:
@Processor
public Object validate(@Payload InputStream in
,@InboundAttachments("*") Map<String, DataHandler> inboundAttachments
,@OutboundAttachments Map<String, DataHandler> outboundAttachments
) {
however when running my mule application this is thrown:
ERROR 2013-07-30 09:06:39,225 [main] org.mule.module.launcher.application.DefaultMuleApplication: null org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The content of element 'xmlthreatprotection:validate' is not complete. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/xmlthreatprotection":inbound-attachments}' is expected. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
It seems to me that mule expects the attachments to be put in as an attribute some how ! When I remove the @attachment stuff I get no errors at runtime.
Are you sure this is supported by DevKit? I can not find a single integration test in the source code that exercises @InboundAttachments
and @OutboundAttachments
annotations, while @InboundHeaders
and @OutboundHeaders
are both test covered.
Alternatively you can receive the MuleEvent
and access the attachments through it:
@Processor
@Inject
public Object validate(@Payload InputStream in, MuleEvent muleEvent) {