Qpid
  1. Qpid
  2. QPID-3109

Java client needs to implement the Delete option in address string

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.8
    • Fix Version/s: 0.10
    • Component/s: Java Client
    • Labels:
      None

      Description

      The address syntax defines a delete option with 4 possible values -

      {always, receiver, sender, never}

      .
      The default value is 'never'.

      if delete = 'always' or delete = 'sender', then when a sender is closed it should delete the queue.
      if delete = 'always' or delete = 'receiver', then when a receiver is closed it should delete the queue.

      Please note that the client will delete the queue irrespective of whether there are consumers on the queue or not.
      Also it will not take into account whether the queue is empty or not.

        Activity

        Hide
        Andrew Kennedy added a comment - - edited

        Rajith,

        In BasicMessageProducer_0_10#close() you make the assumption that _destination will hold a valid (non-null) destination. This is not always the case, as can be seen from the following code sample (taken from InvalidDestinationTest, which is currently failing in the java.0.10 profile):

        sender = queueSession.createSender(null);
        // ... try to send to invalid destination first
        sender.send(validDestination, msg);
        sender.close();

        Obviously, the close call will now fail with a NullPointerException. I have not seen any other tests failing because of this, but this is most likely due to lack of coverage, since other methods in this commit assume a non-null _destination field also.

        I believe the code sample above to be a valid JMS idiom.

        Andrew.

        Show
        Andrew Kennedy added a comment - - edited Rajith, In BasicMessageProducer_0_10#close() you make the assumption that _destination will hold a valid (non-null) destination. This is not always the case, as can be seen from the following code sample (taken from InvalidDestinationTest, which is currently failing in the java.0.10 profile): sender = queueSession.createSender(null); // ... try to send to invalid destination first sender.send(validDestination, msg); sender.close(); Obviously, the close call will now fail with a NullPointerException. I have not seen any other tests failing because of this, but this is most likely due to lack of coverage, since other methods in this commit assume a non-null _destination field also. I believe the code sample above to be a valid JMS idiom. Andrew.
        Hide
        Andrew Kennedy added a comment -

        Tests in SimpleACLTest and subclasses are also failing, again in the java.0.10 profile, due to the use of the following JMS idiom, which resultrs in _destination not being set in a producer:

        MessageProducer sender = ((AMQSession<?, ?>) sess).createProducer(null);

        Show
        Andrew Kennedy added a comment - Tests in SimpleACLTest and subclasses are also failing, again in the java.0.10 profile, due to the use of the following JMS idiom, which resultrs in _destination not being set in a producer: MessageProducer sender = ((AMQSession<?, ?>) sess).createProducer(null);
        Hide
        Rajith Attapattu added a comment -

        I am currently fixing a bug related to this area and will add the null check as well.

        However I don't know how useful it is to create a producer (or a consumer) with a null destination other than in a test case.
        IMO the code should probably throw an exception if a null destination is passed when creating a producer or a consumer.
        But I will add the null check as it's much better to write defensive code.

        Show
        Rajith Attapattu added a comment - I am currently fixing a bug related to this area and will add the null check as well. However I don't know how useful it is to create a producer (or a consumer) with a null destination other than in a test case. IMO the code should probably throw an exception if a null destination is passed when creating a producer or a consumer. But I will add the null check as it's much better to write defensive code.
        Hide
        Robbie Gemmell added a comment -

        From the MessageProducer Javadoc:

        "A client also has the option of creating a message producer without supplying a destination. In this case, a destination must be provided with every send operation. A typical use for this kind of message producer is to send replies to requests using the request's JMSReplyTo destination. "

        Show
        Robbie Gemmell added a comment - From the MessageProducer Javadoc: "A client also has the option of creating a message producer without supplying a destination. In this case, a destination must be provided with every send operation. A typical use for this kind of message producer is to send replies to requests using the request's JMSReplyTo destination. "
        Hide
        Rajith Attapattu added a comment -

        Interesting... I totally missed that part.
        Robbie thanks for pointing that out to me.

        Show
        Rajith Attapattu added a comment - Interesting... I totally missed that part. Robbie thanks for pointing that out to me.
        Hide
        Robbie Gemmell added a comment -

        http://svn.apache.org/viewvc?view=rev&rev=1078961 and http://svn.apache.org/viewvc?view=rev&rev=1079059 (required to allow compilation) look good for merging to the 0.10 branch.

        Show
        Robbie Gemmell added a comment - http://svn.apache.org/viewvc?view=rev&rev=1078961 and http://svn.apache.org/viewvc?view=rev&rev=1079059 (required to allow compilation) look good for merging to the 0.10 branch.
        Hide
        Rajith Attapattu added a comment -

        The feature is implemented along with test cases.

        Show
        Rajith Attapattu added a comment - The feature is implemented along with test cases.

          People

          • Assignee:
            Rajith Attapattu
            Reporter:
            Rajith Attapattu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development