[patch] Content Enricher for ServiceMix
Hi some days ago I asked for an implementation of the Content-Enricher pattern on the ServiceMix user list. (http://www.enterpriseintegrationpatterns.com/DataEnricher.html). But I never received any reply to that mail. So I started to implement that pattern and attached the first version as patch file to this mail. Hopefully someone could look inside and give me feedback if such an implementation is interesting for ServiceMix. ;-) Kristian Index: D:/work/UrlaubsIntegration/servicemix-eip/src/test/java/org/apache/servicemix/eip/ContentEnricherTest.java === --- D:/work/UrlaubsIntegration/servicemix-eip/src/test/java/org/apache/servicemix/eip/ContentEnricherTest.java (revision 0) +++ D:/work/UrlaubsIntegration/servicemix-eip/src/test/java/org/apache/servicemix/eip/ContentEnricherTest.java (revision 0) @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicemix.eip; + +import javax.jbi.messaging.ExchangeStatus; +import javax.jbi.messaging.InOnly; +import javax.jbi.messaging.NormalizedMessage; +import javax.xml.namespace.QName; +import javax.xml.transform.dom.DOMSource; + +import org.apache.servicemix.eip.patterns.ContentEnricher; +import org.apache.servicemix.jbi.util.DOMUtil; +import org.apache.servicemix.tck.ReceiverComponent; + +public class ContentEnricherTest extends AbstractEIPTest { + +protected ContentEnricher enricher; + +protected void setUp() throws Exception { +super.setUp(); + +enricher = new ContentEnricher(); +enricher.setEnricherTarget( + createServiceExchangeTarget(new QName("enricherTarget"))); +enricher.setTarget( + createServiceExchangeTarget(new QName("target"))); + +configurePattern(enricher); +activateComponent(enricher, "enricher"); +} + +public void testInOnly() throws Exception { + + activateComponent(new ReturnMockComponent(""), + "enricherTarget"); + + ReceiverComponent rec = activateReceiver("target"); + +InOnly me = client.createInOnlyExchange(); + +me.setService(new QName("enricher")); +me.getInMessage().setContent(createSource("")); +client.sendSync(me); + +assertEquals(ExchangeStatus.DONE, me.getStatus()); + +assertEquals(1, rec.getMessageList().getMessageCount()); + +NormalizedMessage object = + (NormalizedMessage) rec.getMessageList().getMessages().get(0); + +DOMSource domSource = (DOMSource) object.getContent(); + +assertEquals("" + + "" + + "", + DOMUtil.asXML(domSource.getNode())); + +} + +} Index: D:/work/UrlaubsIntegration/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentEnricher.java === --- D:/work/UrlaubsIntegration/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentEnricher.java (revision 0) +++ D:/work/UrlaubsIntegration/servicemix-eip/src/main/java/org/apache/servicemix/eip/patterns/ContentEnricher.java (revision 0) @@ -0,0 +1,154 @@ +package org.apache.servicemix.eip.patterns; + +import javax.jbi.messaging.ExchangeStatus; +import javax.jbi.messaging.InOut; +import javax.jbi.messaging.MessageExchange; +import javax.jbi.messaging.NormalizedMessage; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; + +import org.apache.servicemix.eip.EIPEndpoint; +import org.apache.servicemix.eip.support.ExchangeTarget; +import org.apache.servicemix.jbi.jaxp.SourceTransformer; +import org.apache.servicemix.jbi.util.MessageUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * Implementation of the + * http://www.enterpriseintegrationpatterns.com/DataEnricher.html";>'Content-Enricher' + * Pattern. + * + * @org.apache.xbean.XBean element="content-enriche
Possible Solution to a camel serviceengine problem or only a bad workaround??
Hi all I found a solution for my problem regarding the routing problem yesterday (http://www.nabble.com/How-to-route-a-MessageExchange-using-camel-to-ode-tf4641042s12049.html#a13255218). I wasn't able to route a message coming over HTTP Binding through camel to ODE service engine. I specified a routing rule like this: --- 8< --- String fromUri = "jbi:endpoint:http://gaswerk.sourceforge.net/soa-stack/enpoint";; String toUri = "jbi:endpoint:http://gaswerk.sourceforge.net/soa-stack/sample/bpel/SampleBPELProcess/SampleBPELProcessPort?mep=in-out";; from(fromUri).to(toUri); --- 8< --- This results in the following error in the ODE service engine: "Operation not found". If I route the message directly from HTTP binding to the ODE service engine everything works fine. I haven't found a syntax for specifying a operation for an endpoint within the routing expression shown above. (Makes this sense at all??) After some investigation I found in the camel service engine (JbiExchange.java) a property "jbi.operation" which is set for the camel exchange (line 151) but I couldn't figure out where it is used. I'm absolutly not sure about my next step. ;-) In the JbiBinding a new JBI Message Exchange is created to route the message back to the NMR (createJbiMessageExchange). I added some lines to set the operation on the resulting MessageExchange (see attached patch). Now my sample works fine but as mentioned before I'm not sure if this is correct. Does this makes sense??? Is it a bug or a bad workaround for my problem?? The question to me is: Is it correct to 'loose' the information about the operation?? Do I have to add this information within my routing rule reading the property (how?)? Thanks! Kristian -- Kristian Köhler software architect dmc digital media center GmbH Rommelstraße 11 70376 Stuttgart (Germany) Telefon: +49 711 601747-434 Telefax: +49 711 601747-141 Internet: www.dmc.de Handelsregister: AG Stuttgart HRB 18974 Geschäftsführer: Andreas Magg, Daniel Rebhorn, Andreas Schwend - Bessere Gespräche, besseres E-Business. Willkommen auf dem Deutschen Versandhandelskongress 2007. Besuchen Sie uns in der dmc Lounge im Foyer 1. Stock. Wir sehen uns. Mehr Infos: www.dmc.de/lounge
AW: Possible Solution to a camel serviceengine problem or only a bad workaround??
Hi > Anyway, I think you're on the right track. There's no reason why the > camel SE would set the jbi.operation property when going from jbi to > camel, but not use it when going from camel to jbi. In addition, we > could make the operation also configurable on the endpoint (to be > consistent with the mep), so I think we need to add: > jbi:endpoint:?operation= Good to hear that I'm not totaly wrong ;-) I will also add the second option to the patch and raise a jira issue. > Also, I can't recall if camel provides a way to change the mep easily: > I know it is a loosely defined notion in camel, but still, there > should be an accessor in the DSL I suppose. I'm searching... Kristian
AW: Possible Solution to a camel serviceengine problem or only a bad workaround??
> I also meant that if there is not, it should be added :-) Ok... ;-)
AW: ServiceMix and Geronimo
Hi no not yet. Sounds good ;-) I will look into this... Next steps I want to take are: * Better configuration of ServiceMix Service within Geronimo * Better integration of the HTTP transport (currently jetty is started within SM) * and of course add more functionality... Any help is welcome ;-) Kristian > Btw, we should really provide more JEE oriented features in ServiceMix > / Geronimo to our users. > Kinda what Open ESB JEE SE provides for glassfish > (http://download.java.net/general/open-esb/docs/jbi-components > /jee-se.html). >We already have a JAX-WS JBI transport in CXF, so I'm sure we could > find a way to use it from EJB to access JBI for example... Have you > already thought about such things ? > > > On 10/20/07, Kristian Köhler <[EMAIL PROTECTED]> wrote: > > Hi all > > > > yesterday I finally realeased the first version of my > > ServiveMix/Geronimo distribution. You can find it here: > > > > http://gaswerk.sourceforge.net > > > > and it's called "GASwerk SOA Stack" > > > > Kristian > >
AW: ServiceMix and Geronimo
Hi > > * Better configuration of ServiceMix Service within Geronimo > > This is always something I wanted to do, but never quite got the time > to get into it. We also have a few portlets that I developped using > pluto which could be integrated into Geronimo console, but i never > really finished those :-( Is it available somewhere? > > * Better integration of the HTTP transport (currently jetty > is started within SM) > > Yeah, I solved the problem when deploying ServiceMix as a web > application, but not that way. My idea is to deploy the HTTP binding component as simple web application which is communicating with servicemix service. So ServiceMix could run as service within Geronimo and it could be managed without HTTP binding or the need for a web container. Kristian
AW: [jira] Resolved: (SM-1085) Additional geronimo deployment plan support
Hi Guillaume looks ok for me. Thanks! Kristian > -Ursprüngliche Nachricht- > Von: Guillaume Nodet (JIRA) [mailto:[EMAIL PROTECTED] > Gesendet: Sonntag, 21. Oktober 2007 22:42 > An: servicemix-dev@geronimo.apache.org > Betreff: [jira] Resolved: (SM-1085) Additional geronimo > deployment plan > support > > > > [ > https://issues.apache.org/activemq/browse/SM-1085?page=com.atl assian.jira.plugin.system.issuetabpanels:all-> tabpanel ] > > Guillaume Nodet resolved SM-1085. > - > >Resolution: Fixed > Fix Version/s: 3.2 > > Kristian, given the problems I had, it would be nice if you > could check if the commit is ok for you. > > > Additional geronimo deployment plan support > > --- > > > > Key: SM-1085 > > URL: > https://issues.apache.org/activemq/browse/SM-1085 > > Project: ServiceMix > > Issue Type: New Feature > > Components: geronimo > >Reporter: Kristian Koehler > > Fix For: 3.2 > > > > Attachments: another-patch.patch, > geronimo-plugin.patch, geronimo-servicemix-deployer-patch.patch > > > > > > Hi > > the attached patch includes an optional geronimo deployment > plan for jbi deployment units. with this patch it's possible > to deploy servicemix deployment units and specified > additional dependencies. For example if you tried to deploy > the camel service unit an ClassNotFound exception is thrown > because the class org/apache/camel/Component isn't part of > the deployment unit. With the patch it's possible to > sepcified the neccessary dependency. > > Sample geronimo-jbi.xml: > > xmlns:sjbi="http://servicemix.apache.org/xml/ns/jbi-1.0"; > xmlns:ger="http://geronimo.apache.org/xml/ns/deployment-1.2";> > > > > > > servicemix-components > > servicemix-camel > > 0.0 > > car > > > > > > > > org.apache.camel > > camel-core > > 1.1.0 > > jar > > classes > > > > > > > > > > > > > > Currently only environment entries are supported. > > Kristian > > -- > This message is automatically generated by JIRA. > - > You can reply to this email to add a comment to the issue online. > >