Search in sources :

Example 11 with Message

use of com.creditease.uav.messaging.api.Message in project uavstack by uavorg.

the class NotificationEventPublishHandler method handle.

@Override
public void handle(List<NotificationEvent> data) {
    MessageProducer producer = (MessageProducer) this.getComponentResource("messageproducer", "MessageProducerResourceComponent");
    String notifyKey = MonitorDataFrame.MessageType.Notification.toString();
    Message msg = MessagingFactory.createMessage(notifyKey);
    String stream = toJSONString(data);
    msg.setParam(notifyKey, stream);
    boolean check = producer.submit(msg);
    String sendState = notifyKey + " Data Sent " + (check ? "SUCCESS" : "FAIL");
    if (log.isTraceEnable()) {
        log.info(this, sendState + "	" + stream);
    }
}
Also used : Message(com.creditease.uav.messaging.api.Message) MessageProducer(com.creditease.uav.messaging.api.MessageProducer)

Aggregations

Message (com.creditease.uav.messaging.api.Message)11 MessageProducer (com.creditease.uav.messaging.api.MessageProducer)11 AgentResourceComponent (com.creditease.agent.spi.AgentResourceComponent)4 HashMap (java.util.HashMap)2 MonitorDataFrame (com.creditease.agent.monitor.api.MonitorDataFrame)1 AgentFeatureComponent (com.creditease.agent.spi.AgentFeatureComponent)1 Map (java.util.Map)1