public void Connect() { IntPtr returnValue = apama_session_create( new StringBuilder(_protocol) ); apama_session_internal internalSession = (apama_session_internal)Marshal.PtrToStructure(returnValue, typeof(apama_session_internal)); if(internalSession == null) throw new ApamaException("Could not connect"); apama_session session = new apama_session(); session.ReadFromIntPtr(returnValue, internalSession); _currentSession = session; }
public void Close() { if(_currentSession != null) { ApamaReturnValue returnVal = (ApamaReturnValue)apama_session_destroy(_currentSession.apama_session_ptr); if(returnVal != ApamaReturnValue.APAMA_ERROR_OK) throw new ApamaException("Not a valid session"); _currentSession = null; } }