rabbitmq / rabbitmq-java-client

RabbitMQ Java client
https://www.rabbitmq.com/java-client.html
Other
1.25k stars 576 forks source link

Recovery mechanism is not working #435

Closed forlayo closed 5 years ago

forlayo commented 5 years ago

Scenario

OS version: Android 6.0 Client used: 4.8.1

Steps

1.- Create a connection with recovery enabled

connectionFactory = new ConnectionFactory();

connectionFactory.setConnectionTimeout( 5000 );
connectionFactory.setAutomaticRecoveryEnabled(true);
connectionFactory.setTopologyRecoveryEnabled(true);
connectionFactory.setNetworkRecoveryInterval(10000);

connectionFactory.setUri(cred.getConnString());
connection = connectionFactory.newConnection();

channelService = connection.createChannel();
// Following recomendations of CloudAMQP diagnosis we need to put a prefetch to not affect throughput.
channelService.basicQos(25);
channelService.exchangeDeclarePassive(EX_SERV_NAME);

channelCmdPublish = connection.createChannel();
channelCmdPublish.basicQos(25);

channelCmdSubscribe = connection.createChannel();
channelCmdSubscribe.basicQos(25);
channelCmdSubscribe.exchangeDeclarePassive(EX_CMD_NAME);

2.- Disconnect the wire on Android device and wait. 3.- After 2 minutes, connect the wire again and wait. 4.- After 5 minutes it still not connected again, nothing happens nothing appears on logs.

I've also tried to add a listener of recover to connection and to one of channels:

((Recoverable) this.connection).addRecoveryListener(new RecoveryListener() {
    @Override
    public void handleRecovery(Recoverable recoverable) {
        Log.e(TAG,"handleRecovery");
    }

    @Override
    public void handleRecoveryStarted(Recoverable recoverable) {
        Log.e(TAG,"handleRecoveryStarted");
    }
});

((Recoverable) this.channelService).addRecoveryListener(new RecoveryListener() {
    @Override
    public void handleRecovery(Recoverable recoverable) {
        Log.e(TAG,"handleRecovery");
    }

    @Override
    public void handleRecoveryStarted(Recoverable recoverable) {
        Log.e(TAG,"handleRecoveryStarted");
    }
});

These methods are never called :S. What I'm doing wrong?

michaelklishin commented 5 years ago

Thank you for your time.

Team RabbitMQ uses GitHub issues for specific actionable items engineers can work on. GitHub issues are not used for questions, investigations, root cause analysis, discussions of potential issues, etc (as defined by this team).

We get at least a dozen of questions through various venues every single day, often light on details. At that rate GitHub issues can very quickly turn into a something impossible to navigate and make sense of even for our team. Because GitHub is a tool our team uses heavily nearly every day, the signal/noise ratio of issues is something we care about a lot.

Please post this to rabbitmq-users.

Thank you.

michaelklishin commented 5 years ago

We would really appreciate

Currently we can only guess as to what is going on and we strongly prefer to avoid guessing on this team.

michaelklishin commented 5 years ago

rabbitmq-users thread