How to set a JMS failover endpoint

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set a JMS failover endpoint

王朋义
Hi all,
I have a proxy which send the soap message to a ActiveMQ queue, my config is below:
          <?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="INMessageService" transports="http" startOnLoad="true" trace="disable">
    <target>
        <inSequence>
            <log level="full"/>
            <property name="OUT_ONLY" value="true" scope="default"/>
            <clone>
                <target>
                    <endpoint>
                        <address uri="jms:/OMS?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://172.20.41.149:61616&amp;transport.jms.DestinationType=queue"/>
                    </endpoint>
                </target>
            </clone>
        </inSequence>
    </target>
    <publishWSDL key="gov:/services/FileService.wsdl">
        <resource location="Message.xsd" key="gov:/services/Message.xsd"/>
    </publishWSDL>
</proxy>
And now we need send the message to failover endpoints, and I checked the ActiveMQ document here(http://activemq.apache.org/failover-transport-reference.html).

I tried two kinds of URI:
failover://(tcp://172.20.41.149:61616,tcp://172.20.41.40:61616)?initialReconnectDelay=100
failover:(tcp://172.20.41.149:61616,tcp://172.20.41.40:61616)?initialReconnectDelay=100

But the ESB displayed " Invalid URL provided "

Then I tried the failover group, and my config is below:
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="OMSMessageEndpoint">
   <failover>
      <endpoint>
         <address uri="jms:/OMS?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://172.20.41.149:61616&transport.jms.DestinationType=queue"/>
      </endpoint>
      <endpoint>
         <address uri="jms:/OMS?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://172.20.41.40:61616&transport.jms.DestinationType=queue"/>
      </endpoint>
   </failover>
</endpoint>
But displayed error below:

[2011-12-27 11:47:40,406]  WARN - JMSUtils Cannot locate destination : OMS
[2011-12-27 11:47:40,562] ERROR - JMSOutTransportInfo Couldn't locate the JMS de
stination OMS of type queue extracted from the URL jms:/OMS?transport.jms.Connec
tionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.a
pache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp:/
/172.20.41.149:61616&transport.jms.DestinationType=queue
javax.naming.NameNotFoundException: Name dynamicQueues is not bound in this Cont
ext
        at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
        at org.wso2.carbon.utils.multitenancy.CarbonContextHolder$CarbonInitialJ
NDIContext.lookup(CarbonContextHolder.java:996)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:509)
        at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.ja
va:718)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.getDestination(JMS
OutTransportInfo.java:184)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.loadConnectionFact
oryFromProperties(JMSOutTransportInfo.java:132)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.createJMSSender(JM
SOutTransportInfo.java:330)
        at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:1
24)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(Abstra
ctTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
        at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(O
utOnlyAxisOperation.java:278)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:
165)
        at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2Flexib
leMEPClient.java:441)
        at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)

        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2Synap
seEnvironment.java:271)
        at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.j
ava:297)
        at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.jav
a:59)
        at org.apache.synapse.endpoints.FailoverEndpoint.send(FailoverEndpoint.j
ava:85)
        at org.apache.synapse.mediators.eip.Target.mediate(Target.java:137)
        at org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(Clone
Mediator.java:90)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractLis
tMediator.java:60)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMe
diator.java:114)
        at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(Pro
xyServiceMessageReceiver.java:154)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq
uest(HTTPTransportUtils.java:172)
        at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosin
gMethod(ServerWorker.java:408)
        at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java
:259)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(Native
WorkerPool.java:173)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
        at java.lang.Thread.run(Thread.java:619)
[2011-12-27 11:47:40,687] ERROR - Axis2Sender Unexpected error during sending me
ssage out
org.apache.axis2.transport.jms.AxisJMSException: Couldn't locate the JMS destina
tion OMS of type queue extracted from the URL jms:/OMS?transport.jms.ConnectionF
actoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache
.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://172.
20.41.149:61616&transport.jms.DestinationType=queue
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.handleException(JM
SOutTransportInfo.java:250)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.getDestination(JMS
OutTransportInfo.java:186)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.loadConnectionFact
oryFromProperties(JMSOutTransportInfo.java:132)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.createJMSSender(JM
SOutTransportInfo.java:330)
        at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:1
24)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(Abstra
ctTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
        at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(O
utOnlyAxisOperation.java:278)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:
165)
        at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2Flexib
leMEPClient.java:441)
        at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)

        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2Synap
seEnvironment.java:271)
        at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.j
ava:297)
        at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.jav
a:59)
        at org.apache.synapse.endpoints.FailoverEndpoint.send(FailoverEndpoint.j
ava:85)
        at org.apache.synapse.mediators.eip.Target.mediate(Target.java:137)
        at org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(Clone
Mediator.java:90)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractLis
tMediator.java:60)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMe
diator.java:114)
        at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(Pro
xyServiceMessageReceiver.java:154)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq
uest(HTTPTransportUtils.java:172)
        at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosin
gMethod(ServerWorker.java:408)
        at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java
