protected static JSONObject metricConfig = JSONObject.fromObject(MessageUtils.readJSONFromClasspath("/metricConfig.json"));
public static MessageTransformerResult transformMessage(Event event, MessageType sobaMessageType,
SobaMessageDetails messageDetails, Properties messageProperties) {
MessageTransformer messageTransformer;
switch (sobaMessageType) {
case CONNECTION:
messageTransformer = new ConnectionMessageTransformer(messageProperties, messageDetails);
break;
case INVENTORY_ITEM:
messageTransformer = new InventoryItemMessageTransformer(messageProperties, messageDetails);
break;
case AGENT:
messageTransformer = new AgentMessageTransformer(messageProperties, messageDetails);
break;
case USER:
messageTransformer = new UserMessageTransformer(messageProperties, messageDetails);
break;
case SYSTEM:
messageTransformer = new SystemMessageTransformer(messageProperties, messageDetails);
break;
case ACTIVITY:
messageTransformer = new ItemActivityMessageTransformer(messageProperties, messageDetails);
break;
case NODEBELLY:
messageTransformer = new NodebellyMessageTransformer(messageProperties, messageDetails, metricConfig);
break;
default:
messageTransformer = new SobaMessageTransformer(messageProperties, messageDetails);
break;
}
String msg = messageTransformer.doTransform(event);
SobaMessageDetails sobaMessageDetails = messageTransformer.getDetails();
logger.debug("[MESSAGE TRANSFORMATION FACTORY] Message to send as payload for : " + sobaMessageType + " : " + msg);
return new MessageTransformerResult(msg,sobaMessageDetails);
}