You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jason Rosenberg <jr...@shopzilla.com> on 2008/02/07 07:28:50 UTC
Re: ActiveMQ failover url problems
I think the uri parsing doesn't like nested '?'s....Probably a bug?
But, if you have '?' inside the parens, then you can't use one outside the
parens...
So, you might have:
failover:(tcp://myserver?wireFormat.maxInactivityDuration=0)&maxReconnectDelay=1000
Jason
ramj2ee wrote:
>
> If I use failover url without wireformat parameters it is working fine and
> reconnecting on server restart.
> If I use failover url with wireformat parameters then it is not
> reconnecting.
> Whenever I stoped the server it automatically comming out without giving
> any exception
> here is my code, can any one suggest what changes I needed to make for
> failover url to work with parameters?
>
> try
> {
> ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(new URI("failover://(" +
> ActiveMQConnection.DEFAULT_BROKER_URL
> +"?wireFormat.cacheEnabled=false&wireFormat.maxInactivityDuration=0&wireFormat.tightEncodingEnabled=true)?maxReconnectDelay=1000"));
> connectionFactory.setCopyMessageOnSend(false);
> connectionFactory.setUseCompression(true);
>
> connection = connectionFactory.createConnection();
> if (clientId != null && clientId.length()>0 &&
> !"null".equals(clientId) ) {
> connection.setClientID(clientId);
> }
> connection.start();
> Session session = connection.createSession(true,
> Session.AUTO_ACKNOWLEDGE);
> Queue queue =
> session.createQueue("productfeed.productEvents");
> MessageConsumer consumer = session.createConsumer(queue);
> consumer.setMessageListener(new
> ProductEventsListener(session));
> }
> catch(JMSException e)
> {
> logger.error(e, e);
> }
> catch (Exception e) {
> logger.error("error is " + e, e);
> }
>
> here I am getting message on ProductEventsListener implements
> MessageListner on onMessage(message) method
>
--
View this message in context: http://www.nabble.com/ActiveMQ-failover-url-problems-tp13764784s2354p15328109.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: ActiveMQ failover url problems
Posted by ttmdev <jo...@ttmsolutions.com>.
I am using the 5.1 SNAPSHOT and this failover uri works for me.
failover://(tcp://localhost:61616?wireFormat.cacheEnabled=false&wireFormat.maxInactivityDuration=0&wireFormat.tightEncodingEnabled=true)?maxReconnectDelay=1000
Jason Rosenberg wrote:
>
> I think the uri parsing doesn't like nested '?'s....Probably a bug?
>
> But, if you have '?' inside the parens, then you can't use one outside the
> parens...
>
> So, you might have:
>
> failover:(tcp://myserver?wireFormat.maxInactivityDuration=0)&maxReconnectDelay=1000
>
> Jason
>
>
>
> ramj2ee wrote:
>>
>> If I use failover url without wireformat parameters it is working fine
>> and reconnecting on server restart.
>> If I use failover url with wireformat parameters then it is not
>> reconnecting.
>> Whenever I stoped the server it automatically comming out without giving
>> any exception
>> here is my code, can any one suggest what changes I needed to make for
>> failover url to work with parameters?
>>
>> try
>> {
>> ActiveMQConnectionFactory connectionFactory = new
>> ActiveMQConnectionFactory(new URI("failover://(" +
>> ActiveMQConnection.DEFAULT_BROKER_URL
>> +"?wireFormat.cacheEnabled=false&wireFormat.maxInactivityDuration=0&wireFormat.tightEncodingEnabled=true)?maxReconnectDelay=1000"));
>> connectionFactory.setCopyMessageOnSend(false);
>> connectionFactory.setUseCompression(true);
>>
>> connection = connectionFactory.createConnection();
>> if (clientId != null && clientId.length()>0 &&
>> !"null".equals(clientId) ) {
>> connection.setClientID(clientId);
>> }
>> connection.start();
>> Session session = connection.createSession(true,
>> Session.AUTO_ACKNOWLEDGE);
>> Queue queue =
>> session.createQueue("productfeed.productEvents");
>> MessageConsumer consumer = session.createConsumer(queue);
>> consumer.setMessageListener(new
>> ProductEventsListener(session));
>> }
>> catch(JMSException e)
>> {
>> logger.error(e, e);
>> }
>> catch (Exception e) {
>> logger.error("error is " + e, e);
>> }
>>
>> here I am getting message on ProductEventsListener implements
>> MessageListner on onMessage(message) method
>>
>
>
-----
Joe
www.ttmsolutions.com
--
View this message in context: http://www.nabble.com/ActiveMQ-failover-url-problems-tp13764784s2354p15363301.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.