cancel
Showing results for 
Search instead for 
Did you mean: 

Datahub : how to get CanonicalItem inside CompositionCompletedEventListener class

Former Member
0 Kudos

using below code i am able to get the status of canonical item but i also want to get the canonical item of that status .

poolActionService.findCompositionAction(event.getActionId()).getStatus()

Could anybody help to get the Canonicalitem for the same status?

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member224482
Active Contributor
0 Kudos
 CompositionAction action = poolActionService.findCompositionAction(event.getActionId());
 DataHubIdBasedPageable all = new DefaultDataHubIdBasedPageRequest(Integer.MAX_VALUE, 0);
 canonicalItemService.findCanonicalItems(action.getPool(), "yourCanonicalType", all, CompositionStatusType.SUCCESS);

Be aware that composition statues are not the same as canonical item statues. Look at :
CompositionActionStatusType
CompositionStatusType

Wiki information : Item Statuses and Lifecycle

Former Member
0 Kudos

Thanks Robin , But i need to get the Canonical item for which i am getting CompositionActionStatusType. Above code suggested by you , gives CanonicalItem on Basis of CompositionStatusType.

What possible value should be pass for pagenumber and pagesize with below code i am not getting CanonicalItem. final DataHubPageable pageable = new DefaultDataHubPageRequest(Integer.MAX_VALUE, Integer.MAX_VALUE); DataHubPage canItem=poolActionService.findCompositionActionErrors(event.getActionId(), pageable);

former_member224482
Active Contributor
0 Kudos

There is no API to read canonical item given a composition action status. You can only read canonical by canonical status.

You could read all canonical items and then filter to keep those that has the same canonicalItem.getCompositionAction() that the one you are looking for.

Former Member
0 Kudos

Hi Robin thanks a lot . I am trying to create a notification framework in datahub if any of the item (MATMAS OR SALESORDER) gets failed in datahub, user should get notification in form of mail . Could you please tell me some other way if there is no API to get canonical item for composition action status so that i can send notification to user that this item with id xyz is failing in Datahub.

Former Member
0 Kudos

You can use CanonicalItemService.findComposedCanonicalItems or findItemsByIntegrationKey methods. They are documented in the datahub SDK

Former Member
0 Kudos

Thanks Matthias , But my requirement is to get the CanonicalItem for which i am getting the CompositionActionStatusType .

If i use CanonicalItemService.findComposedCanonicalItems or findItemsByIntegrationKey , it returns CanonicalItem which is already persisted in Database.