@Override public void post(final BusEvent event) throws EventBusException { try { if (isStarted.get()) { final String json = objectMapper.writeValueAsString(event); final BusEventModelDao entry = new BusEventModelDao(Hostname.get(), clock.getUTCNow(), event.getClass().getName(), json, event.getUserToken(), event.getSearchKey1(), event.getSearchKey2()); dao.insertEntry(entry); } else { log.warn("Attempting to post event " + event + " in a non initialized bus"); } } catch (Exception e) { log.error("Failed to post BusEvent " + event, e); } }
private void insertBusEventIntoNotificationQueue(final UUID accountId, final BusEvent event, final OverdueAsyncBusNotificationAction action) { final OverdueAsyncBusNotificationKey notificationKey = new OverdueAsyncBusNotificationKey(accountId, action); asyncPoster.insertOverdueNotification(accountId, clock.getUTCNow(), OverdueAsyncBusNotifier.OVERDUE_ASYNC_BUS_NOTIFIER_QUEUE, notificationKey, createCallContext(event.getUserToken(), event.getSearchKey1(), event.getSearchKey2())); }
@Override public void postFromTransaction(final BusEvent event, final Transmogrifier transmogrifier) throws EventBusException { try { final PersistentBusSqlDao transactional = transmogrifier.become(PersistentBusSqlDao.class); if (isStarted.get()) { final String json = objectMapper.writeValueAsString(event); final BusEventModelDao entry = new BusEventModelDao(Hostname.get(), clock.getUTCNow(), event.getClass().getName(), json, event.getUserToken(), event.getSearchKey1(), event.getSearchKey2()); dao.insertEntryFromTransaction(transactional, entry); } else { log.warn("Attempting to post event " + event + " in a non initialized bus"); } } catch (Exception e) { log.error("Failed to post BusEvent " + event, e); } } }