class JobExecutionNotificationPublisher
		implements ApplicationListener<SimpleMessageApplicationEvent>, NotificationPublisherAware {

	private static final Log LOG = LogFactory.getLog(JobExecutionNotificationPublisher.class);

	private NotificationPublisher notificationPublisher;

	private int notificationCount = 0;

	/**
	 * Injection setter.
	 *
	 * @see org.springframework.jmx.export.notification.NotificationPublisherAware#setNotificationPublisher(org.springframework.jmx.export.notification.NotificationPublisher)
	 */
	@Override
	public void setNotificationPublisher(NotificationPublisher notificationPublisher) {
		this.notificationPublisher = notificationPublisher;
	}

	/**
	 * If the event is a {@link SimpleMessageApplicationEvent} for open and close we log
	 * the event at INFO level and send a JMX notification if we are also an MBean.
	 *
	 * @see ApplicationListener#onApplicationEvent(ApplicationEvent)
	 */
	@Override
	public void onApplicationEvent(SimpleMessageApplicationEvent applicationEvent) {
		String message = applicationEvent.toString();
		LOG.info(message);
		publish(message);
	}

	/**
	 * Publish the provided message to an external listener if there is one.
	 * @param message the message to publish
	 */
	private void publish(String message) {<FILL_FUNCTION_BODY>}

}

		if (notificationPublisher != null) {
			Notification notification = new Notification("JobExecutionApplicationEvent", this, notificationCount++,
					message);
			/*
			 * We can't create a notification with a null source, but we can set it to
			 * null after creation(!). We want it to be null so that Spring will replace
			 * it automatically with the ObjectName (in ModelMBeanNotificationPublisher).
			 */
			notification.setSource(null);
			notificationPublisher.sendNotification(notification);
		}
	
<no_super_class>