activemq - How to escape a special character (forward slash) in a mqtt topic? -
i have application using mqtt-client java library connect activemq broker via mqtt. subscribing, publishing , receiving of messages work fine long topic not have forward slash (/).
i understand forward slashs special characters in mqtt , per activemq mqtt support "/"
converted "."
. however, in case, need connect topics have been created using jms , written uri (example http://activemq.apache.org/) , therefore have "/" on names.
is there anyway scape "/"
on mqtt? @ moment, if try connecting topic called http://activemq.apache.org/
in fact connect http:..activemq.apache.org.
my suggestion.. works if you're deploying own activemq service..
download activemq source.. conversions occur in module mqttprotocolconverter. there you'll see special conversions.. code has changed in 5.10.0, needless can escape stuff there , should work. modified code both inbound requests mqtt , outbound.
i have had similar issues when trying use mqtt , in topics have '.''s e.g.
mqtt topic /accounts/foobar/users/foo/storage/mytext.txt
this changed in current implementation
.accounts.foobar.users.foo.storage.mytext.txt
and when message received mqtt plugin, topic converted
/accounts/foobar/users/foo/storage/mytext/txt
this not wanted, had modify converter escape '.' result jms toipc turn
.accounts.foobar.users.foo.storage.mytext\.txt
which worked..
Comments
Post a Comment