MCPcopy Create free account
hub / github.com/apache/qpid-proton / sequence

Class sequence

cpp/examples/service_bus.cpp:260–291  ·  view source on GitHub ↗

Orchestrate the sequential actions of sending and receiving session-based messages.

Source from the content-addressed store, hash-verified

258
259/// Orchestrate the sequential actions of sending and receiving session-based messages.
260class sequence : public proton::messaging_handler {
261 private:
262 proton::container *container;
263 int sequence_no;
264 session_sender snd;
265 session_receiver rcv_red, rcv_green, rcv_null;
266
267 public:
268 static sequence *the_sequence;
269
270 sequence (const std::string &c, const std::string &e, const connection_options &co) :
271 container(0), sequence_no(0),
272 snd(c, e, co), rcv_red(c, e, co, "red"), rcv_green(c, e, co, "green"), rcv_null(c, e, co, NULL) {
273 the_sequence = this;
274 }
275
276 void on_container_start(proton::container &c) override {
277 container = &c;
278 next_sequence();
279 }
280
281 void next_sequence() {
282 switch (sequence_no++) {
283 // run these in order exactly once
284 case 0: snd.run(*container); break;
285 case 1: rcv_green.run(*container); break;
286 case 2: rcv_red.run(*container); break;
287 // Run this until the receiver decides there is no messages left to sequence through
288 default: rcv_null.run(*container); break;
289 }
290 }
291};
292
293sequence *sequence::the_sequence = NULL;
294

Callers 4

vector.hppFile · 0.85
forward_list.hppFile · 0.85
deque.hppFile · 0.85
list.hppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected