title: Azure Function with Event Hub out binding does not work
body: <p>I am using Azure Function to send out message to multiple Event Hub outputs (from an input EH). My code is the following:</p>
  
  <pre><code>[FunctionName("Gateway")]
      public static void Run([EventHubTrigger("%INPUT_HUB_NAME%", Connection = "iothubconnection", ConsumerGroup = "functiontest")]EventData[] eventHubMessage,
          [EventHub("%OUT_HUB_NAME%", Connection = "eventhuboutput")]out EventData outputEventHubMessageHotPath,
          [EventHub("%OUT_HUB_NAME%", Connection = "eventhuboutput2")]out EventData outputEventHubMessageColdPath,
          TraceWriter log)
      {
          log.Info("**-- Start Azure Func -- **");
  
  
          foreach (var ehMsg in eventHubMessage)
          {
              //section to build up the raw section
              var rawMessageSection = GetPayload(ehMsg.GetBytes());
              var deviceId = GetDeviceId(ehMsg);
              log.Info($"Extracted deviceId: {deviceId}");
              if (rawMessageSection.aggregates != null)
              {
                  var message = CreateEHMessages("aggregates", rawMessageSection, deviceId, log);
  
                  outputEventHubMessageHotPath = message;
                  outputEventHubMessageColdPath = message;
              }
              if (rawMessageSection.events != null)
              {
                  outputEventHubMessageColdPath = CreateEHMessages("events", rawMessageSection, deviceId,  log);
              }
              if (rawMessageSection.ipis != null)
              {
                  outputEventHubMessageColdPath = CreateEHMessages("ipis", rawMessageSection, deviceId, log);
              }
              if (rawMessageSection.errors != null)
              {
                  outputEventHubMessageColdPath = CreateEHMessages("errors", rawMessageSection, deviceId,  log);
              }
              if (rawMessageSection.batteries != null)
              {
                  outputEventHubMessageColdPath = CreateEHMessages("batteries", rawMessageSection, deviceId,  log);
              }
              //await Task.WhenAll(tasks);
          }
          outputEventHubMessageHotPath = outputEventHubMessageColdPath = null;
      }
  </code></pre>
  
  <p>where:</p>
  
  <pre><code> public static EventData CreateEHMessages(string messageType, dynamic messageBatch, string deviceId, TraceWriter log)
      {
         var timezone = messageBatch.timezone;
          var deviceInstanceId = messageBatch.deviceInstanceId;
          int i = 0;
          List&lt;dynamic&gt; result = new List&lt;dynamic&gt;();
          foreach (var msg in messageBatch[messageType])
          {
  
              msg.deviceId = deviceId;
              msg.timezone = timezone;
              msg.deviceInstanceId = deviceInstanceId;
              msg.type = messageType;
  
              result.Add(msg);
              i++;
          }
          var eventData = new EventData(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(result)));
          eventData.PartitionKey = deviceInstanceId;
          return eventData;
  
  
      }
  </code></pre>
  
  <p>The problem is that this Function does NOT seem to publish to EventHub. I have tried to use different syntax of binding but i cannot get it to work.
  I suspect is something to do with output bindings but I again tried many options.
  Any idea?</p>