> On Oct. 22, 2014, 2:39 p.m., Ernie Allen wrote:
> > ```
> > def brokerConnectionFailed(self, broker, e):
> > """ Invoked when a connection to a broker fails """
> > if self.first_connect:
> > self.first_connect = None
> > print "Failed to connect: ", e
> > ```
> > If you set self.first_connect to None here there will be no "Broker
> > connected:" message when the broker does actually connect.
> > You may want a separate variable to control the printing of the "Failed to
> > connect:" message.
I see it opposite: when console fails to connect (and it has not been connected
yet, otherwise brokerConnected has been called), the "Failed to connect" is
printed out (just once) and first_connect is set to None. If further
conn.attempt wont succeed, we dont print it again (intentional). If the attempt
will succeed, brokerConnected method will print "Broker connected" message.
I have tried this already. When starting qpid-tool before qpidd:
$ ./tools/src/py/qpid-tool
Management Tool for QPID
qpid: Failed to connect: Exception during connection setup: error - [Errno
111] Connection refused
Broker connected: Broker connected at: localhost:5672
When restarting broker while qpid-tool was connected:
$ ./tools/src/py/qpid-tool
Management Tool for QPID
qpid: Broker disconnected: Disconnected Broker
Broker connected: Broker connected at: localhost:5672
- Pavel
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/27032/#review57787
-----------------------------------------------------------
On Oct. 23, 2014, 7:52 a.m., Pavel Moravec wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/27032/
> -----------------------------------------------------------
>
> (Updated Oct. 23, 2014, 7:52 a.m.)
>
>
> Review request for qpid, Ernie Allen, Kenneth Giusti, and Ted Ross.
>
>
> Bugs: QPID-6177
> https://issues.apache.org/jira/browse/QPID-6177
>
>
> Repository: qpid
>
>
> Description
> -------
>
> Simple patch that overwrites default empty brokerConnectionFailed method
> raised when connection fails. It makes sense to react only when connecting
> for the first time.
>
> Changes in package imports are irrelevant to this JIRA - I had to do the
> change to let qpid-tool to start working on trunk (?).
>
> As the logic of QMF console is to retry failed connections, I suggest just
> raising some warning than directly stopping qpid-tool.
>
>
> Diffs
> -----
>
> trunk/qpid/tools/src/py/qpid-tool 1633165
>
> Diff: https://reviews.apache.org/r/27032/diff/
>
>
> Testing
> -------
>
> Testing with invalid hostname:
>
> $ ./tools/src/py/qpid-tool invalidHost
> Management Tool for QPID
> qpid: Failed to connect: [Errno -2] Name or service not known
>
>
> Testing with no SASL mech in common:
>
> $ ./tools/src/py/qpid-tool
> Management Tool for QPID
> qpid: Failed to connect: (None, 'sasl negotiation failed: no mechanism
> agreed')
>
>
> Thanks,
>
> Pavel Moravec
>
>