| I'm not following. Why do you need to implement anything in afterMessage ? You can implement getSearchIntegrator() by closing any Session right away after extracting the SearchIntegrator, in case you prefer to use the Hibernate native API. With JavaEE and a standard persistence context it's even simpler:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/hsearch") })
public class RegistrationMdb extends AbstractJMSHibernateSearchController implements MessageListener {
@PersistenceContext
private EntityManager em;
@Override
protected SearchIntegrator getSearchIntegrator() {
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager( em );
return fullTextEntityManager.getSearchFactory().unwrap( SearchIntegrator.class );
}
}
Yoann's suggestion is correct but it forces you to use a private API. We might want to introduce a better API for this. |