MsgListPush.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "MsgListPush.h"
  2. #include "ErrorCode.h"
  3. #include "PhmsLogger.h"
  4. #include "Util.h"
  5. #include <string>
  6. using namespace std;
  7. CMsgListPush::CMsgListPush(string stringUuid, string stringSenderId, string stringCaseId, string stringCaseType, string stringMsgType, string stringMsgDirection, string stringVersion, pHttpPushCallback pCallback, pHttpPushFailCallback pFailCallback)
  8. :CPushBase(pCallback, pFailCallback, MSG_LIST_PUSH), m_stringUuid(stringUuid), m_stringSenderId(stringSenderId), m_stringCaseId(stringCaseId), m_stringCaseType(stringCaseType), m_stringMsgType(stringMsgType), m_stringMsgDirection(stringMsgDirection), m_stringVersion(stringVersion)
  9. {
  10. }
  11. CMsgListPush::~CMsgListPush(void)
  12. {
  13. }
  14. void CMsgListPush::ExecutePushSession()
  15. {
  16. m_pPhmsPushSession->SetPushCallback(m_pHttpPushCallback);
  17. while(m_bStopRetry==false)
  18. {
  19. int nRet = PHMS_SUCCESSFUL_RESULT;
  20. nRet = m_pPhmsPushSession->PushMsg(m_stringSenderId, m_stringCaseId, m_stringCaseType, m_stringMsgType, m_stringMsgDirection, m_stringVersion);
  21. if(nRet!=PHMS_SUCCESSFUL_RESULT)
  22. {
  23. CPhmsLogger::GetPhmsLogger()->WriteLog(CUtil::GetErrorMsg(nRet), __FUNCTION__, __FILE__, __LINE__);
  24. if(nRet==COMMON_SESSION_INVALID || nRet==COMMON_LOGIN_ANOTHER_PLACE || nRet==COMMON_SERVER_NO_SUPPORT || nRet==COMMON_INVALID_CHARSET || nRet==COMMON_NET_CONFIG_ERROR || nRet==COMMON_URL_NOT_FOUND || nRet==COMMON_NO_NET_CONFIG_FILE)
  25. {
  26. m_pHttpPushFailCallback(nRet/*, (NET_HANDLE)m_stringUuid.c_str()*/);
  27. break;
  28. }
  29. else
  30. {
  31. //只回调通知,不退出推送线程
  32. m_pHttpPushFailCallback(nRet);
  33. Poco::Thread::sleep(2000);
  34. }
  35. }
  36. }
  37. }