on 2018 Jul 05 3:52 PM - last edited on 2024 Feb 04 6:19 AM by postmig_api_4
Hi All ,
My requirement is to check status of composition of SAPCONFIGURATION_POOL, before every product replication through pool :- GLOBAL
I tried below code, but this code is getting executed every time after SAPCONFIGURATION_POOL is call instead I want it to check before every product replication
Is their anything wrong ?
package com.cgi.events.impl;
import java.util.ArrayList;
import com.hybris.datahub.api.event.CompositionCompletedEvent;
import com.hybris.datahub.api.event.DataHubEvent;
import com.hybris.datahub.api.event.DataHubEventListener;
import com.hybris.datahub.api.event.DataHubPoolEvent;
import com.hybris.datahub.api.event.InitiateCompositionEvent;
import com.hybris.datahub.api.event.InitiatePublicationEvent;
import com.hybris.datahub.dto.pool.PoolData;
import com.hybris.datahub.runtime.domain.DataHubPool;
import com.hybris.datahub.service.DataHubFeedService;
import com.hybris.datahub.service.EventPublicationService;
import com.hybris.datahub.service.PoolActionService;
public class CompositionEventsListener implements DataHubEventListener<CompositionCompletedEvent> {
private DataHubFeedService dataHubFeedService;
private EventPublicationService eventPublicationService;
@Override
public void handleEvent(CompositionCompletedEvent event) {
DataHubPool dataHubPool = dataHubFeedService.findPoolByName("SAPCONFIGURATION_POOL");
Long poolId=dataHubPool.getPoolId();
System.out.println("************composition event in side if loop*********************"+poolId);
DataHubPool globalPool = dataHubFeedService.findPoolByName("GLOBAL");
Long globalPoolId=globalPool.getPoolId();
System.out.println("************composition event in side if loop*********************"+globalPoolId);
if(poolId.equals(event.getPoolId()))
{
final InitiateCompositionEvent nextPublicationEvent = new InitiateCompositionEvent(globalPool.getPoolId());
eventPublicationService.publishEvent(nextPublicationEvent);
System.out.println("************composition event in side if loop*********************");
}
}
@Override
public boolean executeInTransaction() {
// TODO Auto-generated method stub
return true;
}
@Override
public Class<CompositionCompletedEvent> getEventClass() {
// TODO Auto-generated method stub
return CompositionCompletedEvent.class;
}
public DataHubFeedService getDataHubFeedService() {
return dataHubFeedService;
}
public void setDataHubFeedService(DataHubFeedService dataHubFeedService) {
this.dataHubFeedService = dataHubFeedService;
}
public EventPublicationService getEventPublicationService() {
return eventPublicationService;
}
public void setEventPublicationService(EventPublicationService eventPublicationService) {
this.eventPublicationService = eventPublicationService;
}
}
Request clarification before answering.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.