当前位置: 首页>>代码示例>>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;未经允许,请勿转载。