fintp_routingengine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RoutingStructures.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 ROUTINGSTRUCTURES_H
22 #define ROUTINGSTRUCTURES_H
23 
24 #include "TransportHelper.h"
25 #include "BatchManager/BatchManager.h"
26 #include "BatchManager/Storages/BatchMQStorage.h"
27 
28 #include "RoutingEngineMain.h"
29 #include "RoutingMessage.h"
30 
32 {
33  public:
34 
36  virtual ~RoutingState(){};
37 
38  virtual string ProcessMessage( RoutingMessage* message, const int userId, bool bulk, const string& batchType ) = 0;
39  string ProcessMessage( RoutingMessage* message, const int userId, bool bulk )
40  { return ProcessMessage( message, userId, bulk, "" ); }
41  string ProcessMessage( RoutingMessage* message, const int userId )
42  { return ProcessMessage( message, userId, false, "" ); }
43 };
44 
46 {
47 #if defined( TESTDLL_EXPORT ) || defined ( TESTDLL_IMPORT )
48  friend class RoutingStructuresTest;
49 #endif
50 
51  private :
52 
53  string m_Queue, m_QueueManager, m_TransportURI, m_ReplyToQueue;
54  TransportHelper::TRANSPORT_HELPER_TYPE m_HelperType;
55  string m_BatchConfig;
56 
57  TransportReplyOptions m_ReplyOptions;
59 
61  string m_ServiceName;
62 
63  string m_MessageTransform, m_MessageTrailer, m_ValidationSchema, m_ValidationSchemaNamespace;
64  string m_Definition;
65 
67 
68  TransportHelper* m_TransportHelper;
69  XSLTFilter* m_TransformFilter;
70  BatchManager<BatchMQStorage>* m_BatchManager;
71 
72  public :
73 
74  RoutingExitpoint( const string& serviceName, long serviceId, const string& exitpointDefinition );
76 
77  string ProcessMessage( RoutingMessage* message, const int userId, bool bulk, const string& batchType );
78 
79  void Commit( const string& batchId );
80  void Rollback( const bool isBatch );
81 
82  bool isValid() const { return ( m_Queue.size() > 0 ); }
83 
84  string getServiceName() const { return m_ServiceName; }
85  string getQueueName() const { return m_Queue; }
86  long getServiceId() const { return m_ServiceId; }
87 
88  int getMessageOptions() const { return m_MessageOptions; };
89 
90  string getValidationSchema() const { return m_ValidationSchema; }
91  string getValidationSchemaNamespace() const { return m_ValidationSchemaNamespace; }
92 
93  string getDefinition() const { return m_Definition; }
94 
95  private :
96 
97  void parseExitpointDefinition( const string& exitpointDefinition );
98 };
99 
100 class RoutingPlan;
101 
103 {
104 #if defined( TESTDLL_EXPORT ) || defined ( TESTDLL_IMPORT )
105  friend class RoutingStructuresTest;
106 #endif
107 
108  private :
109 
111 
112  long m_QueueId;
113 
114  string m_QueueName;
117 
118  public:
119 
120  RoutingQueue();
121  RoutingQueue( const long queueId, const string& queueName, const string& serviceName, const long serviceId, const string& queueEP, const long holdStatus );
123 
124  string ProcessMessage( RoutingMessage* message, const int userId, bool bulk, const string& batchType );
125 
126  // accessors
127  bool getHeld() const { return m_HoldStatus; }
128  void setHeld( const bool holdStatus = true ){ m_HoldStatus = holdStatus; }
129 
130  long getId() const { return m_QueueId; }
131  string getName() const { return m_QueueName; }
132  long getServiceId() const { return m_Exitpoint.getServiceId(); }
133  int getMessageOptions() const { return m_Exitpoint.getMessageOptions(); };
134 
135  const RoutingExitpoint& getExitpoint() const { return m_Exitpoint; }
136 };
137 
138 #endif // ROUTINGSTRUCTURES_H