WebJob中的持久任务扩展不会在单独的类库中注册活动和编排器 [英] Durable Task Extension in WebJob does not register Activities and Orchestrators in separate class libraries

查看:85
本文介绍了WebJob中的持久任务扩展不会在单独的类库中注册活动和编排器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我通过控制台应用程序在WebJob中托管Durable Task Extensions,这样我就可以获得外面可用的持久任务的绝佳好处Azure的。 我让它正常运行,并且确信这可以正常工作,等待更多测试。



另一个目标是将这个WebJob / DurableTask代码集成到更大的SOA Visual中具有DurableTask活动的Studio解决方案调用解决方案中某些SOA服务的服务操作。



为此,我想打破我的Activity和Orchestration类从托管Durable Task Extension(在Program.cs中)的类库到他们自己独立的类库中。 这是一个典型的做法,使用更大的Visual Studio
解决方案,以便在大量代码中保持良好的组织,避免使用大型类库来支持更多小到中等大小的类库。



但是,从Host类lib(包含Program.cs)中删除Activity和Orchestration类并将它们放在它们自己的类lib中会导致运行时错误,如下所示。



info:Function.DteRequestQueueTriggerHandler.User [0]

Hello,

I am hosting Durable Task Extensions in a WebJob via a Console App so that I can have the awesome benefits of Durable Tasks available outside of Azure.  I have it running properly and am becomming convinced this will work OK, pending more tests.

Another goal is to integrate this WebJob/DurableTask code into a much larger SOA Visual Studio solution with the DurableTask Activities invoking service operations of some of the several SOA services in the solution.

Toward this end I would like to break out my Activity and Orchestration classes from the class library that Hosts the Durable Task Extension (in Program.cs) into their own separate class libraries.  This is a typical practice with larger Visual Studio solutions to keep things well organized within a large expanse of code, avoiding huge class libraries in favor of more numerous class libs of small to moderate size.

However, removing the Activity and Orchestration classes from the Host class lib (containing Program.cs) and putting them in their own class lib causes a runtime error, as shown below.

info: Function.DteRequestQueueTriggerHandler.User[0]

     
*** DteRequestQueueTriggerHandler():client.TaskHubName = DteExplore1CleanTaskHub

      ***DteRequestQueueTriggerHandler(): client.TaskHubName = DteExplore1CleanTaskHub

fail:Function.DteRequestQueueTriggerHandler.User [0]

fail: Function.DteRequestQueueTriggerHandler.User[0]

    ;  
*** DteRequestQueueTriggerHandler():捕获异常=
函数'HelloSequenceOrch'不存在,被禁用或不存在一个orchestrator函数。附加信息:目前尚未注册任何orchestrator函数!

      ***DteRequestQueueTriggerHandler(): Caught exception = The function 'HelloSequenceOrch' doesn't exist, is disabled, or is not an orchestrator function. Additional info: No orchestrator functions are currently registered!

fail:Function.DteRequestQueueTriggerHandler [0]

fail: Function.DteRequestQueueTriggerHandler[0]

     
执行'OrchestrationManager.DteRequestQueueTriggerHandler'(失败,Id = dbaab16e-6cfd-44ab-bef7-5b4eb6b100d5)

      Executed 'OrchestrationManager.DteRequestQueueTriggerHandler' (Failed, Id=dbaab16e-6cfd-44ab-bef7-5b4eb6b100d5)

Microsoft.Azure.WebJobs.Host.FunctionInvocationException:执行函数时出现异常:OrchestrationManager.DteRequestQueueTriggerHandler ---> System.ArgumentException:
函数'HelloSequenceOrch'不存在,被禁用或不是协调器函数。附加信息:目前尚未注册任何orchestrator功能!

Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: OrchestrationManager.DteRequestQueueTriggerHandler ---> System.ArgumentException: The function 'HelloSequenceOrch' doesn't exist, is disabled, or is not an orchestrator function. Additional info: No orchestrator functions are currently registered!

   
at C:\ project] \ azure-functions-durable-extension \src \WebJobs中的Microsoft.Azure.WebJobs.Extensions.DurableTask.DurableTaskExtension.ThrowIfFunctionDoesNotExist(String name,FunctionType functionType) .Extensions.DurableTask \DurableTaskExtension.cs:第526行

   at Microsoft.Azure.WebJobs.Extensions.DurableTask.DurableTaskExtension.ThrowIfFunctionDoesNotExist(String name, FunctionType functionType) in C:\projects\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\DurableTaskExtension.cs:line 526

  
at Microsoft.Azure.WebJobs.DurableOrchestrationClient.StartNewAsync(String orchestratorFunctionName,String instanceId,Object input)在C:\ project] \ azure-functions-durable-extension \src \ WebJobs中。 Extensions.DurableTask \DurableOrchestrationClient.cs:第83行.......

   at Microsoft.Azure.WebJobs.DurableOrchestrationClient.StartNewAsync(String orchestratorFunctionName, String instanceId, Object input) in C:\projects\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\DurableOrchestrationClient.cs:line 83 .......

当我将Activity和Orchestration类代码放回时进入Host类的lib一切正常。
$


似乎Durable Task Extension代码在启动时正在扫描托管它的程序集,寻找ActivityTrigger和OrchestrationTrigger属性,然后在适当的情况下调用TaskHubWorker AddTaskActivity()或AddTaskOrchestration()
,从而自动注册在该单个程序集中使用ActivityTrigger和OrchestrationTrigger属性修饰的所有方法。 至少这是行为的一个合理解释。



我有什么办法可以告诉Durable Task Extension也可以通过单独的类查看其他程序集输出我希望用于活动和编排的库?
$


或者,有没有办法可以获得对TaskHubWorker的引用并以编程方式逐个注册这些库,在没有持久任务扩展的情况下使用持久任务框架时必须做什么?
$


Whew! 感谢阅读所有这些 - 乔治。

When I put the Activity and Orchestration class code back into the Host class lib everything works fine.

It seems that the Durable Task Extension code is scanning the assembly that is hosting it when it starts up, looking for ActivityTrigger and OrchestrationTrigger attributes, and then behind the scenes calling TaskHubWorker AddTaskActivity() or AddTaskOrchestration() as appropriate, thus automagically registering all methods decorated with ActivityTrigger and OrchestrationTrigger attributes in that single assembly.  At least that is one plausible explanation for the behavior.

Is there any way I can tell the Durable Task Extension to also look in the other assemblies output by the separate class libs I want to have for Activities and Orchestrations?

OR, alternatively, is there a way I can get a reference to the TaskHubWorker and programatically register these one by one, as must be done when using the Durable Task Framework without the Durable Task Extension?

Whew!  Thanks for reading all this -- George.




George Stevens

George Stevens

推荐答案

感谢您提出详细的问题!
我们正在查看此查询并将很快就会回复你。


这篇关于WebJob中的持久任务扩展不会在单独的类库中注册活动和编排器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