private void recalculateHostCapacityByUuid(String hostUuid) { RecalculateHostCapacityMsg msg = new RecalculateHostCapacityMsg(); msg.setHostUuid(hostUuid); bus.makeLocalServiceId(msg, HostAllocatorConstant.SERVICE_ID); bus.send(msg); }
@Override public void success(DeleteRsp ret) { bus.reply(msg, reply); } });
@Override public void fail(ErrorCode errorCode) { evt.setError(errorCode); bus.publish(evt); } });
@Override public void handleMessage(Message msg) { try { if (msg instanceof PuppetPokeAgentMsg) { handle((PuppetPokeAgentMsg) msg); } else { bus.dealWithUnknownMessage(msg); } } catch (Exception e) { bus.logExceptionWithMessageDump(msg, e); bus.replyErrorByMessageType(msg, e); } }
private void recalculateCapacity(String psUuid){ RecalculatePrimaryStorageCapacityMsg msg = new RecalculatePrimaryStorageCapacityMsg(); msg.setPrimaryStorageUuid(psUuid); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, psUuid); bus.send(msg); }
public void removeVmOnSimulatorHost(String hostUuid, String vmUuid) { RemoveVmOnSimulatorMsg msg = new RemoveVmOnSimulatorMsg(); msg.setHostUuid(hostUuid); msg.setVmUuid(vmUuid); bus.makeTargetServiceIdByResourceUuid(msg, HostConstant.SERVICE_ID, hostUuid); bus.call(msg); } }
@Override @MessageSafe void handleHypervisorSpecificMessage(LocalStorageHypervisorSpecificMessage msg) { bus.dealWithUnknownMessage((Message) msg); }
@Override public void handleMessage(Message msg) { try { if (msg instanceof APIMessage) { handleApiMessage((APIMessage) msg); } else { handleLocalMessage(msg); } } catch (Exception e) { bus.logExceptionWithMessageDump(msg, e); bus.replyErrorByMessageType(msg, e); } }
ask.setBackupStorageUuid(paramIn.getBackupStorageUuid()); ask.setImageMediaType(paramIn.getImage().getMediaType()); bus.makeTargetServiceIdByResourceUuid(ask, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); MessageReply ar = bus.call(ask); if (!ar.isSuccess()) { trigger.fail(ar.getError()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setBackupStorageInstallPath(bsInstallPath); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) {
private void setServiceId(GarbageCollectorMessage msg) { String mgmtUuid = Q.New(GarbageCollectorVO.class).select(GarbageCollectorVO_.managementNodeUuid) .eq(GarbageCollectorVO_.uuid, msg.getGCJobUuid()).findValue(); if (mgmtUuid != null) { bus.makeTargetServiceIdByResourceUuid((Message) msg, GCConstants.SERVICE_ID, mgmtUuid); } else { bus.makeLocalServiceId((Message) msg, GCConstants.SERVICE_ID); } } }
protected void changeClusterStateByLocalMsg(ChangeClusterStateMsg msg) { ChangeClusterStateReply reply = new ChangeClusterStateReply(); try { ClusterInventory inv = changeState(ClusterStateEvent.valueOf(msg.getStateEvent())); reply.setInventory(inv); bus.reply(msg, reply); } catch (Exception e) { bus.logExceptionWithMessageDump(msg, e); bus.replyErrorByMessageType(msg, e); } }
@Override public String getId() { return bus.makeLocalServiceId(EncryptGlobalConfig.SERVICE_ID); } }
private void setServiceId(APIMessage msg) { if (msg instanceof AccountMessage) { AccountMessage amsg = (AccountMessage) msg; bus.makeTargetServiceIdByResourceUuid(msg, AccountConstant.SERVICE_ID, amsg.getAccountUuid()); } }
private void sendMessage(APIMessage msg, Api api, HttpServletResponse rsp) throws IOException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { if (msg instanceof APISyncCallMessage) { MessageReply reply = bus.call(msg); sendReplyResponse(reply, api, rsp); } else { RequestData d = new RequestData(); d.apiMessage = msg; d.requestInfo = requestInfo.get(); List<String> webHook = requestInfo.get().headers.get(RestConstants.HEADER_WEBHOOK); if (webHook != null && !webHook.isEmpty()) { d.webHook = webHook.get(0); } asyncStore.save(d); UriComponentsBuilder ub = UriComponentsBuilder.fromHttpUrl(restf.getBaseUrl()); ub.path(RestConstants.API_VERSION); ub.path(RestConstants.ASYNC_JOB_PATH); ub.path("/" + msg.getId()); ApiResponse response = new ApiResponse(); response.setLocation(ub.build().toUriString()); bus.send(msg); sendResponse(HttpStatus.ACCEPTED.value(), response, rsp); } }
@Override public RestAPIResponse call(APIMessage msg) { RestAPIResponse rsp = new RestAPIResponse(); rsp.setCreatedDate(new Date()); msg.setServiceId(ApiMediatorConstant.SERVICE_ID); MessageReply reply = bus.call(msg); rsp.setFinishedDate(new Date()); rsp.setState(RestAPIState.Done.toString()); rsp.setResult(RESTApiDecoder.dump(reply)); return rsp; }
private void passThrough(AccountMessage msg) { AccountVO vo = dbf.findByUuid(msg.getAccountUuid(), AccountVO.class); if (vo == null) { bus.replyErrorByMessageType((Message) msg, err(SysErrors.RESOURCE_NOT_FOUND, "unable to find account[uuid=%s]", msg.getAccountUuid())); return; } AccountBase base = new AccountBase(vo); base.handleMessage((Message) msg); }
private void releasePrimaryStorageCapacity(String psUuid) { SMPRecalculatePrimaryStorageCapacityMsg msg = new SMPRecalculatePrimaryStorageCapacityMsg(); msg.setPrimaryStorageUuid(psUuid); msg.setRelease(true); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, psUuid); bus.send(msg); }
public void setSimulatorHostConnectionState(String uuid, boolean isDisconnected) { SimulatorHostConnectionControlMsg msg = new SimulatorHostConnectionControlMsg(); msg.setHostUuid(uuid); msg.setDisconnected(isDisconnected); bus.makeTargetServiceIdByResourceUuid(msg, HostConstant.SERVICE_ID, uuid); bus.call(msg); }
private void handleApiMessage(APIMessage msg) { if (msg instanceof APIRequestConsoleAccessMsg) { handle((APIRequestConsoleAccessMsg) msg); } else { bus.dealWithUnknownMessage(msg); } }
@Override public void handleMessage(Message msg) { try { if (msg instanceof APIMessage) { handleApiMessage((APIMessage) msg); } else { handleLocalMessage(msg); } } catch (Exception e) { bus.logExceptionWithMessageDump(msg, e); bus.replyErrorByMessageType(msg, e); } }