0

Once I've kicked off a JobHost via RunAndBlock, is it possible to dynamically bind functions to it? I'm specifically interested in doing this using a service bus. I'm envisioning a scenario where the service gets a notification that there's a new type of message available on a particular queue along with the functionality that should get executed when that message is received. It would also be nice to do the reverse - that is to tell a running JobHost to stop handling messages of a specific type. Is this possible?

mathewc
  • 13,312
  • 2
  • 45
  • 53
Keith
  • 706
  • 5
  • 13

1 Answers1

2

For your first question, no, you cannot add/bind functions to a running JobHost. All the "listeners" for the various queues, etc. are initialized and started at startup time only. All the metadata for what queues to start listening to etc. is determined from compile time metadata on startup. If you'd like, you could make a feature request in our issues list here - it's an interesting (though uncommon) scenario. We are working on something similar to what you ask for in WebJobs.Script, but this is not core WebJobs SDK. WebJobs.Script defines all host/function metadata in external metadata files. So if a new script + metadata is added (e.g. a function for a new queue) the host will restart itself automatically.

For your second question, check out DisableAttribute (see in Release Notes). It allows you to enable/disable particular functions via application settings. Note that this is also a startup time check, however changes in application settings cause a restart anyways.

mathewc
  • 13,312
  • 2
  • 45
  • 53
  • Sad to hear that it isn't possible, but I appreciate the reply. I'll look into making a feature request. – Keith Dec 28 '15 at 00:05