only publish event if ApplicationContext is active