using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using com.itac.mes.proxy.business; namespace Itac.Oib { public class ThreadTemplate { protected readonly OIBEventHandler _eventHandler; protected readonly T _request; public ThreadTemplate(OIBEventHandler eventHandler, T request) { _eventHandler = eventHandler; _request = request; } /// /// get the event handler. By calling a funcion at the eventHandler the object is serialized and transported to java receiver. /// /// The event handler instance /// An exception is thrown when the handler was not set to this instance of thread template public OIBEventHandler getEventHandler() { if (_eventHandler == null) { if (_request == null) { throw new Exception("missing event handler to transport unknown message"); } throw new Exception("missing event handler to transport message of type " + _request.GetType().Name); } return _eventHandler; } } }