activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SuoNayi <suonayi2...@163.com>
Subject Re:Re: Best protocol & network interface binding
Date Thu, 07 Mar 2013 02:28:59 GMT
Yes, this feature is discovered by digging the source code and you can not find any docs/pages
to mention that currently.
Maybe someone can add a entry in the FAQ.

I had tested it last year and there are 8 network interfaces on that server, I had to specify
the local address to bind to communicate with the remote broker.
The downside is obvious as Raúl said.

At 2013-03-06 23:45:02,"Raúl Kripalani" <raul@evosent.com> wrote:
>Yes, you're right. You can force the socket to bind to a particular Network Interface.
But this is done to override the primary decision the OS takes based on its routing tables.
>Furthermore, by making the application layer participate in the IP routing, you likely
end up with fragile code and - to some extent - breaking the nice separation of the OSI layer
model. After all, you'll have to maintain the binding network interface name and/or IP in
the configuration of every client machine as they change over time. 
>
>Anyway, your choice ;) Please let us know if SuoNayi's approach works.
>
>Regards,
>Raúl. 
>
>On Mar 6, 2013, at 15:04, jan wrote:
>
>> When I open a socket in Java to send/receive data, I can do the following:
>> 
>> // open socket
>> dc = DatagramChannel.open(StandardProtocolFamily.INET6);
>> 
>> // set options ... 
>> 
>> // bind to IP. The SocketAddress comes from the network-interface using 
>> // NetworkInterface.getByName(networkIntf)
>> dc.bind(socketAddress);
>> 
>> But that's the theory. I use ActiveMQ to receive JMS messages and write the
>> following:
>> 
>> ActiveMQConnectionFactory connectionFactory = new
>> ActiveMQConnectionFactory("system", "manager", "tcp://some_server:61616");
>> 
>> From the preceding answer from SuoNayi, the following code should work:
>> 
>> ActiveMQConnectionFactory connectionFactory = new
>> ActiveMQConnectionFactory("system", "manager",
>> "tcp://broker-ip:broker-port/local-ip:local-port?wireFormat.maxInactivityDuration=120000
>> ");
>> 
>> where the variable "local-ip" comes from the 
>> NetworkInterface.getByName(networkIntf) object.
>> 
>> However, I can't find any documentation. I will try this code tomorrow.
>> Further info is really appreciated.
>> 
>> greetings
>> Jan
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://activemq.2283324.n4.nabble.com/Best-protocol-network-interface-binding-tp4664240p4664435.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message