123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #pragma once
- #include "BUSClient.MainEntry.hpp"
- namespace BUSC = ECOM::ServiceBus::Controller;
- #ifndef _ServiceBus_DLL
- #define _ServiceBus_API _declspec(dllimport)
- #else
- #define _ServiceBus_API _declspec(dllexport)
- #endif
- namespace ECOM
- {
- namespace ServiceBus
- {
- namespace Controller
- {
- class _ServiceBus_API MessageClient;
- };
- namespace MemMapExchBLOB
- {
- class _ServiceBus_API PushManager
- {
- public:
- static void SetLogFileName (const char * FileName);
- static void Prepare ();
- static void Quit ();
- // 设置缺省的超时, 单位: 毫秒
- static void SetDefTimeOut (int msTimeOut);
- };
- class _ServiceBus_API PushBLOB_Base
- {
- protected:
- PushBLOB_Base (PCTSTR TargetID);
- public:
- virtual ~PushBLOB_Base ();
- void SetTransactionID (DWORD ID);
- // 立即发送
- bool Push (const BlockBuffer & BLOB, int msTimeOut = gDefMSTimeOut);
- // 立即发送, 带附加参数
- bool Push (const BlockBuffer & BLOB, DString UserInfo, int msTimeOut = gDefMSTimeOut);
- // 通知接收方, 交易开始
- void BeginTransaction ();
- // 通知接收方, 交易结束, 立即发送
- void EndTransactionNow ();
- protected:
- DWORD m_TransactionID;
- bool m_bTargetOnline;
- DString m_TargetID;
- Controller::MessageClient * m_Client;
- protected:
- friend PushManager;
- static int gDefMSTimeOut;
- };
- class _ServiceBus_API PushBLOB : public PushBLOB_Base
- {
- public:
- PushBLOB (PCTSTR SourceID, PCTSTR TargetID);
- PushBLOB (const PushBLOB &) = delete;
- PushBLOB (PushBLOB &&) = delete;
- PushBLOB & operator = (const PushBLOB &) = delete;
- public:
- // 后台发送
- bool Post (const BlockBuffer & BLOB);
- // 通知接收方, 交易结束
- void EndTransaction ();
- friend class PushFileServer;
- };
- class _ServiceBus_API FixedPushBLOB : public PushBLOB_Base
- {
- public:
- FixedPushBLOB (PCTSTR SourceID, PCTSTR TargetID, int Port = BUSC::LegacySendPort);
- FixedPushBLOB (const FixedPushBLOB &) = delete;
- FixedPushBLOB (FixedPushBLOB &&) = delete;
- FixedPushBLOB & operator = (const FixedPushBLOB &) = delete;
- public:
- // 后台发送
- bool Post (const BlockBuffer & BLOB);
- // 通知接收方, 交易结束
- void EndTransaction ();
- private:
- int m_Port;
- };
- }
- }
- };
|