Qpid
  1. Qpid
  2. QPID-4760

Associate Java Broker QueueAdapter and SessionAdapter via ConsumerAdapter

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.22
    • Component/s: Java Broker
    • Labels:
      None

      Description

      In the management model it should be possible to navigate from a Connection through its associated Sessions to Queues via Subscriptions/Consumers.

      Basically Subscription is an association class linking Session and Queue.

      In the Java Broker Management Model there was code missing that should allow the SessionAdapter to getSubscriptions().

      This patch provides code to do the necessary object registrations to allow the Subscriptions in SessionAdapter to be correctly maintained thus allowing navigation from Connection to Queue and vice versa.

        Activity

        Hide
        Robbie Gemmell added a comment -

        The changes to the Java broker only were merged to the 0.22 release branch via: http://svn.apache.org/r1477558
        (the QMF2 agent not being on the 0.22 release branch)

        Show
        Robbie Gemmell added a comment - The changes to the Java broker only were merged to the 0.22 release branch via: http://svn.apache.org/r1477558 (the QMF2 agent not being on the 0.22 release branch)
        Hide
        Fraser Adams added a comment -

        committed to r1476219 an amended patch following a suggestion from Robbie Gemmell that avoided iterating through connections by getting the AMQConnectionModel from the AMQSessionModel in the getSessionAdapter() helper e.g.

        /**

        • Helper method to retrieve the SessionAdapter keyed by the AMQSessionModel.
        • This method first finds the ConnectionAdapter associated with the Session from this QueueAdapter's parent vhost
        • then it does a lookup on that to find the SessionAdapter keyed by the requested AMQSessionModel instance.
        • @param session the AMQSessionModel used to index the SessionAdapter.
        • @return the requested SessionAdapter or null if it can't be found.
          */
          private SessionAdapter getSessionAdapter(AMQSessionModel session)
          {
          // Retrieve the ConnectionModel associated with the SessionModel as a key to lookup the ConnectionAdapter.
          AMQConnectionModel connectionKey = session.getConnectionModel();

        // Lookup the ConnectionAdapter, from which we should be able to retrieve the SessionAdapter we really want.
        ConnectionAdapter connectionAdapter = _vhost.getConnectionAdapter(connectionKey);
        if (connectionAdapter == null)

        { return null; // If we can't find an associated ConnectionAdapter the SessionAdapter is a lost cause. }

        else
        { // With a good ConnectionAdapter we can finally try to find the SessionAdapter we are actually looking for.
        SessionAdapter sessionAdapter = connectionAdapter.getSessionAdapter(session);
        if (sessionAdapter == null)

        { return null; // If the SessionAdapter isn't associated with the selected ConnectionAdapter give up. }

        else

        { return sessionAdapter; }

        }
        }

        Show
        Fraser Adams added a comment - committed to r1476219 an amended patch following a suggestion from Robbie Gemmell that avoided iterating through connections by getting the AMQConnectionModel from the AMQSessionModel in the getSessionAdapter() helper e.g. /** Helper method to retrieve the SessionAdapter keyed by the AMQSessionModel. This method first finds the ConnectionAdapter associated with the Session from this QueueAdapter's parent vhost then it does a lookup on that to find the SessionAdapter keyed by the requested AMQSessionModel instance. @param session the AMQSessionModel used to index the SessionAdapter. @return the requested SessionAdapter or null if it can't be found. */ private SessionAdapter getSessionAdapter(AMQSessionModel session) { // Retrieve the ConnectionModel associated with the SessionModel as a key to lookup the ConnectionAdapter. AMQConnectionModel connectionKey = session.getConnectionModel(); // Lookup the ConnectionAdapter, from which we should be able to retrieve the SessionAdapter we really want. ConnectionAdapter connectionAdapter = _vhost.getConnectionAdapter(connectionKey); if (connectionAdapter == null) { return null; // If we can't find an associated ConnectionAdapter the SessionAdapter is a lost cause. } else { // With a good ConnectionAdapter we can finally try to find the SessionAdapter we are actually looking for. SessionAdapter sessionAdapter = connectionAdapter.getSessionAdapter(session); if (sessionAdapter == null) { return null; // If the SessionAdapter isn't associated with the selected ConnectionAdapter give up. } else { return sessionAdapter; } } }
        Hide
        Fraser Adams added a comment -

        patch to allow management model navigation between Connection and Queue and vice versa.

        Show
        Fraser Adams added a comment - patch to allow management model navigation between Connection and Queue and vice versa.

          People

          • Assignee:
            Unassigned
            Reporter:
            Fraser Adams
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development