mirror of https://github.com/apache/activemq.git
More improvements for AMQ-5043. Drop all messages sent to topics starting '$' to honor MQTT 3.1.1 spec requirments.
This commit is contained in:
parent
6e68a37115
commit
706830268e
|
@ -94,6 +94,23 @@ public class MQTTProtocolConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendToActiveMQ(Command command, ResponseHandler handler) {
|
void sendToActiveMQ(Command command, ResponseHandler handler) {
|
||||||
|
|
||||||
|
// Lets intercept message send requests..
|
||||||
|
if( command instanceof ActiveMQMessage) {
|
||||||
|
ActiveMQMessage msg = (ActiveMQMessage) command;
|
||||||
|
if( msg.getDestination().getPhysicalName().startsWith("$") ) {
|
||||||
|
// We don't allow users to send to $ prefixed topics to avoid failing MQTT 3.1.1 spec requirements
|
||||||
|
if( handler!=null ) {
|
||||||
|
try {
|
||||||
|
handler.onResponse(this, new Response());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
command.setCommandId(generateCommandId());
|
command.setCommandId(generateCommandId());
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
command.setResponseRequired(true);
|
command.setResponseRequired(true);
|
||||||
|
|
Loading…
Reference in New Issue