Skip to content

StompBrokerRelayMessageHandler cannot reconnect to host after host relocation to new IP and dns change [SPR-13702] #18277

@spring-projects-issues

Description

@spring-projects-issues

Juliusz Piwoński opened SPR-13702 and commented

Scenario 1: StompBrokerRelay is initiated correctly and connected to host e.g. foobar.com which was resolved to lets say 192.168.1.100.
Then we start a new server (Rabbit) on another IP address and re-point the DNS name foobar.com to the new address.
Unfortunatelly NettyTcpClient still tries to connect to the old address which is accompanied by the following log entry

2015-11-18 23:52:16.809  INFO 28858 --- [eactor-tcp-io-7] r.io.net.impl.netty.tcp.NettyTcpClient   : Failed to connect to foobar.com/192.168.1.100:61613. Attempting reconnect in 5000ms.

||
Scenario 2: similar scenario when resolving host name fails (DNS broken) during StompBrokerRelayMessageHandler initialization.
In consequence handler will never connect to host, even after DNS server is fixed and running.

I'm not sure whose responsibility is to resolve host name again (StompBrokerRelayMessageHandler, Reactor2TcpClient or Netty) but I would point to Reactor2TcpClient client as currently resolving dns names is done only once in:
reactor.io.net.Spec.TcpClientSpec called by Reactor2TcpClient constructor.

I think similar issue was mentioned in reactor/reactor#379
and one of the possible solution could be exposing ReconnectStrategy to configuration (as mentioned a the end of conversation: rstoyanchev/spring-websocket-portfolio#47).
Or simply make resolving host name always with each reconnect attempt (currently fixed 5s).

Is that correct or am I missing something?

environment:

org.springframework:spring-messaging:4.2.1.RELEASE
io.projectreactor:reactor-net:2.0.5.RELEASE
io.netty:netty-all:4.0.32.Final

Affects: 4.2.1

1 votes, 5 watchers

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions