void push(Event event) { String repositoryName = event.getContext().getRepositoryName(); if (!byRepository.containsKey(repositoryName)) { byRepository.put(repositoryName, new EventBundleImpl()); } byRepository.get(repositoryName).push(event); }
EventBundleImpl b = new EventBundleImpl(); b.push(shallowEvent); fireEventBundle(b); } else {
public void run(final List<EventListenerDescriptor> listeners, EventBundle bundle) { // EventBundle that have gone through bus have been serialized // we need to reconnect them before filtering // this means we need a valid transaction ! if (!(bundle instanceof ReconnectedEventBundleImpl)) { scheduleListeners(listeners, bundle); } else { final EventBundle tmpBundle = bundle; TransactionHelper.runInTransaction(() -> { EventBundle connectedBundle = new EventBundleImpl(); Map<String, CoreSession> sessions = new HashMap<>(); List<Event> events = ((ReconnectedEventBundleImpl)tmpBundle).getReconnectedEvents(); for (Event event : events) { connectedBundle.push(event); CoreSession session = event.getContext().getCoreSession(); if (!(sessions.keySet().contains(session.getRepositoryName()))) { sessions.put(session.getRepositoryName(), session); } } for (CoreSession session : sessions.values()) { ((CloseableCoreSession) session).close(); } scheduleListeners(listeners, connectedBundle); }); } }
/** * Filters the event bundle to only keep events of interest to this listener. * * @since 5.7 */ public EventBundle filterBundle(EventBundle bundle) { EventBundle filtered = new EventBundleImpl(); for (Event event : bundle) { if (!acceptEvent(event.getName())) { continue; } PostCommitEventListener pcl = asPostCommitListener(); if (pcl instanceof PostCommitFilteringEventListener && !((PostCommitFilteringEventListener) pcl).acceptEvent(event)) { continue; } filtered.push(event); } return filtered; }