diff options
| author | Alan Conway <aconway@apache.org> | 2008-05-26 18:10:05 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-05-26 18:10:05 +0000 |
| commit | ce7678789fe3e8c5caebb59a26aa418fbb95e5d3 (patch) | |
| tree | affd8e2de460cba285e7c25e15f5c3d94444f905 /cpp/src/qpid/client/SessionBase_0_10.h | |
| parent | 0b56077cbb8b6e9cdd982cbdeaa3ec6fe1bd5434 (diff) | |
| download | qpid-python-ce7678789fe3e8c5caebb59a26aa418fbb95e5d3.tar.gz | |
Changes to Session API:
- Session is synchronous, no futures.
- AsyncSession is async, returns futures.
- Conversion functions sync(s) async(s) return a sync/async view of session s.
- Connection::newSession - takes name, no timeout
- SessionBase::getId - returns SessionId not UUID.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@660258 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/SessionBase_0_10.h')
| -rw-r--r-- | cpp/src/qpid/client/SessionBase_0_10.h | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/cpp/src/qpid/client/SessionBase_0_10.h b/cpp/src/qpid/client/SessionBase_0_10.h new file mode 100644 index 0000000000..f9ced049a9 --- /dev/null +++ b/cpp/src/qpid/client/SessionBase_0_10.h @@ -0,0 +1,104 @@ +#ifndef QPID_CLIENT_SESSIONBASE_H +#define QPID_CLIENT_SESSIONBASE_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/SessionId.h" +#include "qpid/framing/amqp_structs.h" +#include "qpid/framing/ProtocolVersion.h" +#include "qpid/framing/MethodContent.h" +#include "qpid/framing/TransferContent.h" +#include "qpid/client/Completion.h" +#include "qpid/client/ConnectionImpl.h" +#include "qpid/client/Execution.h" +#include "qpid/client/SessionImpl.h" +#include "qpid/client/TypedResult.h" +#include "qpid/shared_ptr.h" +#include <string> + +namespace qpid { +namespace client { + +using std::string; +using framing::Content; +using framing::FieldTable; +using framing::MethodContent; +using framing::SequenceNumber; +using framing::SequenceSet; +using framing::SequenceNumberSet; +using qpid::SessionId; +using framing::Xid; + +enum CreditUnit { MESSAGE=0, BYTE=1 }; + +/** + * Base class for handles to an AMQP session. + * + * Subclasses provide the AMQP commands for a given + * version of the protocol. + */ +class SessionBase_0_10 { + public: + + typedef framing::TransferContent DefaultContent; + + SessionBase_0_10(); + ~SessionBase_0_10(); + + /** Get the next message frame-set from the session. */ + framing::FrameSet::shared_ptr get(); + + /** Get the session ID */ + SessionId getId() const; + + /** Close the session. + * A session is automatically closed when all handles to it are destroyed. + */ + void close(); + + /** Synchronize the session: sync() waits until all commands + * issued on this session have been completed. It is equivalent to + * calling Session::executionSync() + * + * Note sync() is always synchronous, even on an AsyncSession object + * because that's almost always what you want. You can call + * AsyncSession::executionSync() directly in the unusual event + * that you want to do an asynchronous sync. + */ + void sync(); + + /** Set the timeout for this session. */ + uint32_t timeout(uint32_t seconds); + + Execution& getExecution(); + void flush(); + void markCompleted(const framing::SequenceNumber& id, bool cumulative, bool notifyPeer); + void sendCompletion(); + + protected: + boost::shared_ptr<SessionImpl> impl; + friend class SessionBase_0_10Access; +}; + +}} // namespace qpid::client + +#endif /*!QPID_CLIENT_SESSIONBASE_H*/ |
