You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by redboy1972 <re...@live.com> on 2015/09/14 23:54:44 UTC
Is it possible to use temporary destinations with MQTT?
I know about clean sessions which resets a connection upon re-connect but in
the mean time leaves state on the server. This is visible from the admin
console as the subscribed MQTT topic still is present after disconnect.
See: http://localhost:8161/admin/topics.jsp
What I would like is to have the concept of temporary topic behavior whereby
why a client disconnects everything about that session disappears.
Using org.fusesource.mqtt.client.MQTT there doesn't appear to be anything
similar to the behavior "Destination tempDest =
session.createTemporaryTopic();" which is what I'm after.
What I have tried.
Overriding BrokerFilter.addConsumer(...)
@Override
public Subscription addConsumer(ConnectionContext context,
ConsumerInfo info) throws Exception {
ActiveMQDestination dest = info.getDestination();
ActiveMQDestination temp = dest;
if( dest.isTopic() && !dest.isTemporary() ) {
log.debug("Converting connection's destination to a
temporary topic.");
temp = new ActiveMQTempTopic(
info.getDestination().getPhysicalName() );
info.setDestination( temp );
}
return super.addConsumer( context, info );
}
In the sender:
ActiveMQTempTopic dest = new ActiveMQTempTopic( topicName );
jmsTemplate.convertAndSend(dest, outgoingMsg);
This is the error:
Exception: Cannot publish to a deleted Destination: temp-topic://test;
nested exception is javax.jms.InvalidDestinationException: Cannot publish to
a deleted Destination: temp-topic://test
Next attempt:
Override BrokerFilter.removeConnection(....) and attempt to somehow remove
the connection.
It seems as if I'm drifting all over. Does anyone have any ideas how to
accomplish MQTT+TempTopics?
--
View this message in context: http://activemq.2283324.n4.nabble.com/Is-it-possible-to-use-temporary-destinations-with-MQTT-tp4701996.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.