public void Open() { _socketProcessor = new BlockingSocketProcessor(_host, _port, _protocolListener); _socketProcessor.Connect(); _amqpChannel = new AmqpChannel(_socketProcessor.ByteChannel); _readerRunner = new ReaderRunner(this); _readerThread = new Thread(new ThreadStart(_readerRunner.Run)); _readerThread.Start(); }
/// <summary> /// Connect to the specified broker /// </summary> /// <param name="broker">The broker to connect to</param> /// <param name="connection">The AMQ connection</param> public void Connect(IBrokerInfo broker, AMQConnection connection) { _stopEvent = new ManualResetEvent(false); _protocolListener = connection.ProtocolListener; _ioHandler = MakeBrokerConnection(broker, connection); // todo: get default read size from config! IProtocolDecoderOutput decoderOutput = new ProtocolDecoderOutput(_protocolListener); _amqpChannel = new AmqpChannel(new ByteChannel(_ioHandler), decoderOutput); // post an initial async read _amqpChannel.BeginRead(new AsyncCallback(OnAsyncReadDone), this); }