{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/283","repository_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java","labels_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/283/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/283/comments","events_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/283/events","html_url":"https://github.com/Azure/azure-iot-sdk-java/issues/283","id":344486873,"node_id":"MDU6SXNzdWUzNDQ0ODY4NzM=","number":283,"title":"ModuleClient.sendEventAsync doesn't send to IoT Hub","user":{"login":"JMayrbaeurl","id":1204327,"node_id":"MDQ6VXNlcjEyMDQzMjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1204327?v=4","gravatar_id":"","url":"https://api.github.com/users/JMayrbaeurl","html_url":"https://github.com/JMayrbaeurl","followers_url":"https://api.github.com/users/JMayrbaeurl/followers","following_url":"https://api.github.com/users/JMayrbaeurl/following{/other_user}","gists_url":"https://api.github.com/users/JMayrbaeurl/gists{/gist_id}","starred_url":"https://api.github.com/users/JMayrbaeurl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JMayrbaeurl/subscriptions","organizations_url":"https://api.github.com/users/JMayrbaeurl/orgs","repos_url":"https://api.github.com/users/JMayrbaeurl/repos","events_url":"https://api.github.com/users/JMayrbaeurl/events{/privacy}","received_events_url":"https://api.github.com/users/JMayrbaeurl/received_events","type":"User","site_admin":false},"labels":[{"id":461741541,"node_id":"MDU6TGFiZWw0NjE3NDE1NDE=","url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":{"login":"timtay-microsoft","id":28789848,"node_id":"MDQ6VXNlcjI4Nzg5ODQ4","avatar_url":"https://avatars0.githubusercontent.com/u/28789848?v=4","gravatar_id":"","url":"https://api.github.com/users/timtay-microsoft","html_url":"https://github.com/timtay-microsoft","followers_url":"https://api.github.com/users/timtay-microsoft/followers","following_url":"https://api.github.com/users/timtay-microsoft/following{/other_user}","gists_url":"https://api.github.com/users/timtay-microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/timtay-microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timtay-microsoft/subscriptions","organizations_url":"https://api.github.com/users/timtay-microsoft/orgs","repos_url":"https://api.github.com/users/timtay-microsoft/repos","events_url":"https://api.github.com/users/timtay-microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/timtay-microsoft/received_events","type":"User","site_admin":false},"assignees":[{"login":"timtay-microsoft","id":28789848,"node_id":"MDQ6VXNlcjI4Nzg5ODQ4","avatar_url":"https://avatars0.githubusercontent.com/u/28789848?v=4","gravatar_id":"","url":"https://api.github.com/users/timtay-microsoft","html_url":"https://github.com/timtay-microsoft","followers_url":"https://api.github.com/users/timtay-microsoft/followers","following_url":"https://api.github.com/users/timtay-microsoft/following{/other_user}","gists_url":"https://api.github.com/users/timtay-microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/timtay-microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timtay-microsoft/subscriptions","organizations_url":"https://api.github.com/users/timtay-microsoft/orgs","repos_url":"https://api.github.com/users/timtay-microsoft/repos","events_url":"https://api.github.com/users/timtay-microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/timtay-microsoft/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-07-25T15:11:31Z","updated_at":"2018-07-31T07:17:00Z","closed_at":null,"author_association":"MEMBER","body":"- **OS and version used:** Windows 10 with Docker CE and Linux containers\r\n\r\n- **Java runtime used:** OpenJDK 8\r\n\r\n- **SDK version used:** 1.13.1\r\n\r\n# Description of the issue:\r\nSending a message with ModuleClient.sendEventAsync to a defined module output, enqueues the message on EdgeHub correctly and forwards it to IoT Hub. Unfortunately the messages never arrive at IoT Hub. All logs look good. Edge Hub shows sending to IoT Hub in log without errors and IotHubEventCallback gets called with status code OK_EMPTY. Checking IoT Hub with Device Explorer doesn't show any messages.\r\n\r\n# Code sample exhibiting the issue:\r\n```\r\npackage samples.com.microsoft.azure.jm.iot;\r\n\r\nimport java.io.IOException;\r\n\r\nimport org.apache.log4j.Logger;\r\n\r\nimport com.microsoft.azure.sdk.iot.device.IotHubClientProtocol;\r\nimport com.microsoft.azure.sdk.iot.device.IotHubEventCallback;\r\nimport com.microsoft.azure.sdk.iot.device.IotHubStatusCode;\r\nimport com.microsoft.azure.sdk.iot.device.Message;\r\nimport com.microsoft.azure.sdk.iot.device.ModuleClient;\r\nimport com.microsoft.azure.sdk.iot.device.exceptions.ModuleClientException;\r\n\r\npublic class SimpleJavaIoTEdgeApp {\r\n\r\n\tprivate static final Logger logger = Logger.getLogger(SimpleJavaIoTEdgeApp.class);\r\n\t\r\n\tpublic SimpleJavaIoTEdgeApp() {}\r\n\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\tModuleClient client = null;\r\n\t\t\r\n\t\tlogger.info(\"Simple Java module app started\");\r\n\t\t\r\n\t\ttry {\r\n\t\t\tclient = ModuleClient.createFromEnvironment(IotHubClientProtocol.MQTT);\r\n\t\t\tclient.open();\r\n\t\t} catch (ModuleClientException e) {\r\n\t\t\tlogger.error(\"Exception creating ModuleClient from env: \", e);\r\n\t\t\treturn;\r\n\t\t} catch (IOException e) {\r\n\t\t\tlogger.error(\"Exception open ModuleClient: \", e);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\twhile(true) {\r\n\t\t\t\r\n\t\t\tlogger.info(\"Now sending message to Edge hub\");\r\n\t\t\t\r\n\t\t\tMessage msg = new Message(\"Sent from Java module\");\r\n\t\t\tEventCallback callback = new EventCallback();\r\n\t\t\tclient.sendEventAsync(msg, callback, msg, \"output1\");\r\n\t\t\t\r\n\t\t\ttry {\r\n\t\t\t\tThread.sleep(1000);\r\n\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\ttry {\r\n\t\t\tclient.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\tlogger.error(\"Exception on closing ModuleClient\", e);\r\n\t\t}\r\n\t}\r\n\r\n    private static class EventCallback implements IotHubEventCallback\r\n    {\r\n        public void execute(IotHubStatusCode status, Object context)\r\n        {\r\n            Message msg = (Message) context;\r\n\r\n            logger.info(\"IoT Hub responded to message \"+ msg.getMessageId()  + \" with status \" + status.name());\r\n\r\n            if (status==IotHubStatusCode.MESSAGE_CANCELLED_ONCLOSE)\r\n            {\r\n                logger.error(\"IoT Hub responded with cancelled on close\");\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n```\r\n\r\n# Console log of the issue:\r\n```\r\n2018-07-25 08:12:27 INFO  IotHubTransport:23 - The connection to the IoT Hub has been established, method name is onConnectionEstablished \r\n2018-07-25 08:12:27 INFO  SimpleJavaIoTEdgeApp:39 - Now sending message to Edge hub\r\n2018-07-25 08:12:27 INFO  DeviceIO:23 - Message with messageid 3cf27ad6-bd8f-415c-bc2d-6f92eed66088 along with callback and callbackcontext is added to the queue, method name is sendEventAsync \r\n2018-07-25 08:12:27 INFO  IotHubTransport:23 - Get the message from waiting message queue to be sent to IoT Hub, method name is sendMessages \r\n2018-07-25 08:12:27 INFO  IotHubTransport:23 - Invoking the callback function for sent message, IoT Hub responded to message with status OK_EMPTY, method name is invokeCallbacks \r\n2018-07-25 08:12:27 INFO  SimpleJavaIoTEdgeApp:65 - IoT Hub responded to message 3cf27ad6-bd8f-415c-bc2d-6f92eed66088 with status OK_EMPTY\r\n2018-07-25 08:12:28 INFO  SimpleJavaIoTEdgeApp:39 - Now sending message to Edge hub\r\n2018-07-25 08:12:28 INFO  DeviceIO:23 - Message with messageid 6f8c80e7-2a6c-420e-aea4-c5e804b79916 along with callback and callbackcontext is added to the queue, method name is sendEventAsync \r\n2018-07-25 08:12:28 INFO  IotHubTransport:23 - Get the message from waiting message queue to be sent to IoT Hub, method name is sendMessages \r\n2018-07-25 08:12:28 INFO  IotHubTransport:23 - Invoking the callback function for sent message, IoT Hub responded to message with status OK_EMPTY, method name is invokeCallbacks \r\n2018-07-25 08:12:28 INFO  SimpleJavaIoTEdgeApp:65 - IoT Hub responded to message 6f8c80e7-2a6c-420e-aea4-c5e804b79916 with status OK_EMPTY\r\n\r\n```\r\nAnd the Edge Hub log:\r\n\r\n```\r\n2018-07-25 08:12:28.280 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Mqtt.MessagingServiceClient] - Sending message for device Id jurgenmaEdgeP50/SampleModule\r\n2018-07-25 08:12:28.280 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Core.Routing.RoutingEdgeHub] - Received message from jurgenmaEdgeP50/SampleModule\r\n2018-07-25 08:12:29.280 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Mqtt.MessagingServiceClient] - Sending message for device Id jurgenmaEdgeP50/SampleModule\r\n2018-07-25 08:12:29.281 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Core.Routing.RoutingEdgeHub] - Received message from jurgenmaEdgeP50/SampleModule\r\n2018-07-25 08:12:30.283 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Mqtt.MessagingServiceClient] - Sending message for device Id jurgenmaEdgeP50/SampleModule\r\n2018-07-25 08:12:30.283 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Core.Routing.RoutingEdgeHub] - Received message from jurgenmaEdgeP50/SampleModule\r\n2018-07-25 08:12:31.292 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Mqtt.MessagingServiceClient] - Sending message for device Id jurgenmaEdgeP50/SampleModule\r\n2018-07-25 08:12:31.292 +00:00 [DBG] [Microsoft.Azure.Devices.Edge.Hub.Core.Routing.RoutingEdgeHub] - Received message from jurgenmaEdgeP50/SampleModule\r\n\r\n```\r\n\r\n# Need Support?\r\n* Have a feature request for SDKs? Please post it on [User Voice](https://feedback.azure.com/forums/321918-azure-iot) to help us prioritize.\r\n* Have a technical question? Ask on [Stack Overflow](https://stackoverflow.com/questions/tagged/azure-iot-hub) with tag “azure-iot-hub”\r\n* Need Support? Every customer with an active Azure subscription has access to support with guaranteed response time.  Consider submitting a ticket and get assistance from Microsoft support team\r\n* Found a bug? Please help us fix it by thoroughly documenting it and filing an issue on GitHub (C, Java, .NET, Node.js, Python).\r\n"},"comment":{"url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/comments/409120541","html_url":"https://github.com/Azure/azure-iot-sdk-java/issues/283#issuecomment-409120541","issue_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/283","id":409120541,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTEyMDU0MQ==","user":{"login":"JMayrbaeurl","id":1204327,"node_id":"MDQ6VXNlcjEyMDQzMjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1204327?v=4","gravatar_id":"","url":"https://api.github.com/users/JMayrbaeurl","html_url":"https://github.com/JMayrbaeurl","followers_url":"https://api.github.com/users/JMayrbaeurl/followers","following_url":"https://api.github.com/users/JMayrbaeurl/following{/other_user}","gists_url":"https://api.github.com/users/JMayrbaeurl/gists{/gist_id}","starred_url":"https://api.github.com/users/JMayrbaeurl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JMayrbaeurl/subscriptions","organizations_url":"https://api.github.com/users/JMayrbaeurl/orgs","repos_url":"https://api.github.com/users/JMayrbaeurl/repos","events_url":"https://api.github.com/users/JMayrbaeurl/events{/privacy}","received_events_url":"https://api.github.com/users/JMayrbaeurl/received_events","type":"User","site_admin":false},"created_at":"2018-07-31T07:17:00Z","updated_at":"2018-07-31T07:17:00Z","author_association":"MEMBER","body":"@timtay-microsoft Any update or additional insights available? Can I help you?"}}
{"actor":{"display_login":"JMayrbaeurl"}}