Java Code Examples for com.creditease.framework.pojo.ServiceMessage#setOut()
The following examples show how to use
com.creditease.framework.pojo.ServiceMessage#setOut() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockMessageTest.java From ns4_frame with Apache License 2.0 | 6 votes |
@Test public void getJsonOut() throws Exception { ServiceMessage message = new MockMessage(); message.setOut(SystemOutKey.SIGN_INFO,"sfsdf"); message.setOut(SystemOutKey.RETURN_CODE, SystemRetInfo.NORMAL); HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); objectObjectHashMap.put("a", "b"); objectObjectHashMap.put("c", "f"); objectObjectHashMap.put("e", "z"); message.setOut(TestOutKey.TEST_MAP, objectObjectHashMap); List<Integer> list = new ArrayList<>(); list.add(1); list.add(2); list.add(3); list.add(4); message.setOut(TestOutKey.TEST_LIST, list); message.setOut(TestOutKey.TEST_STRING,"abcdefg"); System.out.println(message.getJsonOut()); }
Example 2
Source File: FileCheckLActionWorker.java From ns4_frame with Apache License 2.0 | 5 votes |
@Override public void doWork(ServiceMessage serviceMessage) throws NSException { if (fileCheck.checkFile()) { serviceMessage.setOut(SystemOutKey.RETURN_CODE, SystemRetInfo.NORMAL); } else { serviceMessage.setOut(SystemOutKey.RETURN_CODE, SystemRetInfo.CTRL_NOT_FOUND_SEVICE_ERROR); } }
Example 3
Source File: FileCheckLActionTcpWorker.java From ns4_frame with Apache License 2.0 | 5 votes |
@Override public void doWork(ServiceMessage serviceMessage) throws NSException { if (fileCheck.checkFile()) { serviceMessage.setOut(SystemOutKey.XML_OUT_CONTENT, SystemRetInfo.NORMAL); } else { serviceMessage.setOut(SystemOutKey.XML_OUT_CONTENT, SystemRetInfo.CTRL_NOT_FOUND_SEVICE_ERROR); } }
Example 4
Source File: StatusLActionTcpWorker.java From ns4_frame with Apache License 2.0 | 5 votes |
@Override public void doWork(ServiceMessage serviceMessage) throws NSException { StringBuilder sb = new StringBuilder(); sb.append(LActionOutKey.queueSize).append(":").append(TcpRPCHandler.getQueueSize()).append(",") .append(LActionOutKey.activeThreadCount).append(":").append(TcpRPCHandler.getActiveThreadCount()); serviceMessage.setOut(SystemOutKey.XML_OUT_CONTENT, sb.toString()); }
Example 5
Source File: ActionWorker.java From ns4_frame with Apache License 2.0 | 5 votes |
public static void stop(ServiceMessage serviceMessage, RetInfo retInfo) throws StopException { StopChainException stopException = new StopChainException(retInfo.getMsg()); try { serviceMessage.setOut(SystemOutKey.RETURN_CODE, retInfo); } catch (NSException e) { e.printStackTrace(); } throw stopException; }
Example 6
Source File: TestACommand.java From ns4_frame with Apache License 2.0 | 4 votes |
@Override public void doService(ServiceMessage serviceMessage) throws NSException { serviceMessage.setOut(MyKey.TESTCONTROLLER,"OK"); }
Example 7
Source File: StatusLActionWorker.java From ns4_frame with Apache License 2.0 | 4 votes |
@Override public void doWork(ServiceMessage serviceMessage) throws NSException { serviceMessage.setOut(LActionOutKey.queueSize, HttpRPCHandler.getQueueSize()); serviceMessage.setOut(LActionOutKey.activeThreadCount, HttpRPCHandler.getActiveThreadCount()); serviceMessage.setOut(SystemOutKey.RETURN_CODE, SystemRetInfo.NORMAL); }
Example 8
Source File: IdGenAction.java From ns4_gear_idgen with Apache License 2.0 | 4 votes |
@Override public void doWork(ServiceMessage serviceMessage) throws NSException { long start = System.currentTimeMillis(); //参数准备 String keyType = serviceMessage.getExchangeByType(DataExchangeKey.keyType, String.class); if (StringUtil.isEmpty(keyType)) { keyType = serviceMessage.getParameter(Constant.PARAM_KEY_TYPE); } String keyName = serviceMessage.getExchangeByType(DataExchangeKey.keyName, String.class); if (StringUtil.isEmpty(keyName)) { keyName = serviceMessage.getParameter(Constant.PARAM_KEY_NAME); } NsLogger.logger.info("IdGenAction dowork... keyType:{},keyName:{}", keyType, keyName); //业务处理 String keyValue = Constant.EMPTY; try { if (!StringUtil.isEmpty(keyType) && !StringUtil.isEmpty(keyName)) { keyValue = counterService.generator(keyType.trim(), keyName.trim()); } NsLogger.logger.info("KeyValue:{} keyType:{} keyName:{}", keyValue, keyType, keyName); } catch (Exception e) { NsLogger.logger.error("response key is empty,error occur"); } //输出结果 serviceMessage.setOut(InterfaceOutKey.result, keyValue); String retCode = InnerMsgEnum.GOT_SUCCESS.getRetCode(); String retInfo = InnerMsgEnum.GOT_SUCCESS.getRetInfo(); if (Constant.EMPTY.equals(keyValue)) { retCode = InnerMsgEnum.GOT_FAIL.getRetCode(); retInfo = InnerMsgEnum.GOT_FAIL.getRetInfo(); } serviceMessage.setOut(SystemOutKey.RETURN_CODE, new GeneralRetInfo(retCode, retInfo)); long end = System.currentTimeMillis(); NsLogger.logger.info("IdGenAction dowork 共耗时{} ms", (end - start)); }