Skip to content

Commit

Permalink
Merge pull request #37 from hotwax/34-add-attempted-order-item-and-br…
Browse files Browse the repository at this point in the history
…okered-order-item-count-in-orderroutingrun-result

Return brokered order item count and attempted order count in routing…
  • Loading branch information
dixitdeepak authored Jul 29, 2024
2 parents 8905b33 + b99c01b commit 4e5b4f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<default-field><display/></default-field>
</field>
<field name="message">
<default-field><display text="${errors?:messages}"/></default-field>
<default-field><display text="${errors?:messages?: ''}"/></default-field>
</field>
<field name="findButton">
<header-field title="Find"><submit/></header-field><default-field>
Expand Down
9 changes: 7 additions & 2 deletions service/co/hotwax/order/routing/OrderRoutingServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,16 @@
<if condition="!orderRoutings">
<return type="warning" message="No order routing configuration found for the specified routing group ${orderRoutingGroup.groupName} [${routingGroupId}]."/>
</if>
<set field="groupItemCount" value="0" type="Long"/>
<set field="groupBrokeredItemCount" value="0" type="Long"/>
<log message="Started order routing for ${orderRoutingGroup.groupName} [${routingGroupId}] routing group."/>
<iterate list="orderRoutings" entry="orderRouting">
<service-call name="create#co.hotwax.order.routing.OrderRoutingRun" transaction="force-new" ignore-error="true"
in-map="[routingGroupId:routingGroupId, orderRoutingId: orderRouting.orderRoutingId,
productStoreId: productStoreId, startDate:ec.user.nowTimestamp]"
out-map="routingRunResult"/>
<set field="attemptedItemCount" type="Long"/>
<set field="attemptedItemCount" value="0" type="Long"/>
<set field="brokeredItemCount" value="0" type="Long"/>
<script>
/*
Calling a service in a script with ignore-error="true".
Expand All @@ -145,6 +148,8 @@
.call()
attemptedItemCount = orderRoutingResult.attemptedItemCount
brokeredItemCount = orderRoutingResult.brokeredItemCount
groupItemCount += attemptedItemCount
groupBrokeredItemCount +=brokeredItemCount
} catch (Throwable e) {
ec.logger.error("There is an issue with run#OrderRouting", e)
}
Expand All @@ -167,7 +172,7 @@
endDate:ec.user.nowTimestamp, orderItemCount: attemptedItemCount, brokeredItemCount: brokeredItemCount]"
out-map="routingRunResult"/>
</iterate>
<message type="success">Finished order routing for ${orderRoutingGroup.groupName} [${routingGroupId}] routing group.</message>
<message type="success">Finished order routing for the ${orderRoutingGroup.groupName} routing group with an attempted order item count of ${attemptedItemCount} and a brokered item count of ${groupBrokeredItemCount}</message>
</actions>
</service>

Expand Down

0 comments on commit 4e5b4f0

Please sign in to comment.