fixed few issues after testing analytics

revert-dabc3590
ayyoob 8 years ago
parent 4c0e505008
commit 155135a70d

@ -425,23 +425,36 @@ public class WebsocketEventAdapter implements OutputEventAdapter {
// fetch the different attribute values received as part of the current event. // fetch the different attribute values received as part of the current event.
Set<String> queryParams = queryParamValuePairs.keySet(); Set<String> queryParams = queryParamValuePairs.keySet();
for (String aQueryParam : queryParams) { for (String aQueryParam : queryParams) {
if (!aQueryParam.equalsIgnoreCase(WebsocketConstants.TOKEN_PARAM)) { try {
try {
String queryValue = queryParamValuePairs.get(aQueryParam); String queryValue = queryParamValuePairs.get(aQueryParam);
if (queryValue != null && !queryValue.trim().isEmpty()) { if (queryValue != null && !queryValue.trim().isEmpty()) {
JSONObject jsonObject = new JSONObject(jsonMessage); JSONObject jsonObject = new JSONObject(jsonMessage);
String eventValue = jsonObject.getString(aQueryParam); JSONObject event = jsonObject.getJSONObject(WebsocketConstants.EVENT);
if (eventValue == null || !eventValue.equalsIgnoreCase(queryValue)) { JSONObject data;
return false; if (!event.isNull(WebsocketConstants.META_DATA)) {
data = event.getJSONObject(WebsocketConstants.META_DATA);
if (!data.isNull(aQueryParam)) {
String eventValue = data.get(aQueryParam).toString();
if (eventValue == null || !eventValue.equalsIgnoreCase(queryValue)) {
return false;
}
} }
} }
} catch (JSONException e) {
if (log.isDebugEnabled()) { if (!event.isNull(WebsocketConstants.PAYLOAD_DATA)) {
log.debug("Unable validate the stream filter properties for event : " + jsonMessage data = event.getJSONObject(WebsocketConstants.PAYLOAD_DATA);
+ " ", e); if (!data.isNull(aQueryParam)) {
String eventValue = data.get(aQueryParam).toString();
if (eventValue == null || !eventValue.equalsIgnoreCase(queryValue)) {
return false;
}
}
} }
return false;
} }
} catch (JSONException e) {
//do nothing - This exception is thrown when the event does not have query parameter.
} }
} }
} }

@ -34,4 +34,7 @@ public class WebsocketConstants {
public static final String USERNAME = "username"; public static final String USERNAME = "username";
public static final String PASSWORD = "password"; public static final String PASSWORD = "password";
public static final String TOKEN_PARAM = "token"; public static final String TOKEN_PARAM = "token";
public static final String META_DATA = "metaData";
public static final String PAYLOAD_DATA = "payloadData";
public static final String EVENT = "event";
} }

Loading…
Cancel
Save