Broadleaf Commerce - 我的工作流活动被执行了两次
Broadleaf Commerce - My workflow activities are being executed twice
内置的工作流活动似乎被执行了两次。我正在测试结帐工作流程,DecrementInventoryActivity 两次从 sku 中删除数量。
这是已知错误还是我做错了什么?
我是这样创建工作流的:
<!-- Checkout Workflow Configuration -->
<bean id="blCheckoutWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor">
<property name="processContextFactory">
<bean class="org.broadleafcommerce.core.checkout.service.workflow.CheckoutProcessContextFactory"/>
</property>
<property name="activities">
<list>
<bean p:order="6000" id="blDecrementInventoryActivity" class="org.broadleafcommerce.core.checkout.service.workflow.DecrementInventoryActivity">
<property name="rollbackHandler" ref="blDecrementInventoryRollbackHandler" />
</bean>
<bean p:order="7000" id="blCompleteOrderActivity" class="org.broadleafcommerce.core.checkout.service.workflow.CompleteOrderActivity">
<property name="rollbackHandler" ref="blCompleteOrderRollbackHandler" />
</bean>
<bean p:order="9999999" class="com.mycompany.workflow.checkout.NotifyExternalInventorySystem" />
</list>
</property>
<property name="defaultErrorHandler">
<bean class="org.broadleafcommerce.core.workflow.DefaultErrorHandler">
<property name="unloggedExceptionClasses">
<list>
<value>org.broadleafcommerce.core.inventory.service.InventoryUnavailableException</value>
</list>
</property>
</bean>
</property>
</bean>
从 Broadleaf 4.0 开始,DecrementInventoryActivity 被默认添加到 blCheckoutWorkflow。请参阅 "Inventory Management".
部分中 http://www.broadleafcommerce.com/docs/core/4.0/migration-notes/3.1-to-4.0-migration/3.1.10-to-4.0-migration 的 3.1.10-4.0.0 迁移说明
这也适用于 defaultErrorHandler
,您可以删除 blCompleteOrderActivity
(一直在框架中管理)。基本上,您自定义的 blCheckoutWorkflow bean 应该更改为:
<bean id="blCheckoutWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor">
<property name="activities">
<list>
<bean p:order="9999999" class="com.mycompany.workflow.checkout.NotifyExternalInventorySystem" />
</list>
</property>
</bean>
从 Broadleaf 3.0 开始,对 blCheckoutWorkflow bean 的任何修改都会经过 Broadleaf XML 合并处理(合并 bean id,例如 blCheckoutWorkflow
的 activities
列表)。在您的情况下,由于 DecrementInventoryActivity
已经在核心框架 XML 文件中定义并且您对 blCheckoutWorkflow
的定义与其合并,因此最终结果是 DecrementInventoryActivity
的 2 个实例.
内置的工作流活动似乎被执行了两次。我正在测试结帐工作流程,DecrementInventoryActivity 两次从 sku 中删除数量。
这是已知错误还是我做错了什么?
我是这样创建工作流的:
<!-- Checkout Workflow Configuration -->
<bean id="blCheckoutWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor">
<property name="processContextFactory">
<bean class="org.broadleafcommerce.core.checkout.service.workflow.CheckoutProcessContextFactory"/>
</property>
<property name="activities">
<list>
<bean p:order="6000" id="blDecrementInventoryActivity" class="org.broadleafcommerce.core.checkout.service.workflow.DecrementInventoryActivity">
<property name="rollbackHandler" ref="blDecrementInventoryRollbackHandler" />
</bean>
<bean p:order="7000" id="blCompleteOrderActivity" class="org.broadleafcommerce.core.checkout.service.workflow.CompleteOrderActivity">
<property name="rollbackHandler" ref="blCompleteOrderRollbackHandler" />
</bean>
<bean p:order="9999999" class="com.mycompany.workflow.checkout.NotifyExternalInventorySystem" />
</list>
</property>
<property name="defaultErrorHandler">
<bean class="org.broadleafcommerce.core.workflow.DefaultErrorHandler">
<property name="unloggedExceptionClasses">
<list>
<value>org.broadleafcommerce.core.inventory.service.InventoryUnavailableException</value>
</list>
</property>
</bean>
</property>
</bean>
从 Broadleaf 4.0 开始,DecrementInventoryActivity 被默认添加到 blCheckoutWorkflow。请参阅 "Inventory Management".
部分中 http://www.broadleafcommerce.com/docs/core/4.0/migration-notes/3.1-to-4.0-migration/3.1.10-to-4.0-migration 的 3.1.10-4.0.0 迁移说明这也适用于 defaultErrorHandler
,您可以删除 blCompleteOrderActivity
(一直在框架中管理)。基本上,您自定义的 blCheckoutWorkflow bean 应该更改为:
<bean id="blCheckoutWorkflow" class="org.broadleafcommerce.core.workflow.SequenceProcessor">
<property name="activities">
<list>
<bean p:order="9999999" class="com.mycompany.workflow.checkout.NotifyExternalInventorySystem" />
</list>
</property>
</bean>
从 Broadleaf 3.0 开始,对 blCheckoutWorkflow bean 的任何修改都会经过 Broadleaf XML 合并处理(合并 bean id,例如 blCheckoutWorkflow
的 activities
列表)。在您的情况下,由于 DecrementInventoryActivity
已经在核心框架 XML 文件中定义并且您对 blCheckoutWorkflow
的定义与其合并,因此最终结果是 DecrementInventoryActivity
的 2 个实例.