Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 452546

Summary: No way to determine if session/connection is established
Product: Red Hat Enterprise MRG Reporter: Robert Rati <rrati>
Component: python-qpidAssignee: Rafael H. Schloming <rafaels>
Status: CLOSED ERRATA QA Contact: Frantisek Reznicek <freznice>
Severity: low Docs Contact:
Priority: low    
Version: 1.0CC: esammons, freznice, tross
Target Milestone: 1.3   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The Messaging Client Python API now provides the connection.opened, connection.closed, and session.closed API calls, for programmatically determining when connections or sessions are open or closed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-14 15:58:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Robert Rati 2008-06-23 17:18:44 UTC
Description of problem:
There isn't a public method to determine if a session or connection is open and
thus needs to be closed in a graceful shutdown.  This is needed/useful in
exception scenarios.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 Frantisek Reznicek 2010-09-22 14:27:18 UTC
The feature was implemented to the python's low level API
  connection.opened
  connection.closed
and
  session.closed

tested on RHEL4.8 / 5.5 i386 / x86_64 on
python-qpid-0.7.946106-14.el4/5

All above properties are functional.

-> VERIFIED


P.S. Python's high level API contains:
  connection.opened
and
  session.closed



Additional info (testing approach):
[root@mrg-qe-03 ~]# python
Python 2.3.4 (#1, Jul 16 2009, 07:03:37)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qpid;
>>> from qpid.connection import Connection;
>>> from qpid.util import connect
>>> from qpid.datatypes import Message, RangedSet, uuid4
>>>
>>> def conn_stat (c):
...   #print c;
...   print c.opened;
...   print c.closed;
...
>>> def sess_stat (s):
...   print s;
...   print s.closed;
...
>>> socket = None;
>>> socket = connect('localhost', 5672);
>>> connection = Connection(sock=socket);
>>> conn_stat(connection);
False
False
>>> connection.start();
>>> conn_stat(connection);
True
False
>>> session = connection.session(str(uuid4()));
>>> sess_stat(session);
<Session: 64f90f0a-f9cc-764a-8230-7d4d5e1d5ba5, 127.0.0.1:46735[1]>
<bound method Session.closed of <Session: 64f90f0a-f9cc-764a-8230-7d4d5e1d5ba5, 127.0.0.1:46735[1]>>
>>> session.close(timeout=10);
>>> sess_stat(session);
<Session: 64f90f0a-f9cc-764a-8230-7d4d5e1d5ba5, None>
<bound method Session.closed of <Session: 64f90f0a-f9cc-764a-8230-7d4d5e1d5ba5, None>>
>>> connection.close();
>>> conn_stat(connection);
False
True
>>>

Comment 3 Douglas Silas 2010-10-07 15:53:23 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The Messaging Client Python API now provides the connection.opened, connection.closed, and session.closed API calls, for programmatically determining when connections or sessions are open or closed.

Comment 5 errata-xmlrpc 2010-10-14 15:58:08 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2010-0773.html