libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
bmqt_resultcode.h
Go to the documentation of this file.
1 // Copyright 2014-2023 Bloomberg Finance L.P.
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 // bmqt_resultcode.h -*-C++-*-
17 #ifndef INCLUDED_BMQT_RESULTCODE
18 #define INCLUDED_BMQT_RESULTCODE
19 
45 
46 // BMQ
47 
48 // BDE
49 #include <bsl_iosfwd.h>
50 #include <bsl_string.h>
51 
52 namespace BloombergLP {
53 namespace bmqt {
54 
55 // ====================
56 // struct GenericResult
57 // ====================
58 
60 struct GenericResult {
61  // TYPES
62  enum Enum {
63  e_SUCCESS = 0 // Operation was success
64  ,
65  e_UNKNOWN = -1 // Operation failed for unknown reason
66  ,
67  e_TIMEOUT = -2 // Operation timedout
68  ,
69  e_NOT_CONNECTED = -3 // Cant process, not connected to the broker
70  ,
71  e_CANCELED = -4 // Operation was canceled
72  ,
73  e_NOT_SUPPORTED = -5 // Operation is not supported
74  ,
75  e_REFUSED = -6 // Operation was refused
76  ,
77  e_INVALID_ARGUMENT = -7 // An invalid argument was provided
78  ,
79  e_NOT_READY = -8 // Not ready to process the request
80  ,
82  // Used in test driver only, to validate
83  // consistency between this enum and the
84  // 'bmqp_ctrlmsg.xsd::StatusCategory' one
85  };
86 
87  // CLASS METHODS
88 
101  static bsl::ostream& print(bsl::ostream& stream,
102  GenericResult::Enum value,
103  int level = 0,
104  int spacesPerLevel = 4);
105 
114  static const char* toAscii(GenericResult::Enum value);
115 
120  static bool fromAscii(GenericResult::Enum* out,
121  const bslstl::StringRef& str);
122 };
123 
124 // FREE OPERATORS
125 
128 bsl::ostream& operator<<(bsl::ostream& stream, GenericResult::Enum value);
129 
130 // ======================
131 // struct OpenQueueResult
132 // ======================
133 
136  // TYPES
137  enum Enum {
138  // GENERIC
148 
149  // SPECIALIZED
150  // WARNINGS
151  ,
152  e_ALREADY_OPENED = 100 // The queue is already opened
153  ,
154  e_ALREADY_IN_PROGRESS = 101 // The queue is already being opened
155 
156  // ERRORS
157  ,
158  e_INVALID_URI = -100 // The queue uri is invalid
159  ,
160  e_INVALID_FLAGS = -101 // The flags provided are invalid
161  ,
162  e_CORRELATIONID_NOT_UNIQUE = -102 // The correlationdId is not unique
163  };
164 
165  // CLASS METHODS
166 
179  static bsl::ostream& print(bsl::ostream& stream,
180  OpenQueueResult::Enum value,
181  int level = 0,
182  int spacesPerLevel = 4);
183 
192  static const char* toAscii(OpenQueueResult::Enum value);
193 
199  const bslstl::StringRef& str);
200 };
201 
202 // FREE OPERATORS
203 
206 bsl::ostream& operator<<(bsl::ostream& stream, OpenQueueResult::Enum value);
207 
208 // ===========================
209 // struct ConfigureQueueResult
210 // ===========================
211 
214  // TYPES
215  enum Enum {
216  // GENERIC
226 
227  // SPECIALIZED WARNINGS
228  ,
229  e_ALREADY_IN_PROGRESS = 100 // The queue is already being configured
230 
231  // ERRORS
232  ,
233  e_INVALID_QUEUE = -101
234  };
235 
236  // CLASS METHODS
237 
250  static bsl::ostream& print(bsl::ostream& stream,
252  int level = 0,
253  int spacesPerLevel = 4);
254 
263  static const char* toAscii(ConfigureQueueResult::Enum value);
264 
270  const bslstl::StringRef& str);
271 };
272 
273 // FREE OPERATORS
274 
277 bsl::ostream& operator<<(bsl::ostream& stream,
279 
280 // =======================
281 // struct CloseQueueResult
282 // =======================
283 
286  // TYPES
287  enum Enum {
288  // GENERIC
298 
299  // SPECIALIZED
300  // WARNINGS
301  ,
302  e_ALREADY_CLOSED = 100 // The queue is already closed
303  ,
304  e_ALREADY_IN_PROGRESS = 101 // The queue is already being closed
305 
306  // ERRORS
307  ,
308  e_UNKNOWN_QUEUE = -100 // The queue doesn't exist
309  ,
310  e_INVALID_QUEUE = -101 // The queue provided is invalid
311  };
312 
313  // CLASS METHODS
314 
327  static bsl::ostream& print(bsl::ostream& stream,
329  int level = 0,
330  int spacesPerLevel = 4);
331 
340  static const char* toAscii(CloseQueueResult::Enum value);
341 
347  const bslstl::StringRef& str);
348 };
349 
350 // FREE OPERATORS
351 
354 bsl::ostream& operator<<(bsl::ostream& stream, CloseQueueResult::Enum value);
355 
356 // =========================
357 // struct EventBuilderResult
358 // =========================
359 
363  // TYPES
364  enum Enum {
365  // GENERIC
368 
369  // SPECIALIZED
370  // ERRORS
371  ,
378  e_OPTION_TOO_BIG = -106
379 #ifdef BMQ_ENABLE_MSG_GROUPID
380  ,
381  e_INVALID_MSG_GROUP_ID = -107
382 #endif
383  ,
384  e_QUEUE_SUSPENDED = -108
385  };
386 
387  // CLASS METHODS
388 
401  static bsl::ostream& print(bsl::ostream& stream,
403  int level = 0,
404  int spacesPerLevel = 4);
405 
414  static const char* toAscii(EventBuilderResult::Enum value);
415 
421  const bslstl::StringRef& str);
422 };
423 
424 // FREE OPERATORS
425 
428 bsl::ostream& operator<<(bsl::ostream& stream, EventBuilderResult::Enum value);
429 
430 // ================
431 // struct AckResult
432 // ================
433 
435 struct AckResult {
436  // TYPES
437  enum Enum {
438  // GENERIC
448 
449  // SPECIALIZED
450  // ERRORS
451  ,
452  e_LIMIT_MESSAGES = -100 // Messages limit reached
453  ,
454  e_LIMIT_BYTES = -101 // Bytes limit reached
455 
456  // TBD:DEPRECATED >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
457  // >libbmq-1.3.5
458  // The below 4 values are deprecated in favor of the above two ones
459  ,
460  e_LIMIT_DOMAIN_MESSAGES = -100 // The domain is full (messages)
461  ,
462  e_LIMIT_DOMAIN_BYTES = -101 // The domain is full (bytes)
463  ,
464  e_LIMIT_QUEUE_MESSAGES = -102 // The queue is full (messages)
465  ,
466  e_LIMIT_QUEUE_BYTES = -103 // The queue is full (bytes)
467  // TBD:DEPRECATED >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
468  // >libbmq-1.3.5
469  ,
470  e_STORAGE_FAILURE = -104 // The storage (on disk) is full
471  };
472 
473  // CLASS METHODS
474 
487  static bsl::ostream& print(bsl::ostream& stream,
488  AckResult::Enum value,
489  int level = 0,
490  int spacesPerLevel = 4);
491 
500  static const char* toAscii(AckResult::Enum value);
501 
506  static bool fromAscii(AckResult::Enum* out, const bslstl::StringRef& str);
507 };
508 
509 // FREE OPERATORS
510 
513 bsl::ostream& operator<<(bsl::ostream& stream, AckResult::Enum value);
514 
515 // =================
516 // struct PostResult
517 // =================
518 
520 struct PostResult {
521  // TYPES
522  enum Enum {
523  // GENERIC
533 
534  // SPECIALIZED
535  // WARNINGS
536  ,
537  e_BW_LIMIT = 100 // The application has been posting too much
538  // data, and the IO or broker are temporarily
539  // rejecting new messages.
540  };
541 
542  // CLASS METHODS
543 
556  static bsl::ostream& print(bsl::ostream& stream,
557  PostResult::Enum value,
558  int level = 0,
559  int spacesPerLevel = 4);
560 
569  static const char* toAscii(PostResult::Enum value);
570 
575  static bool fromAscii(PostResult::Enum* out, const bslstl::StringRef& str);
576 };
577 
578 // FREE OPERATORS
579 
582 bsl::ostream& operator<<(bsl::ostream& stream, PostResult::Enum value);
583 
584 } // close package namespace
585 
586 // ============================================================================
587 // INLINE DEFINITIONS
588 // ============================================================================
589 
590 // --------------------
591 // struct GenericResult
592 // --------------------
593 
594 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
596 {
597  return bmqt::GenericResult::print(stream, value, 0, -1);
598 }
599 
600 // ----------------------
601 // struct OpenQueueResult
602 // ----------------------
603 
604 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
606 {
607  return bmqt::OpenQueueResult::print(stream, value, 0, -1);
608 }
609 
610 // ---------------------------
611 // struct ConfigureQueueResult
612 // ---------------------------
613 
614 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
616 {
617  return bmqt::ConfigureQueueResult::print(stream, value, 0, -1);
618 }
619 
620 // -----------------------
621 // struct CloseQueueResult
622 // -----------------------
623 
624 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
626 {
627  return bmqt::CloseQueueResult::print(stream, value, 0, -1);
628 }
629 
630 // -------------------------
631 // struct EventBuilderResult
632 // -------------------------
633 
634 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
636 {
637  return bmqt::EventBuilderResult::print(stream, value, 0, -1);
638 }
639 
640 // ----------------
641 // struct AckResult
642 // ----------------
643 
644 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
645  bmqt::AckResult::Enum value)
646 {
647  return bmqt::AckResult::print(stream, value, 0, -1);
648 }
649 
650 // -----------------
651 // struct PostResult
652 // -----------------
653 
654 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
656 {
657  return bmqt::PostResult::print(stream, value, 0, -1);
658 }
659 
660 } // close enterprise namespace
661 
662 #endif
bsl::ostream & operator<<(bsl::ostream &stream, CompressionAlgorithmType::Enum value)
Definition: bmqt_compressionalgorithmtype.h:141
Definition: bmqa_abstractsession.h:42
This enum represents the result code status of an ack message.
Definition: bmqt_resultcode.h:435
Enum
Definition: bmqt_resultcode.h:437
@ e_REFUSED
Definition: bmqt_resultcode.h:445
@ e_LIMIT_MESSAGES
Definition: bmqt_resultcode.h:452
@ e_INVALID_ARGUMENT
Definition: bmqt_resultcode.h:446
@ e_LIMIT_DOMAIN_MESSAGES
Definition: bmqt_resultcode.h:460
@ e_LIMIT_DOMAIN_BYTES
Definition: bmqt_resultcode.h:462
@ e_NOT_SUPPORTED
Definition: bmqt_resultcode.h:444
@ e_LIMIT_BYTES
Definition: bmqt_resultcode.h:454
@ e_CANCELED
Definition: bmqt_resultcode.h:443
@ e_STORAGE_FAILURE
Definition: bmqt_resultcode.h:470
@ e_SUCCESS
Definition: bmqt_resultcode.h:439
@ e_UNKNOWN
Definition: bmqt_resultcode.h:440
@ e_LIMIT_QUEUE_MESSAGES
Definition: bmqt_resultcode.h:464
@ e_NOT_READY
Definition: bmqt_resultcode.h:447
@ e_LIMIT_QUEUE_BYTES
Definition: bmqt_resultcode.h:466
@ e_TIMEOUT
Definition: bmqt_resultcode.h:441
@ e_NOT_CONNECTED
Definition: bmqt_resultcode.h:442
static bsl::ostream & print(bsl::ostream &stream, AckResult::Enum value, int level=0, int spacesPerLevel=4)
static const char * toAscii(AckResult::Enum value)
static bool fromAscii(AckResult::Enum *out, const bslstl::StringRef &str)
This enum represents the result of a closeQueue operation.
Definition: bmqt_resultcode.h:285
Enum
Definition: bmqt_resultcode.h:287
@ e_REFUSED
Definition: bmqt_resultcode.h:295
@ e_NOT_READY
Definition: bmqt_resultcode.h:297
@ e_UNKNOWN_QUEUE
Definition: bmqt_resultcode.h:308
@ e_NOT_SUPPORTED
Definition: bmqt_resultcode.h:294
@ e_NOT_CONNECTED
Definition: bmqt_resultcode.h:292
@ e_UNKNOWN
Definition: bmqt_resultcode.h:290
@ e_ALREADY_IN_PROGRESS
Definition: bmqt_resultcode.h:304
@ e_TIMEOUT
Definition: bmqt_resultcode.h:291
@ e_SUCCESS
Definition: bmqt_resultcode.h:289
@ e_INVALID_QUEUE
Definition: bmqt_resultcode.h:310
@ e_CANCELED
Definition: bmqt_resultcode.h:293
@ e_ALREADY_CLOSED
Definition: bmqt_resultcode.h:302
@ e_INVALID_ARGUMENT
Definition: bmqt_resultcode.h:296
static bsl::ostream & print(bsl::ostream &stream, CloseQueueResult::Enum value, int level=0, int spacesPerLevel=4)
static bool fromAscii(CloseQueueResult::Enum *out, const bslstl::StringRef &str)
static const char * toAscii(CloseQueueResult::Enum value)
This enum represents the result of a configureQueue operation.
Definition: bmqt_resultcode.h:213
static bool fromAscii(ConfigureQueueResult::Enum *out, const bslstl::StringRef &str)
Enum
Definition: bmqt_resultcode.h:215
@ e_NOT_CONNECTED
Definition: bmqt_resultcode.h:220
@ e_CANCELED
Definition: bmqt_resultcode.h:221
@ e_INVALID_QUEUE
Definition: bmqt_resultcode.h:233
@ e_SUCCESS
Definition: bmqt_resultcode.h:217
@ e_TIMEOUT
Definition: bmqt_resultcode.h:219
@ e_NOT_READY
Definition: bmqt_resultcode.h:225
@ e_INVALID_ARGUMENT
Definition: bmqt_resultcode.h:224
@ e_UNKNOWN
Definition: bmqt_resultcode.h:218
@ e_NOT_SUPPORTED
Definition: bmqt_resultcode.h:222
@ e_REFUSED
Definition: bmqt_resultcode.h:223
@ e_ALREADY_IN_PROGRESS
Definition: bmqt_resultcode.h:229
static bsl::ostream & print(bsl::ostream &stream, ConfigureQueueResult::Enum value, int level=0, int spacesPerLevel=4)
static const char * toAscii(ConfigureQueueResult::Enum value)
Definition: bmqt_resultcode.h:362
Enum
Definition: bmqt_resultcode.h:364
@ e_QUEUE_READONLY
Definition: bmqt_resultcode.h:373
@ e_OPTION_TOO_BIG
Definition: bmqt_resultcode.h:378
@ e_UNKNOWN
Definition: bmqt_resultcode.h:367
@ e_PAYLOAD_EMPTY
Definition: bmqt_resultcode.h:377
@ e_QUEUE_INVALID
Definition: bmqt_resultcode.h:372
@ e_QUEUE_SUSPENDED
Definition: bmqt_resultcode.h:384
@ e_EVENT_TOO_BIG
Definition: bmqt_resultcode.h:375
@ e_SUCCESS
Definition: bmqt_resultcode.h:366
@ e_MISSING_CORRELATION_ID
Definition: bmqt_resultcode.h:374
@ e_PAYLOAD_TOO_BIG
Definition: bmqt_resultcode.h:376
static const char * toAscii(EventBuilderResult::Enum value)
static bool fromAscii(EventBuilderResult::Enum *out, const bslstl::StringRef &str)
static bsl::ostream & print(bsl::ostream &stream, EventBuilderResult::Enum value, int level=0, int spacesPerLevel=4)
This enum represents generic common status.
Definition: bmqt_resultcode.h:60
Enum
Definition: bmqt_resultcode.h:62
@ e_NOT_CONNECTED
Definition: bmqt_resultcode.h:69
@ e_CANCELED
Definition: bmqt_resultcode.h:71
@ e_NOT_SUPPORTED
Definition: bmqt_resultcode.h:73
@ e_LAST
Definition: bmqt_resultcode.h:81
@ e_NOT_READY
Definition: bmqt_resultcode.h:79
@ e_SUCCESS
Definition: bmqt_resultcode.h:63
@ e_TIMEOUT
Definition: bmqt_resultcode.h:67
@ e_INVALID_ARGUMENT
Definition: bmqt_resultcode.h:77
@ e_UNKNOWN
Definition: bmqt_resultcode.h:65
@ e_REFUSED
Definition: bmqt_resultcode.h:75
static bool fromAscii(GenericResult::Enum *out, const bslstl::StringRef &str)
static bsl::ostream & print(bsl::ostream &stream, GenericResult::Enum value, int level=0, int spacesPerLevel=4)
static const char * toAscii(GenericResult::Enum value)
This enum represents the result of an openQueue operation.
Definition: bmqt_resultcode.h:135
static const char * toAscii(OpenQueueResult::Enum value)
Enum
Definition: bmqt_resultcode.h:137
@ e_CANCELED
Definition: bmqt_resultcode.h:143
@ e_SUCCESS
Definition: bmqt_resultcode.h:139
@ e_NOT_CONNECTED
Definition: bmqt_resultcode.h:142
@ e_UNKNOWN
Definition: bmqt_resultcode.h:140
@ e_NOT_SUPPORTED
Definition: bmqt_resultcode.h:144
@ e_INVALID_URI
Definition: bmqt_resultcode.h:158
@ e_INVALID_FLAGS
Definition: bmqt_resultcode.h:160
@ e_NOT_READY
Definition: bmqt_resultcode.h:147
@ e_REFUSED
Definition: bmqt_resultcode.h:145
@ e_INVALID_ARGUMENT
Definition: bmqt_resultcode.h:146
@ e_TIMEOUT
Definition: bmqt_resultcode.h:141
@ e_ALREADY_OPENED
Definition: bmqt_resultcode.h:152
@ e_CORRELATIONID_NOT_UNIQUE
Definition: bmqt_resultcode.h:162
@ e_ALREADY_IN_PROGRESS
Definition: bmqt_resultcode.h:154
static bool fromAscii(OpenQueueResult::Enum *out, const bslstl::StringRef &str)
static bsl::ostream & print(bsl::ostream &stream, OpenQueueResult::Enum value, int level=0, int spacesPerLevel=4)
This enum represents the result code status of a post message.
Definition: bmqt_resultcode.h:520
Enum
Definition: bmqt_resultcode.h:522
@ e_SUCCESS
Definition: bmqt_resultcode.h:524
@ e_NOT_SUPPORTED
Definition: bmqt_resultcode.h:529
@ e_INVALID_ARGUMENT
Definition: bmqt_resultcode.h:531
@ e_NOT_CONNECTED
Definition: bmqt_resultcode.h:527
@ e_BW_LIMIT
Definition: bmqt_resultcode.h:537
@ e_NOT_READY
Definition: bmqt_resultcode.h:532
@ e_UNKNOWN
Definition: bmqt_resultcode.h:525
@ e_REFUSED
Definition: bmqt_resultcode.h:530
@ e_TIMEOUT
Definition: bmqt_resultcode.h:526
@ e_CANCELED
Definition: bmqt_resultcode.h:528
static const char * toAscii(PostResult::Enum value)
static bsl::ostream & print(bsl::ostream &stream, PostResult::Enum value, int level=0, int spacesPerLevel=4)
static bool fromAscii(PostResult::Enum *out, const bslstl::StringRef &str)