Hi,

My comment inline
On 2010-5-25, at 上午3:56, allisonsdad wrote:


Folks,

I am trying to implement clustering in SMX 4 and I'm using the cxf- camel-nmr example to experiment with. From what I have read this example should be a good fit: it involves the nmr, osgi, and a camel route which could force the
cluster to use another instance of an endpoint.

So my issue is how can I implement clustering in the cxf-camel-nmr example,
or is it NOT possible?

After I have setup the etc/activemq.xml for clustering, I tried to configure an OsgiSimpleClusterRegistration bean following the sample clustering XML:

<!-- service def -->
<http:consumer id="myHttpConsumer" service="test:myService"
endpoint="myEndpoint" />
<!-- register the service -->
<bean
class = "org .apache.servicemix.jbi.cluster.engine.OsgiSimpleClusterRegistration">
        <property name="endpoint" ref="myHttpConsumer" />
</bean>

Then, to register the jaxws endpoint (from the example):

<jaxws:endpoint id="helloWorld"
implementor="org.apache.servicemix.examples.cxfcamel.HelloWorldImpl"
address="nmr:HelloWorld"/>
bean with id="helloWorld" is jaxws endpoint, which use nmr transport(because the address specify nmr prefix), it will create NMRDestination underlying which is a NMR Endpoint, but here bean with id="helloWorld" itself not NMR Endpoint, it's jaxws endpoint.

... I am simply doing this:

<bean
class = "org .apache.servicemix.jbi.cluster.engine.OsgiSimpleClusterRegistration">
        <property name="endpoint" ref="helloWorld" />
</bean>

So here you pass in endpoint property a jaxws endpoint but not NMR endpoint, which cause the "one field to match on must be set" exception, as it can't create endpoint filter from the jaxws endpoint you pass in. (It want a NMR endpoint or NMR endpoint name/serviceName, etc)
So Your OsgiSimpleClusterRegistration  configuration should be
<bean
class = "org .apache.servicemix.jbi.cluster.engine.OsgiSimpleClusterRegistration">
        <property name="endpoint" ref="helloWorld" />
        <property name="name">
            <value>HelloWorld</value>
        </property>
        <property name="serviceName">
            <ref bean="serviceName" />
        </property>
    </bean>

    <bean name="serviceName" class="javax.xml.namespace.QName">
<constructor-arg index="0"><value>http://cxfcamel.examples.servicemix.apache.org/ </value></constructor-arg> <constructor-arg index="1"><value>HelloWorldImplService</ value></constructor-arg>
    </bean>

Freeman


... which produces the following exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name
'org .apache.servicemix.jbi.cluster.engine.OsgiSimpleClusterRegistration #0' defined in URL bundleentry://279.fwk30844270/META-INF/spring/ beans.xml:
Invocation of init method failed; nested exception is
java.lang.IllegalArgumentException: one field to match on must be set
....

How exactly do I register HelloWorldImpl ??

Thanks,
Bret
--
View this message in context: 
http://old.nabble.com/SMX4-and-Clustering%3A-How-about-a-good%2C-comprehensive-example--tp28661144p28661144.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.



--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com

Reply via email to