:259)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(Native
WorkerPool.java:173)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NameNotFoundException: Name dynamicQueues is not bound i
n this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:803)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
        at org.wso2.carbon.utils.multitenancy.CarbonContextHolder$CarbonInitialJ
NDIContext.lookup(CarbonContextHolder.java:996)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.apache.axis2.transport.jms.JMSUtils.lookup(JMSUtils.java:509)
        at org.apache.axis2.transport.jms.JMSUtils.lookupDestination(JMSUtils.ja
va:718)
        at org.apache.axis2.transport.jms.JMSOutTransportInfo.getDestination(JMS
OutTransportInfo.java:184)
        ... 26 more


Best wishes,
Rocwing

--
带着你现有的记忆和理解,去成为之前的自己。
博客:RocWing's Blog

_______________________________________________
Esb-java-user mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/esb-java-user
Reply | Threaded
Open this post in threaded view
|

Re: How to set a JMS failover endpoint

Udayanga Wickramasinghe
Hi,
<quote author="王朋义">
Hi all,
I have a proxy which send the soap message to a ActiveMQ queue, my config
is below:
          <?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="INMessageService"
transports="http" startOnLoad="true" trace="disable">
    <target>
        <inSequence>
            <log level="full"/>
            <property name="OUT_ONLY" value="true" scope="default"/>
            <clone>
                <target>
                    <endpoint>
                        <address
uri="jms:/OMS?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://172.20.41.149:61616
&amp;transport.jms.DestinationType=queue"/>
                    </endpoint>
                </target>
            </clone>
        </inSequence>
    </target>
    <publishWSDL key="gov:/services/FileService.wsdl">
        <resource location="Message.xsd" key="gov:/services/Message.xsd"/>
    </publishWSDL>
</proxy>

And now we need send the message to failover endpoints, and I checked the
ActiveMQ document here(
http://activemq.apache.org/failover-transport-reference.html).

I tried two kinds of URI:
failover://(tcp://172.20.41.149:61616,tcp://172.20.41.40:61616
)?initialReconnectDelay=100
failover:(tcp://172.20.41.149:61616,tcp://172.20.41.40:61616
)?initialReconnectDelay=100

To enable native failover capability ,you need to confgiure this in the the endpoint configuration (parameter section) of ESB. You can use a configuration as the following

<send>
                <endpoint>
                <address
                        uri="jms:/OMS?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=failover:(tcp://localhost:61616,tcp://192.168.1.2:61616)?randomize=false&amp;transport.jms.DestinationType=queue"/>
            </endpoint>
            </send>

Please note that i have now changed the  java.naming.provider.url to a failover configuration with two failover nodes pointing to primary and secondary ..
Regards,
udayanga
Reply | Threaded
Open this post in threaded view
|

Re: How to set a JMS failover endpoint

王朋义
Hi  udayanga,

Thanks! it works!

在 2011年12月28日 下午1:49,udayanga <[hidden email]>写道:

Hi,

Hi all,
I have a proxy which send the soap message to a ActiveMQ queue, my config
is below:
         <?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="INMessageService"
transports="http" startOnLoad="true" trace="disable">
   <target>
       <inSequence>
           <log level="full"/>
           <property name="OUT_ONLY" value="true" scope="default"/>
           <clone>
               <target>
                   <endpoint>
                       <address
uri="jms:/OMS?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://172.20.41.149:61616
&amp;transport.jms.DestinationType=queue"/>
                   </endpoint>
               </target>
           </clone>
       </inSequence>
   </target>
   <publishWSDL key="gov:/services/FileService.wsdl">
       <resource location="Message.xsd" key="gov:/services/Message.xsd"/>
   </publishWSDL>
</proxy>

And now we need send the message to failover endpoints, and I checked the
ActiveMQ document here(
http://activemq.apache.org/failover-transport-reference.html).

I tried two kinds of URI:
failover://(tcp://172.20.41.149:61616,tcp://172.20.41.40:61616
)?initialReconnectDelay=100
failover:(tcp://172.20.41.149:61616,tcp://172.20.41.40:61616
)?initialReconnectDelay=100

To enable native failover capability ,you need to confgiure this in the the
endpoint configuration (parameter section) of ESB. You can use a
configuration as the following

<send>
               <endpoint>
               <address

uri="jms:/OMS?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=failover:(tcp://localhost:61616,tcp://192.168.1.2:61616)?randomize=false&amp;transport.jms.DestinationType=queue"/>
               </endpoint>
           </send>

Please note that i have now changed the  java.naming.provider.url to a
failover configuration with two failover nodes pointing to primary and
secondary ..
Regards,
udayanga
--
View this message in context: http://old.nabble.com/How-to-set-a-JMS-failover-endpoint-tp33040240p33044417.html
Sent from the WSO2 ESB Users mailing list archive at Nabble.com.

_______________________________________________
Esb-java-user mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/esb-java-user



--
带着你现有的记忆和理解,去成为之前的自己。
博客:RocWing's Blog

_______________________________________________
Esb-java-user mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/esb-java-user