5

I am using the Microsoft.Azure.WebJobs and Microsoft.Azure.WebJobs.ServiceBus packages for capturing ServiceBus topic events.

Functions Code is as below -

public class Functions
{
    [Singleton]
    public static void Event4Processor(
      [ServiceBusTrigger("MyTopic", "MySubscription", AccessRights.Listen)] BrokeredMessage message,
      TextWriter log)
    {
        log.WriteLine(message);
    }
}

However, I am getting this error

{
  "Type": "FunctionCompleted",
  "EndTime": "2015-09-28T13:53:36.6540039+00:00",
  "Failure": {
    "ExceptionType": "System.ArgumentNullException",
    "ExceptionDetails": "System.ArgumentNullException: Value cannot be null.\r\nParameter name: bindingData\r\n   at Microsoft.Azure.WebJobs.Host.Bindings.BindingDataPathHelper.ConvertParameters(IReadOnlyDictionary`2 bindingData)\r\n   at Microsoft.Azure.WebJobs.Host.SingletonManager.GetBoundScope(String scope, IReadOnlyDictionary`2 bindingData)\r\n   at Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.<BindCoreAsync>d__7.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.<BindAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLogMessageAsync>d__c.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<TryExecuteAsync>d__1.MoveNext()"
  },
  "ParameterLogs": {},
  "FunctionInstanceId": "a1dcf0a9-113f-4c7e-b136-fb8d8b7ee4aa",
  "Function": {
    "Id": "WebJobServiceBus.Functions.Event4Processor",
    "FullName": "WebJobServiceBus.Functions.Event4Processor",
    "ShortName": "Functions.Event4Processor",
    "Parameters": [
      {
        "NamespaceName": "my-ns",
        "TopicName": "myevents",
        "SubscriptionName": "mysubscription",
        "Name": "message",
        "DisplayHints": {
          "Description": "dequeue from 'mytopic/Subscriptions/mysubscription'",
          "Prompt": "Enter the queue message body"
        }
      },
      {
        "Type": "ParameterDescriptor",
        "Name": "log"
      }
    ]
  },
  "Reason": "AutomaticTrigger",
  "ReasonDetails": "New ServiceBus message detected on 'MyTopic/Subscriptions/MySubscription'.",
  "StartTime": "2015-09-28T13:53:35.6639049+00:00",
  "HostInstanceId": "ad1f5b26-ddec-4326-9cfb-df585065e773",
  "HostDisplayName": "WebJobServiceBus",
  "SharedQueueName": "azure-webjobs-host-ef6959df3bc9431680c944c6ca5b1eff",
  "InstanceQueueName": "azure-webjobs-host-ad1f5b26ddec43269cfbdf585065e773",
  "Heartbeat": {
    "SharedContainerName": "azure-webjobs-hosts",
    "SharedDirectoryName": "heartbeats/ef6959df3bc9431680c944c6ca5b1eff",
    "InstanceBlobName": "ad1f5b26ddec43269cfbdf585065e773",
    "ExpirationInSeconds": 45
  }
}

If I remove the Singleton attribute, everything works!

I've tried options like -

[Singleton(@"{CorrelationId}")]

However, Its not helping.

What's the problem(and fix)?

abatishchev
  • 98,240
  • 88
  • 296
  • 433

1 Answers1

3

I believe I see a bug that we can fix tomorrow. For the time being, you should be able to work around this by binding to your own POCO Type rather than BrokeredMessage. Can you try that for now?

I'll respond back to this thread with a link to an updated package with the fix when ready.

Thanks.

mathewc
  • 13,312
  • 2
  • 45
  • 53
  • 1
    This has now been fixed. You can get an updated package with the fix from the MyGet "Nightlies" feed, instructions here: http://github.com/Azure/azure-webjobs-sdk/wiki/%22Nightly%22-Builds. – mathewc Oct 02 '15 at 18:06
  • thanks mathewc. Does this include only SIngleTon fix or other changes as well? I am also observing that the webjob (deployed a windows service) stops responding/listening after a while. If you restart the service, it picks up missed messages again. I suspect that this could be because of transient network drop (or another bug!). Is there any way I can handle this? – Mahesh Kshirsagar Oct 06 '15 at 10:36
  • I don't understand your deployment scenario - what do you mean you're deploying a WebJob as a "windows service"? – mathewc Oct 07 '15 at 03:29
  • WebJob console application is being turned into a windows service (using ToShelf). Webjob calls a third party API. This third party API provider needed static IP to whitelist our webjob as a trusted source. Hosting WebJob in a WebApp would have generated a dynamic IP so we had to host it as a windows service on VM. VM will always have a static IP. HTH. – Mahesh Kshirsagar Oct 07 '15 at 20:20
  • When running in Azure Web Apps, the WebJobs infrastructure takes care of ensuring your job stays running (when you have AlwaysOn enabled). E.g., if your job fails due to an error, the infrastructure restarts it, and keeps it alive. Since you're running outside of that infrastructure it's up to you to implement that "keep alive" behavior. – mathewc Oct 07 '15 at 20:40
  • To close on this, this issue has been fixed in the v1.1.0 release of the WebJobs SDK. – mathewc Nov 30 '15 at 18:05