Skip to content

Commit 0868f92

Browse files
author
Petr Matousek
committed
wip: initial version refactoring #2
1 parent 873b526 commit 0868f92

File tree

6 files changed

+142
-139
lines changed

6 files changed

+142
-139
lines changed

src/api/qpid-proton/reactor/TxReceivingClient.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,16 @@ int TxReceivingClient::run(int argc, char **argv) const
339339
enableTracing("aac3_receiver");
340340
}
341341

342+
string tx_action = "commit";
343+
if (options.is_set("tx-action")) {
344+
tx_action = options["tx-action"];
345+
}
346+
347+
string tx_endloop_action = "commit";
348+
if (options.is_set("tx-endloop-action")) {
349+
tx_endloop_action = options["tx-endloop-action"];
350+
}
351+
342352
TxReceiverHandler handler = TxReceiverHandler(
343353
address,
344354
conn_urls,

src/api/qpid-proton/reactor/TxSendingClient.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,16 @@ int TxSendingClient::run(int argc, char **argv) const
489489
enableTracing("aac3_sender");
490490
}
491491

492+
string tx_action = "commit";
493+
if (options.is_set("tx-action")) {
494+
tx_action = options["tx-action"];
495+
}
496+
497+
string tx_endloop_action = "commit";
498+
if (options.is_set("tx-endloop-action")) {
499+
tx_endloop_action = options["tx-endloop-action"];
500+
}
501+
492502
message msg;
493503

494504
setMessageOptions(setter, msg);
@@ -552,7 +562,9 @@ int TxSendingClient::run(int argc, char **argv) const
552562
conn_heartbeat,
553563
max_frame_size,
554564
conn_use_config_file,
555-
log_msgs
565+
log_msgs,
566+
tx_action,
567+
tx_endloop_action
556568
);
557569

558570
handler.setMessage(msg);

src/api/qpid-proton/reactor/handler/TxReceiverHandler.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* and open the template in the editor.
55
*/
66

7-
/*
7+
/*
88
* File: TxReceiverHandler.cpp
99
* Author: pematous
10-
*
10+
*
1111
* Created on October 20, 2024
1212
*/
1313

@@ -132,7 +132,7 @@ void TxReceiverHandler::timerEvent() {
132132
} else {
133133
timer--;
134134
logger(debug) << "Waiting ...";
135-
135+
136136
if (recv_listen != "true") {
137137
work_q->schedule(duration::SECOND, make_work(&TxReceiverHandler::timerEvent, this));
138138
} else {
@@ -204,7 +204,7 @@ void TxReceiverHandler::setSelector(string selector)
204204
<< symbol("apache.org:selector-filter:string")
205205
<< selector
206206
<< finish();
207-
207+
208208
fm.put(filter_key, filter_value);
209209
}
210210

@@ -248,7 +248,7 @@ void TxReceiverHandler::on_container_start(container &c)
248248
logger(debug) << "Password: " << password;
249249
logger(debug) << "SASL mechanisms: " << sasl_mechanisms;
250250
logger(debug) << "SASL enabled: " << conn_sasl_enabled;
251-
251+
252252
logger(debug) << "Maximum frame size: " << max_frame_size;
253253

254254
logger(debug) << "Topic: " << is_topic;
@@ -290,7 +290,7 @@ void TxReceiverHandler::on_container_start(container &c)
290290

291291
logger(debug) << "Setting a reconnect timer: " << conn_reconnect;
292292
logger(debug) << "Custom reconnect: " << conn_reconnect_custom;
293-
293+
294294
configure_reconnect(conn_opts);
295295
configure_ssl(c);
296296

@@ -513,7 +513,7 @@ void TxReceiverHandler::on_transport_close(transport &t) {
513513

514514
void TxReceiverHandler::on_transport_error(transport &t) {
515515
logger(error) << "The connection with " << broker_url.getHost() << ":" << broker_url.getPort() << " was interrupted: " << t.error().what();
516-
516+
517517
if (t.error().what().find("unauthorized") != string::npos) {
518518
exit(1);
519519
}

src/api/qpid-proton/reactor/handler/TxReceiverHandler.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* and open the template in the editor.
55
*/
66

7-
/*
7+
/*
88
* File: TxReceiverHandler.h
99
* Author: pematous
1010
*
@@ -64,7 +64,7 @@ using proton::transaction_handler;
6464

6565
#ifdef PN_CPP_HAS_STD_FUNCTION
6666
#undef PN_CPP_HAS_STD_FUNCTION
67-
#endif
67+
#endif
6868

6969
namespace dtests {
7070
namespace proton {
@@ -162,7 +162,7 @@ class TxReceiverHandler : public CommonHandler, transaction_handler {
162162
int recv_credit_window = -1,
163163
bool recv_drain_after_credit_window = false
164164
);
165-
165+
166166
virtual ~TxReceiverHandler();
167167

168168
void timerEvent();
@@ -185,7 +185,7 @@ class TxReceiverHandler : public CommonHandler, transaction_handler {
185185
* Gets the transaction batch size
186186
* @return the transaction batch size
187187
*/
188-
int getBatchSize() const;
188+
int getBatchSize() const;
189189

190190
transaction_handler th;
191191

@@ -206,11 +206,11 @@ class TxReceiverHandler : public CommonHandler, transaction_handler {
206206
listener lsnr;
207207
container *cont;
208208
double ts;
209-
209+
210210
struct timer_event_t : public void_function0 {
211211
TxReceiverHandler &parent;
212212
timer_event_t(TxReceiverHandler &handler): parent(handler) { }
213-
void operator()() {
213+
void operator()() {
214214
parent.timerEvent();
215215
}
216216
};
@@ -247,7 +247,6 @@ class TxReceiverHandler : public CommonHandler, transaction_handler {
247247
int current_batch = 0;
248248
int committed = 0;
249249
int confirmed = 0;
250-
int total = 0;
251250

252251
transaction *tx;
253252
};

0 commit comments

Comments
 (0)