Skip to Content
Former Member
Jun 08, 2016 at 04:01 PM

Unable to find pool when using NEW_POOL_FOR_INPUT pooling strategy


We use the NEW_POOL_FOR_INPUT pooling strategy, so a new pool get created each time we upload a data feed (Documentation for NEW_POOL_FOR_INPUT).

Unfortunately, this seems to result in our listener not being able to find the pool in the DataBase when DataHub is under load.

We think this is possibly due to it not being persisted prior to the DataLoadingCompletedEvent being published, since we are getting a nullpointer when retrieving the Pool-name for the Pool-Id. When we later look at the database rows, the pool has been created with the correct information (and name). The creation of the pool is done previously by the DataFeedActor which does appears to save the pool to the DB - but perhaps doesn't complete the persistance operation before the listener is triggered?

It seems that the example event solution provided at the solution book is incompatible with the pooling strategy?

Our DataLoadedEventListener that extends DataHubEventListener is only a slight modification of the sample solution:

 public void handleEvent(DataLoadingCompletedEvent event) {
     String poolName = getPoolNameFromId(event.getPoolId());
     if (poolName.equals(poolType) || poolName.endsWith("_" + poolType))
      InitiateCompositionEvent composeEvent = new InitiateCompositionEvent(event.getPoolId());

 protected String getPoolNameFromId(long poolId) {
     DataHubPool pool = this.dataHubFeedService.findPoolById(Long.valueOf(poolId));
     return pool != null?pool.getPoolName():null;

Edit: And yes, the listener executes in a transaction:

 @Override public boolean executeInTransaction() { return true; }

The stack trace:

 2016-06-08 14:13:14,750 [INFO] [c.h.d.s.f.DataFeedActor] Loading 152 items to '2090_ONBOARDING' data feed
 2016-06-08 14:13:14,753 [DEBUG] [c.h.d.s.i.DefaultEventPublicationService] Publishing data hub event : DataLoadingStartedEvent{actionId=9, feedId=8, poolId=8, itemCount=152}
 2016-06-08 14:13:14,901 [DEBUG] [c.h.d.s.i.DefaultEventPublicationService] Publishing data hub event : DataLoadingCompletedEvent{actionId=9, feedId=8, itemCount=152, status='COMPLETE'}
 2016-06-08 14:13:14,902 [INFO] [c.c.d.e.DataLoadedEventListener] ****************************************************
 2016-06-08 14:13:14,903 [INFO] [c.c.d.e.DataLoadedEventListener] DataLoadingCompletedEvent For pooltype: [CSV_IMPORT_POOL], poolId  is [8], poolname is [null]
 2016-06-08 14:13:14,903 [INFO] [c.c.d.e.DataLoadedEventListener] ****************************************************
 2016-06-08 14:13:14,906 [ERROR] [o.s.a.i.SimpleAsyncUncaughtExceptionHandler] Unexpected error occurred invoking async method 'public void com.hybris.datahub.service.impl.DefaultEventPublicationService.publishEvent(com.hybris.datahub.api.event.DataHubEvent)'.
 java.lang.NullPointerException: null
     at com.ourextension.datahub.event.DataLoadedEventListener.handleEvent( ~[montrose-datahub-event-5.7.14-SNAPSHOT.jar:na]

Your help would be greatly appreciated!