How remove client by semp in solace.I try it like follows:
<rpc xmlns="http://www.solacesystems.com/semp/topic_routing/d35m1">
<no><client-username><username>user1</username>
<vpn-name>jiavpn</vpn-name> </client-username></no></rpc>
but it alert me "Command is not allowed via SEMP over the message bus",
did it have some relation with the SEMP TOPIC,my topic is #SEMP/soalce1/SHOW.
thanks for answer
Answer is invalid.
There is an error with the documentation which will be fixed in the next major release.
The disconnect SEMP over message bus command is an Client Admin EXEC command, and needs to be sent to #SEMP/<router name>/ADMIN/CLIENT instead of #SEMP/<router name>/SHOW.
From the user guide,
• Client Admin EXEC commands—These commands enable applications to clear and reset the given client’s event notification for a specified one-shot event or to disconnect the client. The following client admin EXEC commands can be executed over the message bus:
- admin client <name> message-vpn <vpn-name> [primary][backup] [static] clear-event <event-name>
- admin client <name> message-vpn <vpn-name> [primary][backup] disconnect
...
• #SEMP/<router name>/ADMIN/CLIENT—The command topic destination for Client Admin EXEC commands, which enable applications to clear and reset the given client’s event notification for a specified one-shot event or to disconnect the client.
Note that you will need to enable Admin and Client SEMP over Message Bus Commands for the message VPN. Refer to the screenshot below for an example of how to do this.
Also note that the client application might be configured to automatically reconnect after a disconnect.
Both of the following are SEMP commands that cannot be executed over the message bus.
Deleting a client-username:
<rpc xmlns="http://www.solacesystems.com/semp/topic_routing/d35m1">
<no>
<client-username>
<username>user1</username>
<vpn-name>jiavpn</vpn-name>
</client-username>
</no>
</rpc>
Disconnecting a client:
<rpc semp-version="soltr/7_1_1">
<admin>
<client>
<name>jiajie</name>
<vpn-name>jiajievpn</vpn-name>
<disconnect/>
</client>
</admin>
</rpc>
Only a limited subset of commands are available for SEMP over message bus.
The complete list can be found in Available SEMP Over Message Bus Commands.
Note that there is currently an error in the documentation that will be fixed in the next major release - Disconnecting clients are not allowed via message bus despite the documentation saying so.
Related
Protocol: mqtt
Version: 3.1.1
Gateway model: CloudGate Ethernet CG0102
I'm publishing json message from my gateway which is connected to an open source Emqx broker (broker.emqx.io) port 1883 for a test. I tried to consume the messages by connecting to it with MQTTX by giving the following informations: Name, Client_ID, Host, Port, Username and Password, and then giving my topic which is my_topic.
The problem is nothing appear in my MQTTX while the given broker informations are good and similar to those in my gateway. Why ?
Also I would like in the future to use my own mqtt broker mounted on my laptop ? Any simple references where I could start to make such thing ? I already use mqtt to consume messages with python from remote broker but never try to build one to receive messages from my remote gateway.
I'm working on a ubuntu bionic VM
Client_ID needs to be unique for every client, so you can not reuse Client_ID between clients.
The MQTT spec says that the broker should kick the oldest client off when a new client connects with the same Client_ID. This normally leads to a fight between the 2 clients as they both try and reconnect kicking each other off.
I'm using a u-Blox SARA-R422M8S cellular module trying to connect to Azure Iot Hub with the MQTT AT commands. The module supports MQTT 3.1.1. The login request fails with Broker connection refused, not authorized. Using the same credentials in the python example at Microsoft Azure documentation, the login succeeds and I can publish. I've uploaded the Baltimore root cert and activated the TLS for the socket, so this seems ok as well as I get another error code elsewise.
Anyone experienced similar?
PS, here are the AT commands used:
AT+USECPRF=0
AT+USECPRF=0,0,1
AT+USECPRF=0,3,"root_ca"
AT+UPSD=0,0,0
AT+UPSD=0,100,1
AT+UMQTT=11,1,0
AT+UMQTT=2,".azure-devices.net",8883
AT+UMQTT=4,"myhub.azure-devices.net/mydev/?api-version=2018-06-30","mysas""
As per the docs:
For the ClientId field, use the deviceId.
So you need to set the Client ID with something like:
AT+UMQTT=0,"mydev"
I have been using following command to see published messages on the Mosquitto broker:
mosquitto_sub -h IP_ADDRESS -t TOPIC_NAME
However, when I run this command I can see only the recent messages not all published messages. In Mqtt client, I can see messages delivered.
Is there a command to see all messages that were delivered to the broker?
The command only shows messages when we start subscribing?
I have used value 2 for Quality of Service in message properties.
MQTT as a protocol doesn't store all messages, no matter what QOS they were published/subscribed at.
It's also important to remember that QOS is only for one leg at a time. E.g. a message published at QOS2 is ensured to arrive at the broker, but makes no promises about it's delivery to any clients, that is down to what QOS those clients subscribed to the topic at.
MQTT will queue messages for a known client if it has previously subscribed at QOS 1 or 2 and reconnects with the cleanSession flag set to false. This connection needs to exactly the same client id as the previous session.
So if you run the following command:
mosquitto_sub -h [ip addr] -t [topic] -c -i [clientid] -q 2
This will create a persistent session, if you then disconnect (kill mosquitto_sub) when you run the same command again (making sure to keep [clientid] the same the broker will deliver all the messages sent while the client was disconnected. But there is no way to get messages published before the session was established by running the command the first time.
-c tells the client to set the cleanSession flag to false.
-i [clientid] sets the client id
-q 2 sets the subscription QOS to 2
If this is to debug a problem then one possible option would be to ramp up the mosquitto instances logging level then it will log absolutely everything, but this will produce a LOT of output.
I have feeling that my client not sets "retain" message flag. Is ti possible somehow get list of retained messages in Mosquitto MQTT broker? How?
When the message is received by a client it will have the retained bit set in the header, so you should be able to check from any client, how you do that will depend on the client library you are using.
Depending on what rate the client is publishing messages (e.g. there is a long enough gap between messages) you could just use the mosquitto_sub command to check. If you know when the last time the client published just wait until afterwards and then subscribe with the command line tool, if it prints a message immediately then there was a retained message.
The other option is to examine the mosquitto persistence database, included in the source code in the src/db_dump directory there is a tool to walk the content of the database. Retained messages should get written to the database so should allow you check. I don't think the tool is build and included in any of the binary install packages so you will have to build it yourself.
With mosquitto version 2.0.14 MQTT v5.0/v3.1.1/v3.1 broker, you can get a list of retained messages via:
$ mosquitto_sub -u user -P pass -t "#" -v --retained-only
I'm having trouble in starting MQTT Client in Eclipse Hono.
I'm using The following command to start the client
java -jar hono-example-0.6-exec.jar --hono.client.host=hono.eclipse.org --hono.client.port=15672 --hono.client.username=consumer#HONO --hono.client.password=verysecret --spring.profiles.active=receiver --tenant.id=bob
which starts the client accepting telemetry data produced by the device, but didn't catch the data published through MQTT.
What may be wrong with this approach?
The command you are using does not start an MQTT client but starts the receiver for consuming (AMQP 1.0) messages from devices belonging to tenant bob. In order to see something happening, you need to have a device that belongs to tenant bob publish some data. If you want to use MQTT for that purpose you may want to use the mosquitto_pub command line client as described in the Getting Started guide. However, make sure that you use the correct username and password. From what I can see in the device registry on hono.eclipse.org you have registered a device with id 1112 and auth-id sensor1. So the command to publish should look something like:
mosquitto_pub -h hono.eclipse.org -u sensor1#bob -Pthepasswordyouregistered -t telemetry -m "hello"
Again, make sure to replace thepasswordyouregistered with the real password that you have registered for device 1112.