[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-dev
Subject:    [jira] [Commented] (AMQ-5298) MQTT Transport can generate class cast exception when subscription is 
From:       "Timothy Bish (JIRA)" <jira () apache ! org>
Date:       2014-07-30 22:39:39
Message-ID: JIRA.12730935.1406759712510.81065.1406759979848 () arcas
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/AMQ-5298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14080102#comment-14080102 \
] 

Timothy Bish commented on AMQ-5298:
-----------------------------------

This patch fixes the crash but there are issues with the retained messages because \
it's a VurtualTopic.

{code}
diff --git a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java \
b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
 index cc51ce7..af5f003 100644
--- a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
                
+++ b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
 @@ -40,6 +40,7 @@
 import org.apache.activemq.broker.region.Subscription;
 import org.apache.activemq.broker.region.TopicRegion;
 import org.apache.activemq.broker.region.policy.RetainedMessageSubscriptionRecoveryPolicy;
 +import org.apache.activemq.broker.region.virtual.VirtualTopicInterceptor;
 import org.apache.activemq.command.ActiveMQBytesMessage;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQMapMessage;
@@ -503,7 +504,11 @@
             for (Subscription subscription : dest.getConsumers()) {
                 if (subscription.getConsumerInfo().getConsumerId().equals(consumerId)) \
{  try {
-                        \
((org.apache.activemq.broker.region.Topic)dest).recoverRetroactiveMessages(connectionContext, \
subscription); +                        if (dest instanceof \
org.apache.activemq.broker.region.Topic) { +                            \
((org.apache.activemq.broker.region.Topic)dest).recoverRetroactiveMessages(connectionContext, \
subscription); +                        } else if (dest instanceof \
VirtualTopicInterceptor) { +                            \
((VirtualTopicInterceptor)dest).getTopic().recoverRetroactiveMessages(connectionContext, \
subscription); +                        }
                         if (subscription instanceof PrefetchSubscription) {
                             // request dispatch for prefetch subs
                             PrefetchSubscription prefetchSubscription = \
(PrefetchSubscription) subscription; {code}

> MQTT Transport can generate class cast exception when subscription is to a Virtual \
>                 Topic
> ----------------------------------------------------------------------------------------
>  
> Key: AMQ-5298
> URL: https://issues.apache.org/jira/browse/AMQ-5298
> Project: ActiveMQ
> Issue Type: Bug
> Components: MQTT
> Affects Versions: 5.10.0
> Reporter: Timothy Bish
> Fix For: 5.11.0
> 
> 
> When a client subscribes to a Virtual Topic and sends a duplicate subscription \
> request the method that resends the old retained messages tries to cast the \
> destination from the TopicRegion is finds to a Topic but in this case it would be a \
> VirtualTopicIntercepter and an exception is thrown disconnecting the client.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic