Bug 674005 - QueueReceiver does not work with new addressing
Summary: QueueReceiver does not work with new addressing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-java
Version: 1.3
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: 2.0
: ---
Assignee: Rajith Attapattu
QA Contact: Petr Matousek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-31 10:09 UTC by Gordon Sim
Modified: 2011-06-23 15:46 UTC (History)
2 users (show)

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.
Clone Of:
Environment:
Last Closed: 2011-06-23 15:46:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Receiver program demonstrating problem (1.57 KB, text/x-java)
2011-01-31 10:09 UTC, Gordon Sim
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0890 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 2.0 Release 2011-06-23 15:42:41 UTC

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


Note You need to log in before you can comment on or make changes to this bug.