Package com.streamreduce.core.transformer.message

Examples of com.streamreduce.core.transformer.message.MessageTransformer


    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);
    }
View Full Code Here

TOP

Related Classes of com.streamreduce.core.transformer.message.MessageTransformer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.