use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class RedisMessageReceiver method receiveMessage.
@Override
public void receiveMessage(String message) {
try {
EventMessage eventMessage = mapper.readValue(message, EventMessageImpl.class);
asyncService.executeAsync(eventMessage);
} catch (IOException e) {
logger.error("Failed prase message ", e);
}
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class JobsController method generateTempHumidityMapping.
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value = "/temphumiditymapping/fullsync/{fullsync}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void generateTempHumidityMapping(@PathVariable boolean fullsync) {
try {
String command = fullsync ? EventMessageUtil.FullSyncTemperatureAndHumiditySensors : EventMessageUtil.SyncTemperatureAndHumiditySensors;
EventMessage eventMessage = EventMessageUtil.createEventMessage(EventType.Aggregator, command, "");
String message = EventMessageUtil.convertEventMessageAsString(eventMessage);
publisher.publish(EventMessageUtil.AggregatorTopic, message);
} catch (IOException e) {
log.error("Failed to create event message", e);
throw new WormholeRequestException("Failed to create event message");
}
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class JobsController method syncHostnameByIp.
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value = "/synchostnamebyip/{ip:.+}", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void syncHostnameByIp(@PathVariable("ip") String ip) {
if (IPAddressUtil.isValidIp(ip)) {
EventMessage eventMessage = EventMessageUtil.createEventMessage(EventType.InfoBlox, null, ip);
try {
String message = EventMessageUtil.convertEventMessageAsString(eventMessage);
publisher.publish(EventMessageUtil.InfobloxTopic, message);
} catch (IOException e) {
log.error("Failed to create event message", e);
throw new WormholeRequestException("Failed to create event message for query hostname.");
}
} else {
throw new WormholeRequestException(String.format("Invalid Ip: %s", ip));
}
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class JobsController method generateServerPDUMapping.
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value = "/pduservermapping", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void generateServerPDUMapping() {
try {
EventMessage eventMessage = EventMessageUtil.createEventMessage(EventType.Aggregator, EventMessageUtil.PDUServerMappingCommand, "");
String message = EventMessageUtil.convertEventMessageAsString(eventMessage);
publisher.publish(EventMessageUtil.AggregatorTopic, message);
} catch (IOException e) {
log.error("Failed to create event message", e);
throw new WormholeRequestException("Failed to create event message");
}
}
use of com.vmware.flowgate.common.model.redis.message.EventMessage in project flowgate by vmware.
the class MessageProcessingTest method testVC.
@Test
public void testVC() throws Exception {
ObjectMapper mapper = new ObjectMapper();
SDDCSoftwareConfig vc = new SDDCSoftwareConfig();
vc.setDescription("good vc");
vc.setName("Test VC");
vc.setServerURL("10.10.10.10");
vc.setPassword("fake password");
vc.setType(SoftwareType.VCENTER);
String payload = mapper.writeValueAsString(vc);
// EventMessage message =
// EventMessageUtil.createEventMessage(EventType.VCenter, EventMessageUtil.VCENTER_SyncCustomerAttrs, payload);
EventMessage message = EventMessageUtil.createEventMessage(EventType.VCenter, EventMessageUtil.VCENTER_SyncData, "");
System.out.println(mapper.writeValueAsString(message));
}
Aggregations