You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by gupabhi <ab...@morganstanley.com> on 2008/08/16 01:55:29 UTC

Using JMSConduit without JNDI

Hi,
    The org.apache.cxf.transport.jms.JMSConduit seems tightly coupled with
JNDI. I want to be able to use it without depending on JNDI atall. It would
be nice if future versions could have loose coupling with JNDI. Something
that could be configured using spring.
I'm now writing my own JMSConduit which uses a JMSTemplate instead of reuing
the one provided.

Thanks,
Abhi

-- 
View this message in context: http://www.nabble.com/Using-JMSConduit-without-JNDI-tp19007202p19007202.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using JMSConduit without JNDI

Posted by Christian Schneider <ch...@die-schneider.net>.
gupabhi schrieb:
> Hi,
>     The org.apache.cxf.transport.jms.JMSConduit seems tightly coupled with
> JNDI. I want to be able to use it without depending on JNDI atall. It would
> be nice if future versions could have loose coupling with JNDI. Something
> that could be configured using spring.
> I'm now writing my own JMSConduit which uses a JMSTemplate instead of reuing
> the one provided.
>
> Thanks,
> Abhi
>
>   
You can also use camel for jms. We use the camel cxf transport and then 
simply put the services on a camel direct endpoint and configure jms and 
the route in camel. I posted a config below.
While I think cxf should have a better JMS config I think the solution 
with camel works quite nicely. In camel you can simply configure a 
ConncectionFactory and then wire it.

I will post a complete example in the wiki shortly.

Best regards

Christian

---

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
        http://activemq.apache.org/camel/schema/spring 
http://activemq.apache.org/camel/schema/spring/camel-spring-1.4.0.xsd
        http://cxf.apache.org/transports/camel 
http://cxf.apache.org/transports/camel.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import 
resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-camel.xml" />

  <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="jmsConnectionFactory" />
        <property name="useMessageIDAsCorrelationID" value="true" />
    </bean>

    <bean id="jmsConnectionFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616" />
    </bean>

    <bean 
class="org.apache.camel.component.cxf.transport.CamelTransportFactory">
        <property name="bus" ref="cxf" />
        <property name="camelContext" ref="camelContext" />
        <property name="transportIds">
            <list>
                <value>http://cxf.apache.org/transports/camel</value>
            </list>
        </property>
    </bean>

    <endpoint xmlns="http://cxf.apache.org/jaxws" 
xmlns:customer="http://examples.etg.enbw.net/"
        id="CustomerService"
        address="camel://direct:CustomerService"
        serviceName="customer:CustomerServiceService"
        endpointName="customer:CustomerServiceEndpoint"
        implementor="CustomerServiceImpl">
        <features>
            <!-- Enables logging of SOAP messages. -->
            <logging xmlns="http://cxf.apache.org/core" />
        </features>
    </endpoint>

    <camelContext id="camelContext" trace="true"
        xmlns="http://activemq.apache.org/camel/schema/spring">
        <route>
            <from
                
uri="jms://net.enbw.services.etg.examples.CustomerService" />
            <to
                uri="direct:CustomerService" />
        </route>
    </camelContext>
</beans>