fintp_connectors
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
MqPublisher.h
Go to the documentation of this file.
1 /*
2 * FinTP - Financial Transactions Processing Application
3 * Copyright (C) 2013 Business Information Systems (Allevo) S.R.L.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>
17 * or contact Allevo at : 031281 Bucuresti, 23C Calea Vitan, Romania,
18 * phone +40212554577, office@allevo.ro <mailto:office@allevo.ro>, www.allevo.ro.
19 */
20 
21 #ifndef MQPUBLISHER_H
22 #define MQPUBLISHER_H
23 
24 #include "MQ/MqWatcher.h"
25 #include "TransportHelper.h"
26 #include "XPathHelper.h"
27 #include "../Endpoint.h"
28 #include "../Message.h"
29 #include <boost/shared_ptr.hpp>
30 
31 #ifndef NO_DB
32  #include "Database.h"
33  #include "DatabaseProvider.h"
34 #endif
35 
36 #include "BatchManager/Storages/BatchZipArchiveStorage.h"
37 #include "Swift/SAAFilter.h"
38 #include "Swift/SwiftFormatFilter.h"
39 
40 using namespace std;
41 
42 class MqPublisher : public Endpoint
43 {
44  protected :
45 
46  // methods for controlling the endpoint
47  void internalStart();
48  void internalStop();
49 
50  public:
51 
52  // constructor
53  MqPublisher();
54 
55  //destructor
56  ~MqPublisher();
57 
58  // called before start. allows the endpoint to prepare environment
59  void Init();
60 
61  // methods for transactional execution
64  string Prepare();
65 
67  void Commit();
68 
70  void Abort();
71 
73  void Rollback();
74 
77  void Process( const string& correlationId );
78 
79  bool moreMessages() const { return !m_IsLast; }
80  pthread_t getWatcherThreadId() { return m_Watcher.getThreadId(); }
81 
82  //static const int MAX_BATCH_BACKOUTCOUNT;
83  static string XPathCallback( const string& itemNamespace );
84  private :
85 
86  MqWatcher m_Watcher;
87 
88  string m_WatchQueue;
92 
93  string m_AppQueue, m_AppQmgr, m_AppTransportURI;
94  string m_SSLKeyRepos, m_SSLCypherSpec, m_SSLPeerName;
95  string m_CertificateFileName, m_CertificatePasswd;
96  string m_RepliesQueue;
97 
99 
100  //string m_CurrentGroupId;
101  //string m_CurrentMessageId;
102  //string m_MessageFormat;
103  //unsigned long m_CurrentMessageLength;
104 
105  TransportHelper* m_CurrentHelper;
106  AbstractFilter* m_SAAFilter;
107  string m_ParamFileXslt, m_StrictSwiftFormat, m_TransformFile;
108 
110  static MqPublisher* m_Me;
111 
112  // ID member
113  BatchManager< BatchZipArchiveStorage > m_BatchManagerID;
115 
119 
120 #ifndef NO_DB
121  //ManagedBuffer* GetIDImage( string groupId, string correlationId, string& imgRef );
122  void GetIDImage( const string& groupId, const string& correlationId, string& imgRef, ManagedBuffer* outputSignedBuffer );
123 
124  Database *m_CurrentDatabase;
125  DatabaseProviderFactory *m_CurrentProvider;
126 #endif
127 
128  string m_DatabaseProvider; // Conector Database Provider
129  string m_DatabaseName; //Connector Database Name
130  string m_UserName; //Connector Database User
131  string m_UserPassword; //Connector Database Password
132 
133  string m_IDCertificateFileName, m_IDCertificatePasswd;
134  string m_LAUKey;
135 
136  static const string CHQ_NAMESPACE ;
137  static const string PRN_NAMESPACE ;
138  static const string BLX_NAMESPACE ;
139 };
140 
141 #endif //MQPUBLISHER_H