private JetstreamEvent createEvent(Map<String, Object> data, String eventType) { JetstreamEvent event = new JetstreamEvent(data); event.setEventType(eventType); return event; }
private JetstreamEvent createEvent(Session session, String type) { JetstreamEvent jsEvent = new JetstreamEvent(); jsEvent.setEventType(type); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_PAYLOAD, BinaryFormatSerializer.getInstance().getSessionPayload(session).array()); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_METADATA, BinaryFormatSerializer.getInstance().getSessionMetadata(session).array()); return jsEvent; }
@Override public void sendExpirationCheckEvent(String uid, String ak) { JetstreamEvent jsEvent = new JetstreamEvent(); int type = identifierType(uid); jsEvent.setEventType(Constants.EVENT_TYPE_SESSION_EXPIRED_EVENT); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_UNIQUEID, uid); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_TYPE, Integer.valueOf(type)); jsEvent.put(AFFINITY_KEY, ak); this.loopbackEventProducer.sendExpirationCheckEvent(jsEvent); }
@Override public void remoteSessionExpired(String uid, String ak, byte[] payload, byte[] metadata) { JetstreamEvent jsEvent = new JetstreamEvent(); int type = identifierType(uid); jsEvent.setEventType(Constants.EVENT_TYPE_SESSION_EXPIRED_EVENT); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_UNIQUEID, uid); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_TYPE, Integer.valueOf(type)); jsEvent.put(AFFINITY_KEY, ak); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_PAYLOAD, payload); jsEvent.put(Constants.EVENT_PAYLOAD_SESSION_METADATA, metadata); int queueIndex = getQueueIndex(ak); try { responseQueues[queueIndex].put(jsEvent); } catch (InterruptedException e) { responseQueueFullCounter.incrementAndGet(); } }
@Override public void remoteSessionLoaded(String uid, Session session, String ak) { JetstreamEvent event = new JetstreamEvent(); event.setEventType(Constants.EVENT_TYPE_SESSION_LOAD_EVENT); int type = identifierType(uid); event.put(Constants.EVENT_PAYLOAD_SESSION_UNIQUEID, uid); event.put(Constants.EVENT_PAYLOAD_SESSION_OBJ, session); event.put(Constants.EVENT_PAYLOAD_SESSION_TYPE, Integer.valueOf(type)); if (session != null) { session.setType(type); session.setIdentifier(identifierValue(uid)); } int queueIndex = getQueueIndex(ak); try { responseQueues[queueIndex].put(event); } catch (InterruptedException e) { responseQueueFullCounter.incrementAndGet(); } }
@Override public void onStatus(Status status) { HashtagEntity[] hashtagEntities = status.getHashtagEntities(); JetstreamEvent event = new JetstreamEvent(); event.setEventType("TwitterSample"); Place place = status.getPlace(); if (place != null) { event.put("country", place.getCountry()); } event.put("ct", status.getCreatedAt().getTime()); event.put("text", status.getText()); event.put("lang", status.getLang()); event.put("user", status.getUser().getName()); if (hashtagEntities != null && hashtagEntities.length > 0) { StringBuilder s = new StringBuilder(); s.append(hashtagEntities[0].getText()); for (int i = 1; i < hashtagEntities.length; i++) { s.append(","); s.append(hashtagEntities[i].getText()); } event.put("hashtag", s.toString()); } fireSendEvent(event); }
private void sessionBegin(Session session) { JetstreamEvent sessionBeginEvent = new JetstreamEvent(); sessionBeginEvent.setEventType(mainSessionProfile.getBeginMarker()); Map<String, Object> initialAttributes = session.getInitialAttributes(); if (initialAttributes != null) { sessionBeginEvent.putAll(initialAttributes); } if (mainSessionProfile.getSessionIdKey() != null) { sessionBeginEvent.put(mainSessionProfile.getSessionIdKey(), session.getSessionId()); } if (mainSessionProfile.getSessionStartTimestampKey() != null) { sessionBeginEvent.put(mainSessionProfile.getSessionStartTimestampKey(), session.getCreationTime()); } if (mainEsperSessionizer != null && mainEsperSessionizer.isEventSupported(sessionBeginEvent)) { mainEsperSessionizer.process(session, sessionBeginEvent); } eventSender.sendSessionBeginEvent(mainSessionProfile.getSessionType(), session, sessionBeginEvent); }
subSession.setSessionId(subSessionId); JetstreamEvent sessionEndEvent = new JetstreamEvent(); sessionEndEvent.setEventType(profile.getEndMarker());
sessionBeginEvent.setEventType(profile.getBeginMarker()); Map<String, Object> initialAttributes = subSession.getInitialAttributes(); if (initialAttributes != null) {
sessionEndEvent.setEventType(mainSessionProfile.getEndMarker()); Map<String, Object> initialAttributes = session.getInitialAttributes(); if (initialAttributes != null) {