Skip to content

Commit

Permalink
[#210]
Browse files Browse the repository at this point in the history
type : feature
body : [fix #210] Agent CDC Monitoring add kafka restart process
  • Loading branch information
Jeong-Yoon committed Sep 13, 2021
1 parent 6adf834 commit 5846a7a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;

import com.k4m.dx.tcontrol.db.repository.vo.TransVO;
import com.k4m.dx.tcontrol.socket.ProtocolID;
import com.k4m.dx.tcontrol.socket.SocketCtl;
import com.k4m.dx.tcontrol.socket.TranCodeType;
Expand All @@ -25,9 +26,9 @@
*
* 수정일 수정자 수정내용
* ------- -------- ---------------------------
* 2021.08.31 최초 생성
* 2021.09.06 최초 생성
* </pre>
*/
*/
public class DxT044 extends SocketCtl {

private Logger errLogger = LoggerFactory.getLogger("errorToFile");
Expand All @@ -49,26 +50,46 @@ public void execute(String strDxExCode, JSONObject jObj) throws Exception {
String strErrCode = "";
String strErrMsg = "";
String strSuccessCode = "0";

socketLogger.info("[123456789132136547654] " + jObj.toJSONString());
// String strExeStatusIng = ""
// 정보 넣어주고 insert 하는거 하기!

// TransVO transVO = new TransVO();
// transVO.setKc_id((int) jObj.get("kc_id"));


JSONObject outputObj = new JSONObject();
try {

String strCmd = "docker restart `docker ps -a --format \"table {{.Names}}\" | grep kafka`";
String strCmd = "docker restart `docker ps -a --format \"table {{.Names}}\" | grep connect`";
// String strCmd = "docker ps -a --format \"table {{.Names}}\" | grep kafka";
RunCommandExec r = new RunCommandExec(strCmd);

r.run();
r.start();

try {
r.join();
} catch (InterruptedException ie) {
ie.printStackTrace();
}

String retVal = r.call();
String strResultMessge = r.getMessage();

socketLogger.info("[RESULT] " + retVal);
socketLogger.info("[MSG] " + strResultMessge);

socketLogger.info("##### 결과 : " + retVal + " message : " +strResultMessge);
// jObj.put("",);
if(retVal.equals("success")){

}

outputObj.put(ProtocolID.DX_EX_CODE, strDxExCode);
outputObj.put(ProtocolID.RESULT_CODE, strSuccessCode);
outputObj.put(ProtocolID.ERR_CODE, strErrCode);
outputObj.put(ProtocolID.ERR_MSG, strErrMsg);
// outputObj.put(ProtocolID.RESULT_DATA, strResultMessge);
outputObj.put(ProtocolID.RESULT_DATA, retVal);

sendBuff = outputObj.toString().getBytes();
send(4, sendBuff);
Expand All @@ -79,7 +100,8 @@ public void execute(String strDxExCode, JSONObject jObj) throws Exception {
outputObj.put(ProtocolID.RESULT_CODE, "1");
outputObj.put(ProtocolID.ERR_CODE, TranCodeType.DxT044);
outputObj.put(ProtocolID.ERR_MSG, "DxT044 Error [" + e.toString() + "]");

outputObj.put(ProtocolID.RESULT_DATA, "fail");

sendBuff = outputObj.toString().getBytes();
send(4, sendBuff);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ public void run() {

case TranCodeType.DxT044 :


DxT044 dxT044 = new DxT044(client, is, os);
dxT044.execute(strDX_EX_CODE, jObj);

Expand Down

0 comments on commit 5846a7a

Please sign in to comment.