libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
bmqa_abstractsession.h
Go to the documentation of this file.
1 // Copyright 2016-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 // bmqa_abstractsession.h -*-C++-*-
17 #ifndef INCLUDED_BMQA_ABSTRACTSESSION
18 #define INCLUDED_BMQA_ABSTRACTSESSION
19 
25 
26 #include <bmqa_closequeuestatus.h>
29 #include <bmqa_event.h>
31 #include <bmqa_messageproperties.h>
32 #include <bmqa_openqueuestatus.h>
33 #include <bmqa_queueid.h>
34 #include <bmqt_queueoptions.h>
35 #include <bmqt_uri.h>
36 
37 // BDE
38 #include <bsl_functional.h>
39 #include <bsls_timeinterval.h>
40 #include <bsls_types.h>
41 
42 namespace BloombergLP {
43 namespace bmqa {
44 
45 // =====================
46 // class AbstractSession
47 // =====================
48 
51  public:
52  // TYPES
53 
58  typedef bsl::function<void(const bmqa::OpenQueueStatus& result)>
60 
65  typedef bsl::function<void(const bmqa::ConfigureQueueStatus& result)>
67 
72  typedef bsl::function<void(const bmqa::CloseQueueStatus& result)>
74 
75  public:
76  // CREATORS
77 
79  virtual ~AbstractSession();
80 
81  // MANIPULATORS
82 
85 
94  virtual int
95  start(const bsls::TimeInterval& timeout = bsls::TimeInterval());
96 
105  virtual int
106  startAsync(const bsls::TimeInterval& timeout = bsls::TimeInterval());
107 
115  virtual void stop();
116 
121  virtual void stopAsync();
122 
128  virtual void finalizeStop();
129 
140 
149 
158 
161 
166  virtual int getQueueId(QueueId* queueId, const bmqt::Uri& uri);
167 
172  virtual int getQueueId(QueueId* queueId,
173  const bmqt::CorrelationId& correlationId);
174 
179  virtual int
180  openQueue(QueueId* queueId,
181  const bmqt::Uri& uri,
182  bsls::Types::Uint64 flags,
183  const bmqt::QueueOptions& options = bmqt::QueueOptions(),
184  const bsls::TimeInterval& timeout = bsls::TimeInterval());
185 
201  virtual OpenQueueStatus
203  const bmqt::Uri& uri,
204  bsls::Types::Uint64 flags,
205  const bmqt::QueueOptions& options = bmqt::QueueOptions(),
206  const bsls::TimeInterval& timeout = bsls::TimeInterval());
207 
212  virtual int
214  const bmqt::Uri& uri,
215  bsls::Types::Uint64 flags,
216  const bmqt::QueueOptions& options = bmqt::QueueOptions(),
217  const bsls::TimeInterval& timeout = bsls::TimeInterval());
218 
235  virtual void
237  const bmqt::Uri& uri,
238  bsls::Types::Uint64 flags,
239  const OpenQueueCallback& callback,
240  const bmqt::QueueOptions& options = bmqt::QueueOptions(),
241  const bsls::TimeInterval& timeout = bsls::TimeInterval());
242 
247  virtual int
249  const bmqt::QueueOptions& options,
250  const bsls::TimeInterval& timeout = bsls::TimeInterval());
251 
265  QueueId* queueId,
266  const bmqt::QueueOptions& options,
267  const bsls::TimeInterval& timeout = bsls::TimeInterval());
268 
273  virtual int configureQueueAsync(
274  QueueId* queueId,
275  const bmqt::QueueOptions& options,
276  const bsls::TimeInterval& timeout = bsls::TimeInterval());
277 
278  virtual void configureQueueAsync(
279  QueueId* queueId,
280  const bmqt::QueueOptions& options,
281  const ConfigureQueueCallback& callback,
282  const bsls::TimeInterval& timeout = bsls::TimeInterval());
283 
284  // Asynchronously configure the queue identified by the specified
285  // 'queueId' using the specified 'options' to configure some advanced
286  // settings. The result of the operation is communicated to the
287  // specified 'callback' via a 'bmqa::ConfigureQueueStatus', providing
288  // the status and context of the requested operation. If the
289  // optionally specified 'timeout' is not populated, use the one defined
290  // in the session options.
291  //
292  // THREAD: The 'callback' will *ALWAYS* be invoked from the
293  // EventHandler thread(s) (or if a SessionEventHandler was not
294  // specified, from the thread invoking 'nextEvent').
295 
300  virtual int
301  closeQueue(QueueId* queueId,
302  const bsls::TimeInterval& timeout = bsls::TimeInterval());
303 
320  virtual CloseQueueStatus
322  const bsls::TimeInterval& timeout = bsls::TimeInterval());
323 
328  virtual int
330  const bsls::TimeInterval& timeout = bsls::TimeInterval());
331 
349  virtual void
351  const CloseQueueCallback& callback,
352  const bsls::TimeInterval& timeout = bsls::TimeInterval());
353 
356 
368  virtual Event
369  nextEvent(const bsls::TimeInterval& timeout = bsls::TimeInterval());
370 
377  virtual int post(const MessageEvent& event);
378 
386  virtual int confirmMessage(const Message& message);
387 
396  virtual int confirmMessage(const MessageConfirmationCookie& cookie);
397 
408  virtual int confirmMessages(ConfirmEventBuilder* builder);
409 
412 
432  virtual int configureMessageDumping(const bslstl::StringRef& command);
433 };
434 
435 } // close package namespace
436 } // close enterprise namespace
437 
438 #endif
Provide Value-Semantic Type for a close queue operation status.
Provide Value-Semantic Type for a configure queue operation status.
Provide a builder for batching confirmation messages.
Provide a generic variant encompassing all types of events.
Provide a builder for bmqa::MessageEvent objects.
Provide a VST representing message properties.
Provide Value-Semantic Type for an open queue operation status.
Provide a value-semantic efficient identifier for a queue.
Provide a value-semantic type for options related to a queue.
Provide value-semantic type and utilities for a BlazingMQ queue URI.
A pure protocol for a session.
Definition: bmqa_abstractsession.h:50
virtual int confirmMessages(ConfirmEventBuilder *builder)
virtual int confirmMessage(const MessageConfirmationCookie &cookie)
virtual int startAsync(const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual int start(const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual void configureQueueAsync(QueueId *queueId, const bmqt::QueueOptions &options, const ConfigureQueueCallback &callback, const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual int confirmMessage(const Message &message)
virtual int openQueue(QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual ~AbstractSession()
Destructor.
virtual void closeQueueAsync(QueueId *queueId, const CloseQueueCallback &callback, const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual int closeQueue(QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual int configureMessageDumping(const bslstl::StringRef &command)
virtual void loadMessageProperties(MessageProperties *buffer)
virtual int openQueueAsync(QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval())
bsl::function< void(const bmqa::CloseQueueStatus &result)> CloseQueueCallback
Definition: bmqa_abstractsession.h:73
virtual void loadMessageEventBuilder(MessageEventBuilder *builder)
virtual int getQueueId(QueueId *queueId, const bmqt::Uri &uri)
virtual int closeQueueAsync(QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual CloseQueueStatus closeQueueSync(QueueId *queueId, const bsls::TimeInterval &timeout=bsls::TimeInterval())
bsl::function< void(const bmqa::ConfigureQueueStatus &result)> ConfigureQueueCallback
Definition: bmqa_abstractsession.h:66
virtual void openQueueAsync(bmqa::QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const OpenQueueCallback &callback, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval())
bsl::function< void(const bmqa::OpenQueueStatus &result)> OpenQueueCallback
Definition: bmqa_abstractsession.h:59
virtual int getQueueId(QueueId *queueId, const bmqt::CorrelationId &correlationId)
virtual OpenQueueStatus openQueueSync(QueueId *queueId, const bmqt::Uri &uri, bsls::Types::Uint64 flags, const bmqt::QueueOptions &options=bmqt::QueueOptions(), const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual int post(const MessageEvent &event)
virtual int configureQueue(QueueId *queueId, const bmqt::QueueOptions &options, const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual Event nextEvent(const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual void loadConfirmEventBuilder(ConfirmEventBuilder *builder)
virtual int configureQueueAsync(QueueId *queueId, const bmqt::QueueOptions &options, const bsls::TimeInterval &timeout=bsls::TimeInterval())
virtual ConfigureQueueStatus configureQueueSync(QueueId *queueId, const bmqt::QueueOptions &options, const bsls::TimeInterval &timeout=bsls::TimeInterval())
Definition: bmqa_closequeuestatus.h:62
Definition: bmqa_configurequeuestatus.h:61
Mechanism to build a batch of CONFIRM messages.
Definition: bmqa_confirmeventbuilder.h:157
A variant type encompassing all types of events.
Definition: bmqa_event.h:69
Cookie for async message confirmation.
Definition: bmqa_message.h:131
A builder for MessageEvent objects.
Definition: bmqa_messageeventbuilder.h:319
Definition: bmqa_messageevent.h:64
Provide a VST representing message properties.
Definition: bmqa_messageproperties.h:92
A message sent/received to/from the BlazingMQ broker.
Definition: bmqa_message.h:170
Definition: bmqa_openqueuestatus.h:62
Value-semantic efficient identifier for a queue.
Definition: bmqa_queueid.h:59
Definition: bmqt_correlationid.h:193
Value-semantic type for options related to a queue.
Definition: bmqt_queueoptions.h:66
Value semantic type representing a URI.
Definition: bmqt_uri.h:157
Definition: bmqa_abstractsession.h:42