You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by cannifx <ca...@live.com> on 2013/08/26 16:49:39 UTC

Messages do not flow through Network of Brokers after reconnect

Hallo!
For one of my project i want to use ActiveMQ 5.8.0, and i have following
scenario:

Broker 1 - Sender
Broker 2 - MiddleManFirst
Broker 3 - MiddlemanSecond
Broker 4 - Receiver

with connectors:
broker 1:
 <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61619" />            
        </transportConnectors>
<networkConnectors>            
	<networkConnector name="sender-nc"
uri="static:(failover:(tcp://0.0.0.0:61610,tcp://0.0.0.0:61611)?randomize=false&amp;priorityBackup=true)"
dynamicOnly="false" networkTTL="3" duplex="true"/>
</networkConnectors>

broker 2:
 <transportConnectors>        
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61610" />            
</transportConnectors>
		<networkConnectors>            
			<networkConnector name="mmfirst-nc"
uri="static:(failover:(tcp://0.0.0.0:61616)?randomize=false)"
dynamicOnly="false" networkTTL="3" duplex="true"/>
</networkConnectors>

broker 3:
  <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61611" 
/>            
 </transportConnectors>
 <networkConnectors>            
	<networkConnector name="mmsecond-nc"
uri="static:(failover:(tcp://0.0.0.0:61616)?randomize=false)"
dynamicOnly="false" networkTTL="3" duplex="true"/>
</networkConnectors>

broker 4:
   <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>            
   </transportConnectors>

