You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have 3 differents WebJobs which call different apis using a specific parameter in the uri.
Webjob1 => parameter = "Paris"
WebJob2 => parameter = "Tokyo"
WebJob3 => parameter = "London"
The rest of the code is the same, I want 3 different webjobs to be able to scale them independantly depending of the CPU charge.
When I first created the first Webjob, the timetrigger function was correctly found.
When it becames the time to create a generic HostBuilder, the timetrigger function is never found and I get this error message:
No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
It seems not possible to bind a [Time/Queue/...]Trigger function from a generic HostBuilder which is in a different dll? Is there a way to specify in which dll the HostBuilder must search for [Time/Queue/...]Trigger functions?
public class Program : PollerHostBuilder<ILogger<Program>, IMyService, MyParisModule>
{
public static async Task Main(string[] args)
{
var host = GenerateHost(args);
using (host)
{
await host.RunAsync();
}
}
}
WebJob.Paris > Functions.cs
public class MyParisFunctions
{
public MyParisFunctions()
{
}
public async Task MyParisFunctionAsync([TimerTrigger("0 */2 * * * *", RunOnStartup = true)]TimerInfo _)
{
//Do something
}
The text was updated successfully, but these errors were encountered:
Just ran into basically the same problem. I have a "BaseWorker" which itself doesn't have any functions but sets up and builds many other things, and a few different specific workers that each have their own (webjob triggered) functions. However the "specific workers" only transiently reference the WebJobs SDK. None of the functions were being found.
It seems to be root-caused by the DefaultTypeLocator not looking "down" references of references? Is there maybe a way to add, replace or extend without a full replacing the TypeLocator? My work around is in each of the Program.cs files where my functions/triggers actually live to static-ref a SDK class but that feels bad.
internal class Program
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("CodeQuality", "IDE0051:Remove unused private members",
Justification = "Due to auto-magic type finding, we have to strongly reference a type from either M.A.WJ or M.A.WJ.Hosting. See https://github.com/Azure/azure-webjobs-sdk/issues/2146")]
private static readonly Microsoft.Azure.WebJobs.Hosting.JobHostService _ignoreMe;
//...
}
Or copy/paste the above DefaultTypeLocator() and add it (with different helpful name) to your "Base" project, since it has a "extension assemblies" on line 66 that will thus use anything directly referencing your assembly.
Longer term, I think that the SDK's type locator should try and dig just a little bit deeper, and maybe "always" include the Entry Assembly? Or let us add (somehow in ConfigureServices) / specify additional Assemblies / Types to search/index without having to write our own full type locator.
PS: debugging this far was a decent pain due to the embedded debug symbols being partial and thus hiding most of this. Had to butcher a local copy to emit full debug symbols. Can there please be an easier way to include/use full symbols?
Hi,
I have 3 differents WebJobs which call different apis using a specific parameter in the uri.
The rest of the code is the same, I want 3 different webjobs to be able to scale them independantly depending of the CPU charge.
When I first created the first Webjob, the timetrigger function was correctly found.
When it becames the time to create a generic HostBuilder, the timetrigger function is never found and I get this error message:
It seems not possible to bind a [Time/Queue/...]Trigger function from a generic HostBuilder which is in a different dll? Is there a way to specify in which dll the HostBuilder must search for [Time/Queue/...]Trigger functions?
Webjob.Generic > Program.cs
WebJob.Paris >Program.cs:
WebJob.Paris > Functions.cs
The text was updated successfully, but these errors were encountered: