153 |
|
|
154 |
//stage 2 connect to mysql |
//stage 2 connect to mysql |
155 |
string mysqlString = buildMysqlConnString(); |
string mysqlString = buildMysqlConnString(); |
156 |
MySqlConnection sqlConnection = new MySqlConnection(mysqlString); |
MySqlConnection sqlReadConnection = new MySqlConnection(mysqlString); |
157 |
sqlConnection.Open(); |
sqlReadConnection.Open(); |
158 |
|
|
159 |
|
MySqlConnection sqlWriteConnection = new MySqlConnection(mysqlString); |
160 |
|
sqlWriteConnection.Open(); |
161 |
|
|
162 |
|
|
163 |
//stage 3 move messages |
//stage 3 move messages |
164 |
string readSql = "CALL " + sql2mqReadQuery + "()"; |
string readSql = "CALL " + sql2mqReadQuery + "()"; |
165 |
MySqlCommand readCmd = new MySqlCommand(readSql, sqlConnection); |
MySqlCommand readCmd = new MySqlCommand(readSql, sqlReadConnection); |
166 |
MySqlDataReader dataReader = readCmd.ExecuteReader(); |
MySqlDataReader dataReader = readCmd.ExecuteReader(); |
167 |
while (dataReader.Read()) |
while (dataReader.Read()) |
168 |
{ |
{ |
182 |
//now that the message has been put on queue mark it as such |
//now that the message has been put on queue mark it as such |
183 |
|
|
184 |
string updateSql = "CALL " + sql2mqUpdateQuery + "(" + id + ")"; |
string updateSql = "CALL " + sql2mqUpdateQuery + "(" + id + ")"; |
185 |
MySqlCommand updateCmd = new MySqlCommand(updateSql, sqlConnection); |
MySqlCommand updateCmd = new MySqlCommand(updateSql, sqlWriteConnection); |
186 |
int numrows = updateCmd.ExecuteNonQuery(); |
int numrows = updateCmd.ExecuteNonQuery(); |
187 |
|
|
188 |
translog.WriteLine(getNowString() + " " + msgString + "\n"); |
translog.WriteLine(getNowString() + " " + msgString + "\n"); |
199 |
dataReader.Close(); |
dataReader.Close(); |
200 |
out_queue.Close(); |
out_queue.Close(); |
201 |
mqMgr.Close(); |
mqMgr.Close(); |
202 |
sqlConnection.Close(); |
sqlReadConnection.Close(); |
203 |
|
sqlWriteConnection.Close(); |
204 |
} |
} |
205 |
catch (Exception e) |
catch (Exception e) |
206 |
{ |
{ |