You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Kevin Burton <bu...@spinn3r.com> on 2014/07/31 02:07:04 UTC

failover: not connecting with embedded broker.

I'm trying to switch from tcp:  to failover:tcp: for my connection string
so that my apps will reconnect if a failed ActiveMQ server restarts.

All my code / tests work fine with a connection string of:

tcp://127.0.0.1:16161

(note I changed the default port)

… but if I change it to:

failover:tcp://127.0.0.1:16161

FailoverTransport Failed to connect to [tcp://
127.0.0.1:16161?jms.prefetchPolicy.all=5] after: 130 attempt(s) continuing
to retry

… then it won't work.

I wrote a external app, that connects, produces, and then consumes a
message.  That works.  With both the tcp and failover.

BUT … when I embed it , then it doesn't work.  The app just blogs trying to
connect.

I did a thread dump.. no deadlocked threads.  I also looked at locks and
everything seems fine there.

I wonder if a thread is dying and silently exiting.

Any pointers?



-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: failover: not connecting with embedded broker.

Posted by Kevin Burton <bu...@spinn3r.com>.
AH!!! You know.. I think you're right!  At least 99% of my tests now pass.

But it looks like the documentation is wrong :-(

http://activemq.apache.org/how-can-i-support-auto-reconnection.html

Just use the following connection URI (setting the brokerURL in the
ActiveMQConnectionFactory)
   failover:tcp://host:port
http://activemq.apache.org/failover-transport-reference.html

… or maybe not because it would have worked if I didn't add the ? param…

Or at least this is a potential gotcha!  which are like the worst bugs
because they never get fixed.

But this is works and thanks for the pointer!

Hm.


On Thu, Jul 31, 2014 at 5:25 AM, Gary Tully <ga...@gmail.com> wrote:

> you need some brackets, jms. options are not for the transport,
> so use failover:(tcp://....,tcp://.....)?jms.prefetchPolicy.all=5
>
> On 31 July 2014 01:07, Kevin Burton <bu...@spinn3r.com> wrote:
> > I'm trying to switch from tcp:  to failover:tcp: for my connection string
> > so that my apps will reconnect if a failed ActiveMQ server restarts.
> >
> > All my code / tests work fine with a connection string of:
> >
> > tcp://127.0.0.1:16161
> >
> > (note I changed the default port)
> >
> > … but if I change it to:
> >
> > failover:tcp://127.0.0.1:16161
> >
> > FailoverTransport Failed to connect to [tcp://
> > 127.0.0.1:16161?jms.prefetchPolicy.all=5] after: 130 attempt(s)
> continuing
> > to retry
> >
> > … then it won't work.
> >
> > I wrote a external app, that connects, produces, and then consumes a
> > message.  That works.  With both the tcp and failover.
> >
> > BUT … when I embed it , then it doesn't work.  The app just blogs trying
> to
> > connect.
> >
> > I did a thread dump.. no deadlocked threads.  I also looked at locks and
> > everything seems fine there.
> >
> > I wonder if a thread is dying and silently exiting.
> >
> > Any pointers?
> >
> >
> >
> > --
> >
> > Founder/CEO Spinn3r.com
> > Location: *San Francisco, CA*
> > blog: http://burtonator.wordpress.com
> > … or check out my Google+ profile
> > <https://plus.google.com/102718274791889610666/posts>
> > <http://spinn3r.com>
>
>
>
> --
> http://redhat.com
> http://blog.garytully.com
>



-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: failover: not connecting with embedded broker.

Posted by Gary Tully <ga...@gmail.com>.
you need some brackets, jms. options are not for the transport,
so use failover:(tcp://....,tcp://.....)?jms.prefetchPolicy.all=5

On 31 July 2014 01:07, Kevin Burton <bu...@spinn3r.com> wrote:
> I'm trying to switch from tcp:  to failover:tcp: for my connection string
> so that my apps will reconnect if a failed ActiveMQ server restarts.
>
> All my code / tests work fine with a connection string of:
>
> tcp://127.0.0.1:16161
>
> (note I changed the default port)
>
> … but if I change it to:
>
> failover:tcp://127.0.0.1:16161
>
> FailoverTransport Failed to connect to [tcp://
> 127.0.0.1:16161?jms.prefetchPolicy.all=5] after: 130 attempt(s) continuing
> to retry
>
> … then it won't work.
>
> I wrote a external app, that connects, produces, and then consumes a
> message.  That works.  With both the tcp and failover.
>
> BUT … when I embed it , then it doesn't work.  The app just blogs trying to
> connect.
>
> I did a thread dump.. no deadlocked threads.  I also looked at locks and
> everything seems fine there.
>
> I wonder if a thread is dying and silently exiting.
>
> Any pointers?
>
>
>
> --
>
> Founder/CEO Spinn3r.com
> Location: *San Francisco, CA*
> blog: http://burtonator.wordpress.com
> … or check out my Google+ profile
> <https://plus.google.com/102718274791889610666/posts>
> <http://spinn3r.com>



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

Re: failover: not connecting with embedded broker.

Posted by Kevin Burton <bu...@spinn3r.com>.
here it is.. pretty basic config really.

http://pastebin.com/tZ4bU0JF



On Wed, Jul 30, 2014 at 5:11 PM, Timothy Bish <ta...@gmail.com> wrote:

> On 07/30/2014 08:07 PM, Kevin Burton wrote:
>
>> I'm trying to switch from tcp:  to failover:tcp: for my connection string
>> so that my apps will reconnect if a failed ActiveMQ server restarts.
>>
>> All my code / tests work fine with a connection string of:
>>
>> tcp://127.0.0.1:16161
>>
>> (note I changed the default port)
>>
>> … but if I change it to:
>>
>> failover:tcp://127.0.0.1:16161
>>
>> FailoverTransport Failed to connect to [tcp://
>> 127.0.0.1:16161?jms.prefetchPolicy.all=5] after: 130 attempt(s)
>> continuing
>> to retry
>>
>> … then it won't work.
>>
>> I wrote a external app, that connects, produces, and then consumes a
>> message.  That works.  With both the tcp and failover.
>>
>> BUT … when I embed it , then it doesn't work.  The app just blogs trying
>> to
>> connect.
>>
>
> I hate it when my apps starting blogging unexpectedly.
>
>
>> I did a thread dump.. no deadlocked threads.  I also looked at locks and
>> everything seems fine there.
>>
>> I wonder if a thread is dying and silently exiting.
>>
>> Any pointers?
>>
>>
>>
>>  Can you share more info about the embedded Broker's config (what
> transports are added etc).  Hard to tell what's going on without sufficient
> information.
>
> --
> Tim Bish
> Sr Software Engineer | RedHat Inc.
> tim.bish@redhat.com | www.fusesource.com | www.redhat.com
> skype: tabish121 | twitter: @tabish121
> blog: http://timbish.blogspot.com/
>
>


-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: failover: not connecting with embedded broker.

Posted by Timothy Bish <ta...@gmail.com>.
On 07/30/2014 08:07 PM, Kevin Burton wrote:
> I'm trying to switch from tcp:  to failover:tcp: for my connection string
> so that my apps will reconnect if a failed ActiveMQ server restarts.
>
> All my code / tests work fine with a connection string of:
>
> tcp://127.0.0.1:16161
>
> (note I changed the default port)
>
> … but if I change it to:
>
> failover:tcp://127.0.0.1:16161
>
> FailoverTransport Failed to connect to [tcp://
> 127.0.0.1:16161?jms.prefetchPolicy.all=5] after: 130 attempt(s) continuing
> to retry
>
> … then it won't work.
>
> I wrote a external app, that connects, produces, and then consumes a
> message.  That works.  With both the tcp and failover.
>
> BUT … when I embed it , then it doesn't work.  The app just blogs trying to
> connect.

I hate it when my apps starting blogging unexpectedly.
>
> I did a thread dump.. no deadlocked threads.  I also looked at locks and
> everything seems fine there.
>
> I wonder if a thread is dying and silently exiting.
>
> Any pointers?
>
>
>
Can you share more info about the embedded Broker's config (what 
transports are added etc).  Hard to tell what's going on without 
sufficient information.

-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/