Bug 674005

Summary: QueueReceiver does not work with new addressing
Product: Red Hat Enterprise MRG Reporter: Gordon Sim <gsim>
Component: qpid-javaAssignee: Rajith Attapattu <rattapat+nobody>
Status: CLOSED ERRATA QA Contact: Petr Matousek <pematous>
Severity: medium Docs Contact:
Priority: high    
Version: 1.3CC: freznice, pematous
Target Milestone: 2.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: When creating a QueueReceiver with a destination created using an addressing string a java.lang.ClassCastException is thrown. Consequence: The application is unable to create QueueReceivers from destinations created using an addressing string. The workaround was to create a Queue using session.createQueue method passing an address string. Fix: The createReceiver method has been modified to check if the destination passed in is an instance of javax.jms.Queue and org.apache.qpid.client.AMQDestination instead of just casting the destination into org.apache.qpid.client.AMQTopic The code is now modified to work with the javax.jms.Queue interface instead of the concrete implementation. Result: The createReceiver method is now able to create a QueueReceiver from a destination created using an address string.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-23 15:46:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Receiver program demonstrating problem none

Description Gordon Sim 2011-01-31 10:09:03 UTC
Created attachment 476159 [details]
Receiver program demonstrating problem

Description of problem:

The QueueReceiver interface is part of JMS. However this part of the API cannot be used with Destinations defined using the new addressing scheme.

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

qpid-java-client-0.7.946106-12.el5

How reproducible:

100%

Steps to Reproduce:
1. create queue called direct
2. run attached receiver
  
Actual results:

Exception occurred: java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
	at org.apache.qpid.client.AMQSession.createReceiver(AMQSession.java:1217)
	at org.apache.qpid.client.AMQQueueSessionAdaptor.createReceiver(AMQQueueSessionAdaptor.java:75)


Expected results:

No exception, receiver able to receive messages sent to that queue

Comment 1 Rajith Attapattu 2011-03-03 04:52:53 UTC
Fixed in upstream at rev 1076516.
http://svn.apache.org/viewvc?rev=1076516&view=rev.

Comment 2 Rajith Attapattu 2011-03-15 02:33:33 UTC
The fixes are now included in rpms from version qpid-java-0.9.1080013-2

Comment 3 Rajith Attapattu 2011-03-15 02:33:33 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:
Cause: When creating a QueueReceiver with a destination created using an addressing string a java.lang.ClassCastException is thrown.

Consequence:  The application is unable to create QueueReceivers from destinations created using an addressing string. The workaround was to create a
Queue using session.createQueue method passing an address string.

Fix: The createReceiver method has been modified 
to check if the destination passed in is an instance of javax.jms.Queue and
org.apache.qpid.client.AMQDestination instead of just casting the destination into org.apache.qpid.client.AMQTopic
The code is now modified to work with the javax.jms.Queue interface instead of the concrete implementation.

Result: The createReceiver method is now able to create a QueueReceiver from a destination created using an address string.

Comment 4 Petr Matousek 2011-04-14 16:06:58 UTC
This issue has been fixed

Verified on RHEL4.9, RHEL5.6 and RHEL6.1, architectures: i386, x86_64

packages installed:
qpid-java-example-0.10-2.el5
qpid-java-common-0.10-2.el5
qpid-java-client-0.10-2.el5

-> VERIFIED

Comment 5 errata-xmlrpc 2011-06-23 15:46:48 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/RHEA-2011-0890.html