/** * @param pathEvent */ /*@Subscribe public void recordEvent(PathEvent pathEvent) { if (pathEvent == null) return; if (pathEvent.getPath() == null) return; //if (logger.isTraceEnabled())logger.trace(this.wsSession + " received event " + pathEvent.getPath()); if(logger.isDebugEnabled())logger.debug(this.wsSession + " received event " + pathEvent.getPath()); // do we care? for (Subscription s : manager.getSubscriptions(wsSession)) { if (s.isActive() && !POLICY_FIXED.equals(s.getPolicy()) && s.isSubscribed(pathEvent.getPath())) { if(logger.isDebugEnabled())logger.debug("Adding to send queue : "+pathEvent.getPath()); queue.add(pathEvent.getPath()); sender.startSender(); break; } } }*/ @Subscribe public void recordEvent(DeadEvent e) { logger.debug("Received dead event" + e.getSource()); }
/** * Posts an event to all registered handlers. This method will return * successfully after the event has been posted to all handlers, and * regardless of any exceptions thrown by handlers. * * <p> * If no handlers have been subscribed for {@code event}'s class, and {@code event} is not already a {@link DeadEvent}, it will be wrapped in a DeadEvent * and reposted. * * @param event * event to post. */ public void post(Object event) { Set<Class<?>> dispatchTypes = flattenHierarchy(event.getClass()); boolean dispatched = false; for (Class<?> eventType : dispatchTypes) { Set<EventHandler> wrappers = getHandlersForEventType(eventType); if (wrappers != null && !wrappers.isEmpty()) { dispatched = true; for (EventHandler wrapper : wrappers) { enqueueEvent(event, wrapper); } } } if (!dispatched && !(event instanceof DeadEvent)) { post(new DeadEvent(this, event)); } dispatchQueuedEvents(); }
@Test public void shouldForwardMessageToCamel() throws InterruptedException { // Given Date message = new Date(); // When eventBus.post(message); // Then getMockEndpoint("mock:customListenerEvents").setExpectedMessageCount(0); assertMockEndpointsSatisfied(); getMockEndpoint("mock:deadEvents").setExpectedMessageCount(1); assertMockEndpointsSatisfied(); assertEquals(message, getMockEndpoint("mock:deadEvents").getExchanges().get(0).getIn().getBody(DeadEvent.class).getEvent()); }
@Subscribe @AllowConcurrentEvents public void onDeadEvent(final DeadEvent deadEvent) { final Object event = deadEvent.getEvent(); if (event instanceof IEvent) { final IEvent eventInterface = (IEvent) event; eventInterface.getEndpoint().emit("dead event", "\"" + eventInterface + "\""); } else System.out.println(deadEvent.getEvent()); }
@SuppressWarnings("rawtypes") @Subscribe public void onDeadEvent(final DeadEvent event) { if (event.getEvent() instanceof ExceptionEvent) { final ExceptionEvent e = (ExceptionEvent) event.getEvent(); ((Log) Loggers.from(e.source().getClass())).error(String .format("Unhandled ExceptionEvent on %s", wrapObj(e.source())), e.exception()); } }
@Subscribe public void deadEvent(DeadEvent event) { System.out.println("Dead Event"); System.out.println(event.getEvent()); }
@Subscribe public void logDeadEvent(DeadEvent event) { log.warn(String.format(DEAD_EVENT_MESSAGE, event.getEvent())); }
@Subscribe public void listen(DeadEvent event) { notDelivered = true; }
@Subscribe public void handleDeadEvent(DeadEvent deadEvent) { System.out.println("dead event: " + deadEvent.getSource().toString()); }
@Subscribe void deadEventReceived(DeadEvent deadEvent);
@Subscribe public void handleUnsubscribedEvent(DeadEvent deadEvent){ System.out.println("No subscribers for "+deadEvent.getEvent()); deadEvents.add(deadEvent); }
public List<DeadEvent> getDeadEvents() { return deadEvents; }
public void handleDeadEvent(DeadEvent event) { log.warn("Unhandled Event: ", event); }
@Subscribe public void handleUnsubscribedEvent(DeadEvent deadEvent) { log.warn("No subscribers for {}", deadEvent.getEvent()); }
@Subscribe public void handleDeadEvent(final DeadEvent deadEvent) { LOG.warn("Ooops, no listener found for this event: {}", deadEvent.getEvent()); latch.countDown(); }
@Subscribe public void handleDeadEvent(DeadEvent deadEvent) { log.error("Event {} from source {} is not handled", deadEvent.getEvent(), deadEvent.getSource()); }
@Subscribe public void recordEvent(DeadEvent e) { logger.debug("Received dead event" + e.getSource()); }
@Subscribe public void handleDeadEvent(DeadEvent deadEvent) { logger.trace("detected dead event %s", deadEvent.getEvent()); }
@Subscribe public void onDeadObject(DeadEvent event) { logger.warn("Dead event: " + event.getEvent()); }
@Subscribe public void onDeadEvent(DeadEvent e) { if (VERBOSE) Log.i(TAG, "DeadEvent "); }
@Subscribe public void handleDeadEvent(DeadEvent deadEvent) { deadEvents.add(deadEvent); }
@Subscribe @AllowConcurrentEvents public void catchDeadEvent(DeadEvent e) { log.warn("检测到未处理的事件 event:{} source:{}", e.getEvent(), e.getSource()); }
@Subscribe @SuppressWarnings("unused") public void listen(DeadEvent event) { LOG.trace("No subscribers were interested in this event: " + event.getEvent()); }
/** * Listen to dead events and log them. * * @param event the dead event */ @Subscribe private void listen(DeadEvent event) { logger.error("Dead event ({}) pushed from ({})", event.getEvent(), event.getSource()); }
/** * Process every dead event. * * @param deadEvent Catchall event */ @Subscribe public void onDeadEvent(DeadEvent deadEvent) { log.error("Dead event catched: " + deadEvent.toString()); }