cancel
Showing results for 
Search instead for 
Did you mean: 

canonical item in composition handler not filled with RAW.xml mapping (V5.6)

Former Member

In my custom composition handler, the canonicalItem does not have all fields populated from Raw.xml mapping.

Example: Function in custom composition handler:

 public  T compose(CanonicalAttributeDefinition CanonicalAttributeDefinition,
             CompositionGroup<? extends RawItem> compositionGroup, T canonicalItem)

  • The composition handler has order property defined > 1000 in spring.xml

  • The attribute on canonical object is mapping directly from a raw field in raw.xml

  • for example, this is the value I see on canonicalItem in the composition handler:

CanonicalItem{integrationKey='null', status=SUCCESS, compositionStatusDetail='null'BaseDataItem{id=null, dataPool=SAPORDER_INBOUND_POOL, fields={container=null, country=null, zipCode=null, orderType=null, orderNumber=null, ......

In this case, why is integrationKey='null' and orderNumber=null? A few values on the canonical item is populated, but it's not consistent which are populate each time.

If I look into the raw items in compositionGroup.getItems(), they all have valid value.

I also found the custom composition handler I define with higher order number are executed before lower number custom composition handlers.

former_member224482
Active Contributor
0 Kudos

You should filter out the raw items with null integration keys(primary key fields) using a grouping handler.

Have a look at the raw item before starting the composition phase. You should be able to identify which raw item have those null value.

Former Member
0 Kudos

Hi Robin, I see in DB there are 7 RAWitems generated, with valid data populated. They all have the integration key values. I can find all 7 Raw items in the custom composition handler from CompositionGroup.getItems(). However the canonicalItem does not have value populated as expected. I thought after OOB composition handler #1000, the canonical should be populated?

After composition is complete, the composition Item in DB has all fields populated as expected. Seems like the composition sequence is not as expected.

former_member224482
Active Contributor
0 Kudos

I don't know the strategy used by Data Hub to enforce such ordering of the composition handlers. Especially with akka parallel processing.

In general there should not be any need to read value canonical values from previously processed composition handlers as they all have the same input (raw items).

I always assumed that all composition handlers must be independent to avoid issues with parallel processing. Given this, ordering is not important as each field can be computed independently.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member224482
Active Contributor

Here is the reason. Your composition handler is 1000 which is identical to the base attribute handler. Because of this, the outcome of the sorting is random for identical(1000) order.
datahub-service-*.jar
datahub-service-composition-spring.xml

     <bean id="localizedCompositionRuleHandler" class="com.hybris.datahub.composition.impl.LocalizedCompositionRuleHandler"
           parent="abstractCompositionRuleHandler">
         <property name="order" value="1" />
     </bean>
 
     <bean id="collectionCompositionRuleHandler" class="com.hybris.datahub.composition.impl.CollectionCompositionRuleHandler"
           parent="abstractCompositionRuleHandler">
         <property name="order" value="2" />
     </bean>
 
     <bean id="basicAttributeCompositionRuleHandler"
           class="com.hybris.datahub.composition.impl.BasicAttributeCompositionRuleHandler"
           parent="abstractCompositionRuleHandler">
         <property name="order" value="1000" />
     </bean>

Use order 1001 and it should be fine.

Former Member
0 Kudos

Hi Robin, to clarify, my custom composition handler is not 1000, it's 1030. I know 1, 2, 1000 are reserved so I am using order greater than 1000 expecting BasicAttributeCompositionRuleHandler should complete populating the canonicalItem by the time my custom handler is called.

Former Member
0 Kudos

This composition handler has order 1029, but it is run before 1028 and 1030. This class is called only once, and all Raws in the composition group has valid order number. I want to format lineItemQuantity.

CanonicalItem{integrationKey='null', status=SUCCESS, compositionStatusDetail='null'BaseDataItem{id=null, dataPool=SAPASN_INBOUND_POOL, fields={sapVendorID=FDE, lineItemQuantityNumber=null, orderNumber=null, serialNumber=null, productID=null, CarrierTrackingCode=null, orderLineItemNumber=null, lineItemQuantity=null, deliveryNumber=null, sapVendorName=null, entryID=null}}}