當前位置: 首頁>>代碼示例>>Java>>正文


Java EventException類代碼示例

本文整理匯總了Java中com.ebay.jetstream.event.EventException的典型用法代碼示例。如果您正苦於以下問題:Java EventException類的具體用法?Java EventException怎麽用?Java EventException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EventException類屬於com.ebay.jetstream.event包,在下文中一共展示了EventException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
public void update(EventBean[] newEvents, EventBean[] oldEvents,
		EPStatement statement, EPServiceProvider epServiceProvider) {
	
	System.out.println(newEvents);
	if(newEvents == null)
		return;

	m_eventReceived.incrementAndGet();
	for (EventBean bean : newEvents) {
		try {
			System.out.println(bean.get("conOutput"));
		}
		catch (EventException e) {
		}
	}

	// TODO Auto-generated method stub
	
}
 
開發者ID:pulsarIO,項目名稱:jetstream-esper,代碼行數:21,代碼來源:EventListener.java

示例2: sendEvents

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
public void sendEvents(Collection<JetstreamEvent> events, EventMetaInfo meta)
		throws EventException {
	BatchSourceCommand action = meta.getAction();
	BatchResponse res = null;
	switch (action) {
	case OnNextBatch:
		res = onNextBatch(meta.getBatchSource(), events);
		break;
	case OnBatchProcessed:
		onBatchProcessed(meta.getBatchSource());
		break;
	case OnException:
		res = onException(meta.getBatchSource(), meta.getException());
		break;
	case OnIdle:
		res = onIdle(meta.getBatchSource());
		break;
	case OnStreamTermination:
		res = onStreamTermination(meta.getBatchSource());
		break;
	default:
		throw new IllegalArgumentException("Illegal batch sink action.");
	}
	meta.setBatchResponse(res);
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:27,代碼來源:AbstractBatchEventProcessor.java

示例3: onStreamTermination

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
public BatchResponse onStreamTermination(BatchSource source)
		throws EventException {
	String topic = source.getTopic();
	int partition = (Integer) source.getPartition();

	if (LOGGER.isLoggable(Level.INFO)) {
		LOGGER.log(Level.INFO, MessageFormat.format(
				"topic {0} partition {1} to be committed by upstream.",
				topic, partition));
	}

	PartitionKey key = new PartitionKey(topic, partition);
	PartitionProcessor writer = partitionProcMap.get(key);
	if (writer != null) {
		BatchResponse res = writer.handleStreamTermination();
		writer.close();
		partitionProcMap.remove(key);
		return res;
	} else {
		return BatchResponse.advanceAndGetNextBatch();
	}
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:24,代碼來源:HdfsBatchProcessor.java

示例4: openForRead

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
public void openForRead() throws EventException {
	if (m_br != null) {
		LOGGER.info( "try to open an event file " + m_address.getPathname() + " which was open", "OpenFileTwice");
		return;  /* open already */
	}
	File f = new File(ConfigUtils.getInitialPropertyExpanded(m_address.getPathname()));
	
	if (!f.isFile() || !f.canRead()) {
		throw new EventException("Filename=" + m_address.getPathname() + " is not a file or not readable");
	}
	try {
		m_br = new BufferedReader(new InputStreamReader(new FileInputStream(m_address.getPathname())));
	} catch (FileNotFoundException e) {
		throw new EventException("open file: " + m_address.getPathname(), e);
	}
	m_eof= false;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:18,代碼來源:InboundFileChannelHelper.java

示例5: open

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
public void open() throws EventException {
	//LOGGER.info( "Opening Inbound File Channel");
	logger.info( "Openning Inbound File Channel");
	/* put my name Event/FileChannel to the page */
	Management.addBean(getBeanName(), this);
    m_eventsReceivedPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
	m_eventsSentPerSec = new LongEWMACounter(60, MessageServiceTimer.sInstance().getTimer());
  

	/* open the event file, be ready for play*/
	try {
		m_fcHelper.openForRead();
	} catch (EventException ee) {
		//LOGGER.error( "InboundFileChannel open() get e=" + ee);
		logger.error( "--InboundFileChannel open() get e=" + ee);
  		/*** instead of forcing application to exit, we choose to post an error status at dashboard */
if (m_AlertListener != null) {
	m_AlertListener.sendAlert(getBeanName(),  "InboundFileChannel open() get e=" + ee, AlertListener.AlertStrength.RED);
} else {
	throw ee;
}
	
	}


}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:27,代碼來源:InboundFileChannel.java

示例6: resume

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
@ManagedOperation
public void resume() throws EventException {
	if (!m_isPaused.get()) {
		logger.error( "InboundFileChannel " + getBeanName()
				+ " could not be resumed. It is already in resume state", "InboundFileChannel" + ".pause()");
		return;
	}

	// if we are in paused state then first empty the pause Cache which could have received events
	// that were in the pipeline when we unsubscribed in response to a pause.
	if (m_isPaused.get() && !m_shutdownStatus.get()) {

		m_isPaused.set(false);
		if (m_resumeCount.addAndGet(1) < 0) {
			m_resumeCount.set(0);
		}
		
		/* resume by interrupt the thread from "sleep()" */
		m_pt.interrupt();
	}

}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:24,代碼來源:InboundFileChannel.java

示例7: openForWrite

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
/***
 * open the file with appending mode. if the file exists already, a warning log is issued.
 * if failed to create or open the file, a error log is issued.
 */
public void openForWrite() throws EventException {
	File f = new File(ConfigUtils.getInitialPropertyExpanded(m_address.getPathname()));
	try  {
		if (!f.exists()) {
			f.createNewFile();
		} else {
			LOGGER.info( "appending to file=" + m_address.getPathname());
		}
	} catch (IOException ioe) {
		throw new EventException("failed to create file=" + m_address.getPathname() + ", e=" + ioe);
		
	}
	try  {
		/*** append mode ***/
		m_fos = new FileOutputStream(f, true);
	} catch (FileNotFoundException fnfe) {
		throw new EventException("failed to open file=" + m_address.getPathname() + ", e=" + fnfe);
	}

}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:25,代碼來源:OutboundFileChannelHelper.java

示例8: pause

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
@ManagedOperation
public void pause() throws EventException {
	if (isPaused()) {
		LOGGER.warn( "InboundMessagingChannel "
				+ getBeanName()
				+ " could not be paused. It is already in paused state",
				"InboundMessagingChannel" + ".pause()");
		return;
	}

	notifyProducer(Signal.PAUSE);
	
	changeState(ChannelOperationState.PAUSE);

}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:17,代碼來源:InboundMessagingChannel.java

示例9: notifyProducer

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
void notifyProducer(Signal signal) {
      List<JetstreamTopic> channelTopics = m_address
		.getChannelJetstreamTopics();

for (JetstreamTopic topic : channelTopics) {
	try {
	    if (Signal.PAUSE.equals(signal)) {
	        MessageService.getInstance().pause(topic);
	    } else {
	        MessageService.getInstance().resume(topic);
	    }
	} catch (Throwable e) {
		registerError(e);
		throw new EventException(e.getMessage());
	}
}

if (Signal.PAUSE.equals(signal)) {
    postAlert(this.getBeanName() + " is being paused ", AlertStrength.RED);

    LOGGER.warn( " Inbound Messaging Channel paused.");
} else {
    postAlert(getBeanName() + " is being resumed", AlertStrength.YELLOW);
       LOGGER.warn( "Resuming Inbound Messaging Channel");
}
  }
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:27,代碼來源:InboundMessagingChannel.java

示例10: pause

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
@ManagedOperation
public void pause() throws EventException {
	if (isPaused()) {
		LOGGER.error( "InboundMessagingChannel " + getBeanName()
				+ " could not be paused. It is already in paused state", "InboundMessagingChannel" + ".pause()");
		return;
	}

	changeState(ChannelOperationState.PAUSE);
	
	m_server.shutDown();
	
	LOGGER.error( " Inbound Messaging Channel paused.");

}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:17,代碼來源:InboundRESTChannel.java

示例11: sendEvent

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
public void sendEvent(JetstreamEvent event) throws EventException {
    if (disabled) {
        return;
    }
    incrementEventRecievedCounter();
    if (shutdownFlag.get()) {
        incrementEventDroppedCounter();
        return;
    }
    
    if (processor == null) {
        realSendEvent(event);
    } else {
        boolean success = processor.processRequest(new SendEventTask(event));
        if (!success) {
            dropBySerializationQueueFull.increment();
            incrementEventDroppedCounter();
        }
    }
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:22,代碼來源:OutboundKafkaChannel.java

示例12: sendEvent

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
public void sendEvent(JetstreamEvent event) throws EventException {
  count++;
  Integer id = (Integer) event.get("id");
  if (id != null) {
    ids.add(id);
  }
  testLogger.debug("id " + id);

}
 
開發者ID:pulsarIO,項目名稱:jetstream-esper,代碼行數:10,代碼來源:ESPTestSink.java

示例13: setUp

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
  m_eventProcessor = (EsperProcessor)s_springConfiguration.getBean("ESPTestProcessorXYZ");
  m_eventProcessor.addEventSink(new EventSink() {
    public String getBeanName() {
      // TODO Auto-generated method stub
      return null;
    }

    public void sendEvent(JetstreamEvent event) throws EventException {
      System.out.println("Receive event " + event); //KEEPME
    }
  });
}
 
開發者ID:pulsarIO,項目名稱:jetstream-esper,代碼行數:15,代碼來源:ESPEventProcessorTest.java

示例14: sendEvent

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
public void sendEvent(JetstreamEvent event) throws EventException {
	try{
		System.out.println("Event : " + event.toString());
		assertEquals("ESPTestEvent1", event.getEventType());
		assertEquals("sample/topic", event.getForwardingTopics()[0]);
		assertTrue(event.containsKey(JetstreamReservedKeys.MessageAffinityKey.toString()));
		assertTrue(Boolean.valueOf((String)event.getMetaData(JetstreamReservedKeys.EventBroadCast.toString())));
	}catch(Throwable t ){
		assertFailure = true;
		t.printStackTrace();
	}
	
}
 
開發者ID:pulsarIO,項目名稱:jetstream-esper,代碼行數:15,代碼來源:TestCustomAnnotation.java

示例15: sendEvent

import com.ebay.jetstream.event.EventException; //導入依賴的package包/類
@Override
public void sendEvent(JetstreamEvent event) throws EventException {
    lastEvent = event;
    super.incrementEventRecievedCounter();
    System.out.println(event);
    super.fireSendEvent(event);
    super.incrementEventSentCounter();
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:9,代碼來源:SampleProcessor.java


注:本文中的com.ebay.jetstream.event.EventException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。