After poking through the code, I found that ComponentEnricher requires, via instanceof, incoming message to be either InOnly or RobustInOnly. (Not surprising given the error I was receiving.) I changed the incoming message to be of type InOnly and got around this.
One other note of caution to anyone that wants to use the enricher: messages morphed by the enricher are automagically rewrapped. Here's the javadoc from ComponentEnricher that explains the wrapping behavior: /** * Combines two NormalizedMessages to one DOM Document. The * element Names are specified via the following properties: * enricherElementName, requestElementName, resultElementName * * Example: * Content of Message1 : * * <hello/> * * Content of Message 2: * * <message2/> * * Result of this method a DOM Document containing the following: * * <enricher> * <request> * <hello/> * </request> * <result> * <message2/> * </result> * </enricher> * */ nev wrote: > > I have an InOut message coming into my endpoint and I'm trying to enrich > it before it gets sent on to another endpoint. When it reaches my > content-enricher endpoint, an UnsupportedOperationException gets thrown > saying that only InOnly and RobustInOnly are supported. Does the enricher > pattern NOT work with InOut messages? > > Here's the specific error I'm receiving: > java.lang.UnsupportedOperationException: Use an InOnly or RobustInOnly MEP > > Here's my xbean.xml: > <?xml version="1.0" encoding="UTF-8" ?> > <beans xmlns:eip="http://servicemix.apache.org/eip/1.0"> > <eip:content-enricher service="flowService" > endpoint="flowServiceEndpoint"> > <eip:enricherTarget> > <eip:exchange-target service="enricherService" > endpoint="enricherServiceEndpoint"/> > </eip:enricherTarget> > <eip:target> > <eip:exchange-target service="eventService" > endpoint="eventServiceEndpoint"/> > </eip:target> > </eip:content-enricher> > </beans> > > I've put code in my enricherServiceEndpoint and the code NEVER gets > called. The exception is thrown before it event invokes my code. What's > going on? Can anyone help? Has anyone gotten the enricher to work? > > thanks! > Jeff > -- View this message in context: http://www.nabble.com/eip-enrichment-tf4737519s12049.html#a13579374 Sent from the ServiceMix - User mailing list archive at Nabble.com.