java.lang.IllegalStateException: Client is currently closed. Must open messagingClient before sending #1743
vrmupparaju
started this conversation in
General
Replies: 1 comment 2 replies
-
You'll likely see this error if the client you opened loses its connection with the service. When that happens, you need to re-open the client to re-establish the connection. Here's some sample code that demonstrates how to do this: |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Azure java sdk : 'com.microsoft.azure.sdk.iot:iot-service-client:2.1.6'
Below errors were throwing when I try to send messages to IOTHub
java.lang.IllegalStateException: Client is currently closed. Must open messagingClient before sending.
below is the snippet
try{
if(!messagingClient.isOpen()) {
messagingClient.open();
messageToSend.setDeliveryAcknowledgement(DeliveryAcknowledgement.None);
messagingClient.sendAsync(deviceId, messageToSend, null, null);
}catch(){
}
finally{
messagingClient.close();
}
I tried with send(deviceId,message) ,same issue persists.
Could somebody help me on this? or can share sample expamples
Beta Was this translation helpful? Give feedback.
All reactions