You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by akshay131 <ak...@gmail.com> on 2012/08/28 13:44:21 UTC

Active MQ - timeout - any alternate option in v5.2?

I am using Active MQ v5.2.0 with failover transport and Master/Slave config.

JMS publish message works fine if either Master or Slave is up and running.

Problem occurs when Master/Slave both are down. When my application tries to
publish message at this time, it won't connect to MQ (since its down) as
well as no JMSException occurs for connect failure (as failover transport is
used). So it actually gets stuck during JMS Send and control does not
return.

The solution seems to be transport option - *maxReconnectAttempts,
initialReconnectDelay, maxReconnectDelay*.  When using them I am getting
exception, control is coming back and program is not getting stuck but when
Active MQ is up again, my application is unable to connect back. The assumed
reason is use of singleton for connection bean (which is must use for my
application). 

*Timeout* option when I tried in my application using v5.6.0, it worked
properly. Basically *timout* is the exact solution to my problem as this
option provides a timeout at jms send option where my application is getting
stuck. 

But the sad part is *timeout *option is not supported in v 5.2.0  and even i
can't upgrade new version.

Is there any alternative for timeout in v5.2.0? or any other solution for my
problem



--
View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-timeout-any-alternate-option-in-v5-2-tp4655689.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Active MQ - timeout - any alternate option in v5.2?

Posted by Gary Tully <ga...@gmail.com>.
true, 5.5 requires jdk 1.6 https://issues.apache.org/jira/browse/AMQ-3105

For the xml validation, you need to check against the schema for a
given release to see what is supported.
Also, note that there was an alphabetical ordering constraint in
earlier versions.

see: http://activemq.apache.org/xml-reference.html


On 3 September 2012 08:25, akshay131 <ak...@gmail.com> wrote:
> Thanks a lot for the help...
>
> I thought of upgrading to Active MQ 5.6 but unfortunately its not supported
> for java 1.5. Am i right ??
>
> So instead i opted for v5.4.3. But I am facing issue with master/slave
> config here. I am getting XML validation exception for tag 'services'.
>
> Below is the exception:
>
> /java.lang.RuntimeException: Failed to execute start task. Reason:
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
> 148 in XML document from class path resource [activemq.xml] is invalid;
> nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
> Invalid content was found starting with element 'services'. One of
> '{"http://activemq.apache.org/schema/core":taskRunnerFactory,
> "http://activemq.apache.org/schema/core":tempDataStore,
> "http://activemq.apache.org/schema/core":transportConnectorURIs,
> "http://activemq.apache.org/schema/core":transportConnectors,
> WC[##other:"http://activemq.apache.org/schema/core"]}' is expected.
>         at
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98)
>         at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>         at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:143)
>         at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>         at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:85)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.activemq.console.Main.runTaskClass(Main.java:251)
>         at org.apache.activemq.console.Main.main(Main.java:107)
> Caused by:
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
> 148 in XML document from class path resource [activemq.xml] is invalid;
> nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
> Invalid content was found starting with element 'services'. One of
> '{"http://activemq.apache.org/schema/core":taskRunnerFactory,
> "http://activemq.apache.org/schema/core":tempDataStore,
> "http://activemq.apache.org/schema/core":transportConnectorURIs,
> "http://activemq.apache.org/schema/core":transportConnectors,
> WC[##other:"http://activemq.apache.org/schema/core"]}' is expected.
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
>         at
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:111)
>         at
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:104)
>         at
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
>         at
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
>         at
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
>         at
> org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
>         at
> org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:115)
>         at
> org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:115)
>         at
> org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:71)
>         at
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)/
>
> I have attached *activemq.xml* configuration of slave. I am not able to find
> why this is giving issue. Is it not supported for v5.4.3
>
> Pls help!
>
> Thanks!!!
>
> http://activemq.2283324.n4.nabble.com/file/n4655968/activemq.xml
> activemq.xml
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-timeout-any-alternate-option-in-v5-2-tp4655689p4655968.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com

Re: Active MQ - timeout - any alternate option in v5.2?

Posted by akshay131 <ak...@gmail.com>.
Thanks a lot for the help...

I thought of upgrading to Active MQ 5.6 but unfortunately its not supported
for java 1.5. Am i right ??

So instead i opted for v5.4.3. But I am facing issue with master/slave
config here. I am getting XML validation exception for tag 'services'.

Below is the exception:
 
/java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
148 in XML document from class path resource [activemq.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
Invalid content was found starting with element 'services'. One of
'{"http://activemq.apache.org/schema/core":taskRunnerFactory,
"http://activemq.apache.org/schema/core":tempDataStore,
"http://activemq.apache.org/schema/core":transportConnectorURIs,
"http://activemq.apache.org/schema/core":transportConnectors,
WC[##other:"http://activemq.apache.org/schema/core"]}' is expected.
        at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
        at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:143)
        at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
        at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:85)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:251)
        at org.apache.activemq.console.Main.main(Main.java:107)
Caused by:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
148 in XML document from class path resource [activemq.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a:
Invalid content was found starting with element 'services'. One of
'{"http://activemq.apache.org/schema/core":taskRunnerFactory,
"http://activemq.apache.org/schema/core":tempDataStore,
"http://activemq.apache.org/schema/core":transportConnectorURIs,
"http://activemq.apache.org/schema/core":transportConnectors,
WC[##other:"http://activemq.apache.org/schema/core"]}' is expected.
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:111)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:104)
        at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
        at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
        at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
        at
org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:115)
        at
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:115)
        at
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:71)
        at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)/

I have attached *activemq.xml* configuration of slave. I am not able to find
why this is giving issue. Is it not supported for v5.4.3

Pls help!

Thanks!!!

http://activemq.2283324.n4.nabble.com/file/n4655968/activemq.xml
activemq.xml 




--
View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-timeout-any-alternate-option-in-v5-2-tp4655689p4655968.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Active MQ - timeout - any alternate option in v5.2?

Posted by Gary Tully <ga...@gmail.com>.
Have a peek at the TransportListener interface. you can monitor the
state of the failover transport. Your app will need to pause if the
connection is stuck trying to reconnect, so if there is an interrupted
with no corresponding resume

Search for TransportListener in
http://activemq.apache.org/failover-transport-reference.html

but try and upgrade, it is always easier to find support on the latest version.


On 28 August 2012 12:44, akshay131 <ak...@gmail.com> wrote:
> I am using Active MQ v5.2.0 with failover transport and Master/Slave config.
>
> JMS publish message works fine if either Master or Slave is up and running.
>
> Problem occurs when Master/Slave both are down. When my application tries to
> publish message at this time, it won't connect to MQ (since its down) as
> well as no JMSException occurs for connect failure (as failover transport is
> used). So it actually gets stuck during JMS Send and control does not
> return.
>
> The solution seems to be transport option - *maxReconnectAttempts,
> initialReconnectDelay, maxReconnectDelay*.  When using them I am getting
> exception, control is coming back and program is not getting stuck but when
> Active MQ is up again, my application is unable to connect back. The assumed
> reason is use of singleton for connection bean (which is must use for my
> application).
>
> *Timeout* option when I tried in my application using v5.6.0, it worked
> properly. Basically *timout* is the exact solution to my problem as this
> option provides a timeout at jms send option where my application is getting
> stuck.
>
> But the sad part is *timeout *option is not supported in v 5.2.0  and even i
> can't upgrade new version.
>
> Is there any alternative for timeout in v5.2.0? or any other solution for my
> problem
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-timeout-any-alternate-option-in-v5-2-tp4655689.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com