Configuration works flawlessly as intended until i shutdown broker 2, then i
see in log :

 WARN | Transport (tcp://0.0.0.0:61610) failed, reason: 
java.net.SocketException: Connection reset, attempting to automatically
reconnect
 INFO | Successfully reconnected to tcp://0.0.0.0:61611

but, after that only one message going through brokers, all following
messages Enqueued and Dequeued on the broker 1, i can see it in web console,
the same behavior if i start broker 2 again, i see reconnected successfully
in log, but only 1 message going through broker 4...

tried with last snapshot - same result.

Any help will be appreciated

regards, canni.

P.S. sorry for my bad English.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-do-not-flow-through-Network-of-Brokers-after-reconnect-tp4670679.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages do not flow through Network of Brokers after reconnect

Posted by cannifx <ca...@live.com>.
tabish121@gmail.com wrote
> You would need to download the NMS source, and start debugging to see 
> what's different.  You can enable tracing on the transport layer with 
> transport.useLogging=true in NMS to see each command that's sent in the 
> logs and compare that to the Java or C++ client variants.
> 
> -- 
> Tim Bish
> Sr Software Engineer | RedHat Inc.

> tim.bish@

>  | www.fusesource.com | www.redhat.com
> skype: tabish121 | twitter: @tabish121
> blog: http://timbish.blogspot.com/

Thanks, Tim !
I think it is only way to go, but i did some further investigation,
regardless of c++ or nms if i set delivery mode to persistent, messages not
going through after reconnect, with MsgDeliveryMode.NonPersistent all works
as it should, but i really need persistent messages. Piece of producer code:

IConnectionFactory factory = new ConnectionFactory(uri);
using (IConnection connection = factory.CreateConnection())
{
    using (ISession session = connection.CreateSession())
    {
          IDestination destination = new ActiveMQQueue("FOO.Alive");
          using (IMessageProducer producer =
session.CreateProducer(destination))
          {
               producer.DeliveryMode = MsgDeliveryMode.NonPersistent;
               connection.Start();                           
               ITextMessage message= session.CreateTextMessage("test");
               message.Properties.SetString("SendTime",
DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss"));
               producer.Send(message);
          }
       session.Close();
     }
   connection.Close();
}
So, may be someone have some tips ?

 



--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-do-not-flow-through-Network-of-Brokers-after-reconnect-tp4670679p4670745.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages do not flow through Network of Brokers after reconnect

Posted by Timothy Bish <ta...@gmail.com>.
On 08/27/2013 09:02 AM, cannifx wrote:
> Hi,
> thanks for quick feedback and advises, ceposta, sadly i'm not a java guy :)
>
> I have some additional input, for sending i use .NET Messaging API and
> message do not going through brokers, then i compiled sender on c++ with
> usage of ActiveMQ-CPP and it works after reconnect, more then that, if i
> send message in Webconsole it works also. So, it seems like that problem
> exists is in .NET Messaging API. Any NMS developers here to show me
> direction to dig ?
>
> regards, canni.
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Messages-do-not-flow-through-Network-of-Brokers-after-reconnect-tp4670679p4670733.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
You would need to download the NMS source, and start debugging to see 
what's different.  You can enable tracing on the transport layer with 
transport.useLogging=true in NMS to see each command that's sent in the 
logs and compare that to the Java or C++ client variants.

-- 
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/


Re: Messages do not flow through Network of Brokers after reconnect

Posted by cannifx <ca...@live.com>.
Hi,
thanks for quick feedback and advises, ceposta, sadly i'm not a java guy :)

I have some additional input, for sending i use .NET Messaging API and
message do not going through brokers, then i compiled sender on c++ with
usage of ActiveMQ-CPP and it works after reconnect, more then that, if i
send message in Webconsole it works also. So, it seems like that problem
exists is in .NET Messaging API. Any NMS developers here to show me
direction to dig ?

regards, canni.





--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-do-not-flow-through-Network-of-Brokers-after-reconnect-tp4670679p4670733.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages do not flow through Network of Brokers after reconnect

Posted by Christian Posta <ch...@gmail.com>.
So to get the best chance of getting help, I recommend you reproduce this
in a unit test. Then we will be able to see exactly what's going on and
give you the best answer. Networks of brokers can be tricky to get correct.
I would advise you take a look at this test (which has 4 brokers like
yours):

https://github.com/apache/activemq/blob/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyToTopicViaThreeNetworkHopsTest.java

And this test (which tests and verifies reconnect behavior):
https://github.com/apache/activemq/blob/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java




On Mon, Aug 26, 2013 at 7:49 AM, cannifx <ca...@live.com> wrote:

> Hallo!
> For one of my project i want to use ActiveMQ 5.8.0, and i have following
> scenario:
>
> Broker 1 - Sender
> Broker 2 - MiddleManFirst
> Broker 3 - MiddlemanSecond
> Broker 4 - Receiver
>
> with connectors:
> broker 1:
>  <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61619"
> />
>         </transportConnectors>
> <networkConnectors>
>         <networkConnector name="sender-nc"
> uri="static:(failover:(tcp://0.0.0.0:61610,tcp://0.0.0.0:61611
> )?randomize=false&amp;priorityBackup=true)"
> dynamicOnly="false" networkTTL="3" duplex="true"/>
> </networkConnectors>
>
> broker 2:
>  <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61610"
> />
> </transportConnectors>
>                 <networkConnectors>
>                         <networkConnector name="mmfirst-nc"
> uri="static:(failover:(tcp://0.0.0.0:61616)?randomize=false)"
> dynamicOnly="false" networkTTL="3" duplex="true"/>
> </networkConnectors>
>
> broker 3:
>   <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61611"
> />
>  </transportConnectors>
>  <networkConnectors>
>         <networkConnector name="mmsecond-nc"
> uri="static:(failover:(tcp://0.0.0.0:61616)?randomize=false)"
> dynamicOnly="false" networkTTL="3" duplex="true"/>
> </networkConnectors>
>
> broker 4:
>    <transportConnectors>
>             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616
> "/>
>    </transportConnectors>
>
> Configuration works flawlessly as intended until i shutdown broker 2, then
> i
> see in log :
>
>  WARN | Transport (tcp://0.0.0.0:61610) failed, reason:
> java.net.SocketException: Connection reset, attempting to automatically
> reconnect
>  INFO | Successfully reconnected to tcp://0.0.0.0:61611
>
> but, after that only one message going through brokers, all following
> messages Enqueued and Dequeued on the broker 1, i can see it in web
> console,
> the same behavior if i start broker 2 again, i see reconnected successfully
> in log, but only 1 message going through broker 4...
>
> tried with last snapshot - same result.
>
> Any help will be appreciated
>
> regards, canni.
>
> P.S. sorry for my bad English.
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Messages-do-not-flow-through-Network-of-Brokers-after-reconnect-tp4670679.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Messages do not flow through Network of Brokers after reconnect

Posted by Andy May <an...@bcpsoftware.com>.
I’ve come across a problem which has similar sounding symptoms & have done a
bit more investigation (no resolution yet though).

My problem is that when a network connector failed back to the remote broker
specified by the "priorityBackup" uri, the remote broker doesn't seem to
recognise that the connection is from another broker & doesn't check the
producerID. Because of this, it rejects messages with duplicate sequences
(even though the producerID is different).


See JIRA https://issues.apache.org/jira/browse/AMQ-4720




--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-do-not-flow-through-Network-of-Brokers-after-reconnect-tp4670679p4671416.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.