-
Notifications
You must be signed in to change notification settings - Fork 738
createwithtransport_unsubscribe
Short answer is, no.
If you try unsubscribing from the Message Callback using SetMessageCallback, you may see the following error:
File:E:\GitRepos\azure-iot-sdk-c\iothub_client\src\iothub_client_core_ll.c Func:_IoTHubClientCore_LL_SetMessageCallback_Ex Line:1927 Invalid workflow sequence. Please unsubscribe using the IoTHubClientCore_LL_SetMessageCallback function.
What's going on? Here's the investigation:
IoTHubClientCore_LL_SetMessageCallback -> SYNC IoTHubClientCore_LL_SetMessageCallback_Ex ->ASYNC
messageCallback == NULL (unsub)
IoTHubClientCore_LL_SetMessageCallback_Ex
OR
iotHubClientInstance->created_with_transport_handle != 0
IoTHubClientCore_LL_SetMessageCallback
iotHubClientInstance->created_with_transport_handle == 0
IoTHubClientCore_LL_SetMessageCallback_Ex
create_iothub_instance
starts with: result->created_with_transport_handle = 0;
if deviceConfig.transportHandle != NULL
result->created_with_transport_handle = 1;
create_iothub_instance
if (config != NULL) if (transportHandle != NULL) deviceConfig.transportHandle = IoTHubTransport_GetLLTransport(transportHandle);
transportHandle is 3rd arg of create_iothub_instance
IoTHubClientCore_CreateFromConnectionString -> transportHandle is NULL IoTHubClientCore_Create -> transportHandle is NULL IoTHubClientCore_CreateFromEnvironment -> transportHandle is NULL IoTHubClientCore_CreateWithTransport -> transportHandle is NOT NULL (!!!!!!) IoTHubClientCore_CreateFromDeviceAuth -> transportHandle is NULL
IoTHubClient_CreateWithTransport calls IoTHubClientCore_CreateWithTransport
IoTHubDeviceClient_CreateWithTransport calls IoTHubClientCore_CreateWithTransport
Conclusion: created_with_transport_handle indicates if device multiplexing is used (1) or not (0). if using dev mux, SYNC SetMessageCallback is used. Unsubscribing for Messages (C2D) only calls IoTHubClientCore_LL_SetMessageCallback_Ex.
SO: if using dev mux, you cannot unsubscribe for C2D messages.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.