use of com.vmware.flowgate.common.model.redis.message.EventUser in project flowgate by vmware.
the class NlyteDataService method executeAsync.
@Override
public void executeAsync(EventMessage message) {
if (message.getType() != EventType.Nlyte) {
logger.warn("Drop none Nlyte message " + message.getType());
return;
}
logger.info("message received");
Set<EventUser> users = message.getTarget().getUsers();
for (EventUser command : users) {
logger.info(command.getId());
switch(command.getId()) {
case EventMessageUtil.NLYTE_SyncData:
// it will sync all the data depend on the type in the nlyteJobList.
String messageString = null;
while ((messageString = template.opsForList().rightPop(EventMessageUtil.nlyteJobList)) != null) {
EventMessage payloadMessage = null;
try {
payloadMessage = mapper.readValue(messageString, EventMessageImpl.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (payloadMessage == null) {
continue;
}
FacilitySoftwareConfig nlyte = null;
try {
nlyte = mapper.readValue(payloadMessage.getContent(), FacilitySoftwareConfig.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (null == nlyte) {
continue;
}
if (!nlyte.checkIsActive()) {
continue;
}
for (EventUser payloadCommand : payloadMessage.getTarget().getUsers()) {
executeJob(payloadCommand.getId(), nlyte);
}
}
break;
default:
FacilitySoftwareConfig nlyteInfo = null;
try {
nlyteInfo = mapper.readValue(message.getContent(), FacilitySoftwareConfig.class);
} catch (IOException e) {
// TODO Auto-generated catch block
logger.info("Failed to convert message", e);
}
if (nlyteInfo != null) {
executeJob(EventMessageUtil.NLYTE_SyncMappedAssetData, nlyteInfo);
}
break;
}
}
}
use of com.vmware.flowgate.common.model.redis.message.EventUser in project flowgate by vmware.
the class OpenManageJobService method executeAsync.
@Override
public void executeAsync(EventMessage message) {
if (message.getType() != EventType.OpenManage) {
logger.warn("Drop non-OpenManage message " + message.getType());
return;
}
logger.info("message received");
String messageString = null;
while ((messageString = template.opsForList().rightPop(EventMessageUtil.OpenManageJobList)) != null) {
EventMessage payloadMessage = null;
try {
payloadMessage = mapper.readValue(messageString, EventMessageImpl.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (payloadMessage == null) {
continue;
}
FacilitySoftwareConfig integration = null;
try {
integration = mapper.readValue(payloadMessage.getContent(), FacilitySoftwareConfig.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (null == integration) {
continue;
}
if (!integration.checkIsActive()) {
continue;
}
for (EventUser payloadCommand : payloadMessage.getTarget().getUsers()) {
executeJob(payloadCommand.getId(), integration);
}
}
}
use of com.vmware.flowgate.common.model.redis.message.EventUser in project flowgate by vmware.
the class LabsdbService method executeAsync.
@Override
public void executeAsync(EventMessage message) {
// TODO Auto-generated method stub
if (message.getType() != EventType.Labsdb) {
logger.warn("Drop none Labsdb message " + message.getType());
return;
}
logger.info("message received");
Set<EventUser> users = message.getTarget().getUsers();
for (EventUser command : users) {
logger.info(command.getId());
switch(command.getId()) {
case EventMessageUtil.Labsdb_SyncData:
// it will sync all the data depend on the type in the labsdbJobList.
String messageString = null;
while ((messageString = template.opsForList().rightPop(EventMessageUtil.labsdbJobList)) != null) {
EventMessage payloadMessage = null;
try {
payloadMessage = mapper.readValue(messageString, EventMessageImpl.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (payloadMessage == null) {
continue;
}
FacilitySoftwareConfig labsdb = null;
try {
labsdb = mapper.readValue(payloadMessage.getContent(), FacilitySoftwareConfig.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (null == labsdb) {
continue;
}
if (!labsdb.checkIsActive()) {
continue;
}
for (EventUser payloadCommand : payloadMessage.getTarget().getUsers()) {
excuteJob(payloadCommand.getId(), labsdb);
}
}
break;
default:
FacilitySoftwareConfig labsdb = null;
try {
labsdb = mapper.readValue(message.getContent(), FacilitySoftwareConfig.class);
} catch (IOException e1) {
// TODO Auto-generated catch block
logger.error("Failed to convert message", e1);
}
if (labsdb != null) {
excuteJob(command.getId(), labsdb);
}
break;
}
}
}
use of com.vmware.flowgate.common.model.redis.message.EventUser in project flowgate by vmware.
the class AdapterJobService method executeAsync.
@Override
public void executeAsync(EventMessage message) {
// TODO Auto-generated method stub
logger.info("message received");
String messageString = null;
while ((messageString = template.opsForList().rightPop(queueName)) != null) {
EventMessage payloadMessage = null;
try {
payloadMessage = mapper.readValue(messageString, EventMessageImpl.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (payloadMessage == null) {
continue;
}
FacilitySoftwareConfig integration = null;
try {
integration = mapper.readValue(payloadMessage.getContent(), FacilitySoftwareConfig.class);
} catch (IOException e) {
logger.error("Cannot process message", e);
}
if (null == integration) {
continue;
}
if (!integration.checkIsActive()) {
continue;
}
for (EventUser payloadCommand : payloadMessage.getTarget().getUsers()) {
excuteJob(payloadCommand.getId(), integration);
}
}
}
Aggregations