package com.javahonk.subscriber;

import javax.annotation.PostConstruct;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import com.google.common.eventbus.DeadEvent;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;

public class DeadEventProcessor {

	private static final Logger logger = LogManager.getLogger(DeadEventProcessor.class.getName());
	
	@Autowired
	EventBus eventBus;
	
	@PostConstruct
	public void init(){
		eventBus.register(this);
	}	
	
	@Subscribe
	public void processDeadEvent(DeadEvent deadEvent){
		
		logger.error("DEADEVENT DETECTED:{}",deadEvent.getEvent().getClass());
		
	}
}
