当前位置: 首页>>代码示例>>Java>>正文


Java RetryEventCode类代码示例

本文整理汇总了Java中com.ebay.jetstream.event.RetryEventCode的典型用法代码示例。如果您正苦于以下问题:Java RetryEventCode类的具体用法?Java RetryEventCode怎么用?Java RetryEventCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RetryEventCode类属于com.ebay.jetstream.event包,在下文中一共展示了RetryEventCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendToAdviceListener

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
private void sendToAdviceListener(JetstreamEvent event, RetryEventCode code, String msg) {
	try {
		if (m_adviceListener != null) {
			if (event.containsKey(JetstreamReservedKeys.RetryCount.toString())) {
				Integer retryCount = (Integer) event.get(JetstreamReservedKeys.RetryCount.toString());
				if (retryCount > 3) {
					LOGGER.info( "Unable to deliver this event so dropping it.." + event.getEventId());
					incrementEventDroppedCounter();
					return;
				}
			}
			m_adviceListener.retry(event, code, msg);
			m_eventSentToAdviceListener.increment();
		}
	}
	catch (Throwable e) {
		m_errors.registerError(e);
		LOGGER.error( e.getLocalizedMessage(), e);
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:21,代码来源:OutboundRESTChannel.java

示例2: sendToAdviceListener

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
/**
 * @param event
 * @param code
 * @param msg
 */
private void sendToAdviceListener(JetstreamEvent event, RetryEventCode code, String msg) {
	try {
		if (getAdviceListener() != null) {
			if (event.containsKey(JetstreamReservedKeys.RetryCount.toString())) {
				Integer retryCount = (Integer) event.get(JetstreamReservedKeys.RetryCount.toString());
				if (retryCount > getRetryCount()) {
					LOGGER.info( "Unable to deliver this event so dropping it.." + event.getEventId());
					m_totalEventsDropped.increment();
					return;
				}
			}
			getAdviceListener().retry(event, code, msg);
			incrementAdviceListenerCount();
		}
	}
	catch (Throwable e) {
		m_errors.registerError(e);
		LOGGER.debug( e.getLocalizedMessage());
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:26,代码来源:OutboundMessagingChannel.java

示例3: execute

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
private void execute(BoundStatement q, JetstreamEvent event) {
    try {
        ResultSetFuture future = cassandraSession.executeAsync(q);
        CallBackListener listener = new CallBackListener(future, event);
        future.addListener(listener, pool);
        pendingRequestCounter.incrementAndGet();
    } catch (Throwable ex) {
        LOGGER.error(
                "Error publising metrics in MetricCassandraCollector:"
                        + ex.getMessage());
        cassandraErrorCount.increment();
        if (event.get(JetstreamReservedKeys.MessageAffinityKey.toString()) == null) {
            event.put(JetstreamReservedKeys.MessageAffinityKey.toString(),
                    (String) event.get(MCConstant.METRIC_NAME));
        }
        getAdviceListener().retry(event, RetryEventCode.MSG_RETRY,
                ex.getMessage());
        eventSentToAdviceListener.increment();
        registerError(ex);
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:22,代码来源:MetricCassandraCollector.java

示例4: run

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
@Override
public void run() {
    pendingRequestCounter.decrementAndGet();
    try {
        future.getUninterruptibly();
    } catch (DriverException e) {
        cassandraErrorCount.increment();
        if (event != null) {
            if (event.get(JetstreamReservedKeys.MessageAffinityKey
                    .toString()) == null) {
                event.put(JetstreamReservedKeys.MessageAffinityKey
                        .toString(), (String) event
                        .get(MCConstant.METRIC_NAME));
            }
            getAdviceListener().retry(event, RetryEventCode.MSG_RETRY,
                    e.getMessage());
            eventSentToAdviceListener.increment();
        }
        registerError(e);
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:22,代码来源:MetricCassandraCollector.java

示例5: testExceptionHandlerWithAdviceLr

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
@Test
public void testExceptionHandlerWithAdviceLr(){
 
 processor.getEsperExceptionHandler().clearAlertStatus(); // This is needed , since previous testcases might have set the alert status.
 
 Advice mockListner = mock(Advice.class);
 processor.setAdviceListener(mockListner);
 
 assertNotNull(processor.getEsperExceptionHandler());
 assertNotNull(processor.getAdviceListener());
 
 JetstreamEvent event = createBadEvent();
 sendBadEvent(event);
 try {
	Thread.sleep(10000); // sleep for exception wait time window 
} catch (InterruptedException e) {
	e.printStackTrace();
}
sendBadEvent(event);
sendBadEvent(event);
  
 assertNotNull(processor.getEsperExceptionHandler().getLastException());
 
 //verify AdviseListener is called atleast once to post the msg
 verify(mockListner, atLeastOnce()).retry(event, RetryEventCode.MSG_RETRY, processor.getEsperExceptionHandler().getLastException());
 verify(mockListner, atLeastOnce()).stopReplay();
 
}
 
开发者ID:pulsarIO,项目名称:jetstream-esper,代码行数:29,代码来源:EsperProcessorTest.java

示例6: queueEvent

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
protected void queueEvent(EventProcessRequest eventRequest) throws EventException {
	
	long nQueueSize = m_workQueue.getPendingRequests();
	boolean bQueued = nQueueSize < getMaxWorkQueueSize();
	if (bQueued) {
		bQueued = m_workQueue.processRequest(eventRequest);
		if (bQueued && ++nQueueSize > m_highWater.get())
			m_highWater.set(nQueueSize);
	}
	
	if (!bQueued) {
		if (logger.isDebugEnabled())
			logger.debug( "Failed to offer event to queue, current size: " + m_workQueue.getPendingRequests());
		
		JetstreamEvent event = eventRequest.getEvent();
		if (event instanceof ShutdownJetstreamEvent == false) {
			// This check is mandatory. Or else we will ending up retrying a shutdhown jetstream event
			if (getAdviceListener() != null)
				sendToAdviceListener(event, RetryEventCode.QUEUE_FULL, " Queue is full");
			else {
				incrementEventDroppedCounter();
				pausePublisher(getBeanName() + " has reached upper limit " + m_workQueue.getPendingRequests()
						+ " and tried to pause publisher.");
			}
		}
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:28,代码来源:AbstractQueuedEventProcessor.java

示例7: afterPropertiesSet

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
    for (RetryEventCode v : RetryEventCode.values()) {
        m_counters.put(v, new LongCounter());
    }
    Management.addBean(getBeanName(), this);
    m_messageService = MessageService.getInstance();
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:9,代码来源:AdviceProcessor.java

示例8: retry

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
@Override
public void retry(JetstreamEvent event, RetryEventCode reasonCode, String reason) {
    // If retryEventCodes is null, retry all.
    if (m_retryEventCodes != null && !m_retryEventCodes.contains(reasonCode)) {
        super.incrementEventDroppedCounter();
        return;
    }

    m_counters.get(reasonCode).increment();

    sendEvent(event);
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:13,代码来源:AdviceProcessor.java

示例9: sendToAdviceListener

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
private void sendToAdviceListener(JetstreamEvent event,
		RetryEventCode code, String msg) {
	if (m_adviceListener != null) {
		m_adviceListener.retry(event, code, msg);
		incrementAdviceListenerCount();
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:8,代码来源:InboundMessagingChannel.java

示例10: shutDown

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
@Override
public void shutDown() {
	m_shutdownStatus.set(true);
	if (m_eventsReceivedPerSec != null)
		m_eventsReceivedPerSec.destroy();
	close();
	if (m_pauseCache != null) {
		JetstreamEvent event = null;
		while (!m_pauseCache.isEmpty()) {
			event = m_pauseCache.poll();
			try {
				super.fireSendEvent(event);
				setLastEvent(event);
				incrementEventSentCounter();
			}
			catch (EventException exception) {
				registerError(exception);
				sendToAdviceListener(event, RetryEventCode.PAUSE_RETRY, exception.getMessage());
			}
			catch (Throwable t) {
				registerError(t);
				LOGGER.error( t.getLocalizedMessage());
			}
			m_shutDownEventsSent++;
		}
	}
       LOGGER.warn( 
               m_shutDownEventsSent
                       + " events drained from its queue due to graceful shutdown - final events sent = " + getTotalEventsSent() +
                       "final total events dropped =" + getTotalEventsDropped() +
                       "final total events received =" + getTotalEventsReceived()); 
               

}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:35,代码来源:InboundRESTChannel.java

示例11: sendEvent

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
@Override
public void sendEvent(JetstreamEvent inputEevent) throws EventException {
    // If remote store failed, just ignore and use local cache.
    // Exception will be captured on messaging layer, suppose no exception
    // throw on this code.

    if (isPaused() || shutdownFlag.get()) {
        super.incrementEventDroppedCounter();
        return;
    }

    JetstreamEvent event = inputEevent;
    boolean isRawEvent = !interEventTypes.contains(event.getEventType());
    String ak = (String) event.get(AFFINITY_KEY);
    if (ak == null) {
        ak = "";
    }

    int queueIndex = getQueueIndex(ak);
    if (isRawEvent) {
        super.incrementEventRecievedCounter();
        try {
            event = event.clone();
        } catch (CloneNotSupportedException e) {
            //do nothing
        }
    }

    if (!requestQueues[queueIndex].offer(event)) {
        queueFullCounter.incrementAndGet();
        if (isRawEvent && this.getAdviceListener() != null) {
            this.getAdviceListener().retry(event,  RetryEventCode.MSG_RETRY, "Fail to enqueue event");
        } else {
            super.incrementEventDroppedCounter();
        }
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:38,代码来源:SessionizerProcessor.java

示例12: sendEvent

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
@Override
public void sendEvent(JetstreamEvent event) throws EventException {
    if (isPaused() || shutdownFlag.get()) {
        super.incrementEventDroppedCounter();
        return;
    }
    if (MCCounterHelper.isGroupByCounterEvent(event)) {
        if (!connected.get()) {
            if (config.getEnableCassandra()) {
                if (event.get(JetstreamReservedKeys.MessageAffinityKey
                        .toString()) == null) {
                    event.put(JetstreamReservedKeys.MessageAffinityKey
                            .toString(), (String) event
                            .get(MCConstant.METRIC_NAME));
                }
                getAdviceListener().retry(event, RetryEventCode.MSG_RETRY,
                        "Cassandra Down");
                eventSentToAdviceListener.increment();
            } else {
                super.incrementEventDroppedCounter();
            }
            return;
        }
        incrementEventRecievedCounter();
        m_lastEvent = event;
        publishAsync(event);
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:29,代码来源:MetricCassandraCollector.java

示例13: sendToRetryQueue

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
private void sendToRetryQueue(JetstreamEvent event) {
	m_adviceListener.retry(event, RetryEventCode.PAUSE_RETRY, this.getClass().getSimpleName() + " IS PAUSED");
	incrementEventSentToAdviceListener();
}
 
开发者ID:pulsarIO,项目名称:jetstream-esper,代码行数:5,代码来源:EsperEventListener.java

示例14: queueEvent

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
/**
 * - When Exception reaches beyond threshold, don't submit event to queue. Drop the event.
 */
protected void queueEvent(JetstreamEvent event) throws EventException {
	
	if (getEsperExceptionHandler() != null) {
		if (getEsperExceptionHandler().IsInException()) {

			if (!getEsperExceptionHandler().isAlertPosted()) {
				postAlert(getEsperExceptionHandler().getLastException(),
						AlertStrength.RED);
				getEsperExceptionHandler().setAlertPostedStatus(true);
				if (logger.isDebugEnabled())
						logger
						.debug( 
								"Esper Exception threshold reached...Sending Alert..");
								
					
				// if we have an advice listener we will advice them to stop replay
				// they will be adviced to start replay when new EPL is deployed

				if(getAdviceListener() != null)
					getAdviceListener().stopReplay();
			} 
				
			if(getAdviceListener() != null){
					getAdviceListener().retry(event, RetryEventCode.MSG_RETRY,getEsperExceptionHandler().getLastException());
					
			}else{
				//AdviseListener not available. no further submission to engine... drop it..
				if (logger.isDebugEnabled())
					logger.debug( 
							"Esper Exception threshold reached...Dropping events");
				incrementEventDroppedCounter();
			}	
		} else {
			queueEventInternal(event);
		}
	} else {
		queueEventInternal(event);
	}

}
 
开发者ID:pulsarIO,项目名称:jetstream-esper,代码行数:44,代码来源:EsperProcessor.java

示例15: retry

import com.ebay.jetstream.event.RetryEventCode; //导入依赖的package包/类
public void retry(JetstreamEvent event, RetryEventCode reasonCode, String reason) {
LOGGER.info("********** Retry Event - " + event.toString() + " --- reasonCode = " + reasonCode.name()
     + " --- reason = " + reason); //KEEPME
 
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:6,代码来源:DefaultAdviceImpl.java


注:本文中的com.ebay.jetstream.event.RetryEventCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。