Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qmf/engine/ResilientConnection.h
Go to the documentation of this file.
00001 #ifndef _QmfEngineResilientConnection_
00002 #define _QmfEngineResilientConnection_
00003 
00004 /*
00005  * Licensed to the Apache Software Foundation (ASF) under one
00006  * or more contributor license agreements.  See the NOTICE file
00007  * distributed with this work for additional information
00008  * regarding copyright ownership.  The ASF licenses this file
00009  * to you under the Apache License, Version 2.0 (the
00010  * "License"); you may not use this file except in compliance
00011  * with the License.  You may obtain a copy of the License at
00012  * 
00013  *   http://www.apache.org/licenses/LICENSE-2.0
00014  * 
00015  * Unless required by applicable law or agreed to in writing,
00016  * software distributed under the License is distributed on an
00017  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00018  * KIND, either express or implied.  See the License for the
00019  * specific language governing permissions and limitations
00020  * under the License.
00021  */
00022 
00023 #include <qmf/engine/Message.h>
00024 #include <qmf/engine/ConnectionSettings.h>
00025 #include <string>
00026 
00027 namespace qmf {
00028 namespace engine {
00029 
00030     class ResilientConnectionImpl;
00031 
00035     struct ResilientConnectionEvent {
00036         enum EventKind {
00037             CONNECTED      = 1,
00038             DISCONNECTED   = 2,
00039             SESSION_CLOSED = 3,
00040             RECV           = 4
00041         };
00042 
00043         EventKind kind;
00044         void*     sessionContext; // SESSION_CLOSED, RECV
00045         char*     errorText;      // DISCONNECTED, SESSION_CLOSED
00046         Message   message;        // RECV
00047     };
00048 
00049     class SessionHandle {
00050         friend class ResilientConnectionImpl;
00051         void* impl;
00052     };
00053 
00062     class ResilientConnection {
00063     public:
00064 
00072         ResilientConnection(const ConnectionSettings& settings);
00073         ~ResilientConnection();
00074 
00079         bool isConnected() const;
00080 
00086         bool getEvent(ResilientConnectionEvent& event);
00087 
00092         void popEvent();
00093 
00103         bool createSession(const char* name, void* sessionContext, SessionHandle& handle);
00104 
00109         void destroySession(SessionHandle handle);
00110 
00116         void sendMessage(SessionHandle handle, Message& message);
00117 
00123         void declareQueue(SessionHandle handle, char* queue);
00124 
00130         void deleteQueue(SessionHandle handle, char* queue);
00131 
00139         void bind(SessionHandle handle, char* exchange, char* queue, char* key);
00140 
00148         void unbind(SessionHandle handle, char* exchange, char* queue, char* key);
00149 
00156         void setNotifyFd(int fd);
00157 
00164         void notify();
00165 
00166     private:
00167         ResilientConnectionImpl* impl;
00168     };
00169 }
00170 }
00171 
00172 #endif
00173 

Qpid C++ API Reference
Generated on Thu Aug 23 2012 for Qpid C++ Client API by doxygen 1.7.5