protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { Table = EncodingUtils.ReadFieldTable(buffer); IntegerOp = buffer.GetByte(); StringOp = buffer.GetByte(); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { ReplyCode = buffer.GetUInt16(); ReplyText = EncodingUtils.ReadShortString(buffer); Details = EncodingUtils.ReadFieldTable(buffer); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { VersionMajor = buffer.GetByte(); VersionMinor = buffer.GetByte(); ServerProperties = EncodingUtils.ReadFieldTable(buffer); Mechanisms = EncodingUtils.ReadLongstr(buffer); Locales = EncodingUtils.ReadLongstr(buffer); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { ClientProperties = EncodingUtils.ReadFieldTable(buffer); Mechanism = EncodingUtils.ReadShortString(buffer); Response = EncodingUtils.ReadLongstr(buffer); Locale = EncodingUtils.ReadShortString(buffer); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { Ticket = buffer.GetUInt16(); Queue = EncodingUtils.ReadShortString(buffer); Exchange = EncodingUtils.ReadShortString(buffer); RoutingKey = EncodingUtils.ReadShortString(buffer); bool[] bools = EncodingUtils.ReadBooleans(buffer); Nowait = bools[0]; Arguments = EncodingUtils.ReadFieldTable(buffer); }
public static AMQFrame CreateAMQFrame(ushort channelId, FieldTable MetaData) { TunnelRequestBody body = new TunnelRequestBody(); body.MetaData = MetaData; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { Ticket = buffer.GetUInt16(); Queue = EncodingUtils.ReadShortString(buffer); Exchange = EncodingUtils.ReadShortString(buffer); RoutingKey = EncodingUtils.ReadShortString(buffer); bool[] bools = EncodingUtils.ReadBooleans(buffer);Nowait = bools[0]; Arguments = EncodingUtils.ReadFieldTable(buffer); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { Ticket = buffer.GetUInt16(); Queue = EncodingUtils.ReadShortString(buffer); ConsumerTag = EncodingUtils.ReadShortString(buffer); bool[] bools = EncodingUtils.ReadBooleans(buffer); NoLocal = bools[0]; NoAck = bools[1]; Exclusive = bools[2]; Nowait = bools[3]; Arguments = EncodingUtils.ReadFieldTable(buffer); }
public static void WriteFieldTableBytes(ByteBuffer buffer, FieldTable table) { if (table != null) { table.WriteToBuffer(buffer); } else { buffer.Put((uint)0); } }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { Ticket = buffer.GetUInt16(); Queue = EncodingUtils.ReadShortString(buffer); bool[] bools = EncodingUtils.ReadBooleans(buffer); Passive = bools[0]; Durable = bools[1]; Exclusive = bools[2]; AutoDelete = bools[3]; Nowait = bools[4]; Arguments = EncodingUtils.ReadFieldTable(buffer); }
public static AMQFrame CreateAMQFrame(ushort channelId, FieldTable MetaData) { TunnelRequestBody body = new TunnelRequestBody(); body.MetaData = MetaData; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { Ticket = buffer.GetUInt16(); Queue = EncodingUtils.ReadShortString(buffer); ConsumerTag = EncodingUtils.ReadShortString(buffer); bool[] bools = EncodingUtils.ReadBooleans(buffer);NoLocal = bools[0]; NoAck = bools[1]; Exclusive = bools[2]; Nowait = bools[3]; Arguments = EncodingUtils.ReadFieldTable(buffer); }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort ReplyCode, string ReplyText, FieldTable Details) { ChannelAlertBody body = new ChannelAlertBody(); body.ReplyCode = ReplyCode; body.ReplyText = ReplyText; body.Details = Details; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { Ticket = buffer.GetUInt16(); Queue = EncodingUtils.ReadShortString(buffer); bool[] bools = EncodingUtils.ReadBooleans(buffer);Passive = bools[0]; Durable = bools[1]; Exclusive = bools[2]; AutoDelete = bools[3]; Nowait = bools[4]; Arguments = EncodingUtils.ReadFieldTable(buffer); }
public static AMQFrame CreateAMQFrame(ushort channelId, FieldTable Table, byte IntegerOp, byte StringOp) { TestTableBody body = new TestTableBody(); body.Table = Table; body.IntegerOp = IntegerOp; body.StringOp = StringOp; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
public void MethodReceived(AMQStateManager stateManager, AMQMethodEvent evt) { ConnectionStartBody body = (ConnectionStartBody) evt.Method; AMQProtocolSession ps = evt.ProtocolSession; try { if ( body.Mechanisms == null ) { throw new AMQException("mechanism not specified in ConnectionStart method frame"); } string mechanisms = Encoding.UTF8.GetString(body.Mechanisms); string selectedMechanism = ChooseMechanism(mechanisms); if ( selectedMechanism == null ) { throw new AMQException("No supported security mechanism found, passed: " + mechanisms); } byte[] saslResponse = DoAuthentication(selectedMechanism, ps); if (body.Locales == null) { throw new AMQException("Locales is not defined in Connection Start method"); } string allLocales = Encoding.ASCII.GetString(body.Locales); string[] locales = allLocales.Split(' '); string selectedLocale; if (locales != null && locales.Length > 0) { selectedLocale = locales[0]; } else { throw new AMQException("No locales sent from server, passed: " + locales); } stateManager.ChangeState(AMQState.CONNECTION_NOT_TUNED); FieldTable clientProperties = new FieldTable(); clientProperties["product"] = "Apache.Qpid.NET"; clientProperties["version"] = "1.0"; clientProperties["platform"] = GetFullSystemInfo(); clientProperties["instance"] = ps.ClientID; AMQFrame frame = ConnectionStartOkBody.CreateAMQFrame( evt.ChannelId, clientProperties, selectedMechanism, saslResponse, selectedLocale); ps.WriteFrame(frame); } catch (Exception e) { throw new AMQException(_log, "Unable to decode data: " + e, e); } }
public static AMQFrame CreateAMQFrame(ushort channelId, FieldTable ClientProperties, string Mechanism, byte[] Response, string Locale) { ConnectionStartOkBody body = new ConnectionStartOkBody(); body.ClientProperties = ClientProperties; body.Mechanism = Mechanism; body.Response = Response; body.Locale = Locale; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
// FIELD TABLES public static uint EncodedFieldTableLength(FieldTable table) { if (table == null) { // size is encoded as 4 octets return(4); } else { // size of the table plus 4 octets for the size return(table.EncodedSize + 4); } }
public static AMQFrame CreateAMQFrame(ushort channelId, FieldTable Table, byte IntegerOp, byte StringOp) { TestTableBody body = new TestTableBody(); body.Table = Table; body.IntegerOp = IntegerOp; body.StringOp = StringOp; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
public static AMQFrame CreateAMQFrame(ushort channelId, FieldTable ClientProperties, string Mechanism, byte[] Response, string Locale) { ConnectionStartOkBody body = new ConnectionStartOkBody(); body.ClientProperties = ClientProperties; body.Mechanism = Mechanism; body.Response = Response; body.Locale = Locale; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort ReplyCode, string ReplyText, FieldTable Details) { ChannelAlertBody body = new ChannelAlertBody(); body.ReplyCode = ReplyCode; body.ReplyText = ReplyText; body.Details = Details; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Queue, bool Passive, bool Durable, bool Exclusive, bool AutoDelete, bool Nowait, FieldTable Arguments) { QueueDeclareBody body = new QueueDeclareBody(); body.Ticket = Ticket; body.Queue = Queue; body.Passive = Passive; body.Durable = Durable; body.Exclusive = Exclusive; body.AutoDelete = AutoDelete; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
public static AMQFrame CreateAMQFrame(ushort channelId, byte VersionMajor, byte VersionMinor, FieldTable ServerProperties, byte[] Mechanisms, byte[] Locales) { ConnectionStartBody body = new ConnectionStartBody(); body.VersionMajor = VersionMajor; body.VersionMinor = VersionMinor; body.ServerProperties = ServerProperties; body.Mechanisms = Mechanisms; body.Locales = Locales; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
public QpidHeaders(FieldTable headers) { if ( headers == null ) throw new ArgumentNullException("headers"); _headers = headers; }
public FieldTable PopulateHeadersFromMessageProperties() { if (ContentHeaderProperties.Headers == null) { return null; } else { // // We need to convert every property into a String representation // Note that type information is preserved in the property name // FieldTable table = new FieldTable(); foreach (DictionaryEntry entry in ContentHeaderProperties.Headers) { string propertyName = (string) entry.Key; if (propertyName == null) { continue; } else { table[propertyName] = entry.Value.ToString(); } } return table; } }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Queue, string ConsumerTag, bool NoLocal, bool NoAck, bool Exclusive, bool Nowait, FieldTable Arguments) { BasicConsumeBody body = new BasicConsumeBody(); body.Ticket = Ticket; body.Queue = Queue; body.ConsumerTag = ConsumerTag; body.NoLocal = NoLocal; body.NoAck = NoAck; body.Exclusive = Exclusive; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Exchange, string Type, bool Passive, bool Durable, bool AutoDelete, bool Internal, bool Nowait, FieldTable Arguments) { ExchangeDeclareBody body = new ExchangeDeclareBody(); body.Ticket = Ticket; body.Exchange = Exchange; body.Type = Type; body.Passive = Passive; body.Durable = Durable; body.AutoDelete = AutoDelete; body.Internal = Internal; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
// FIELD TABLES public static uint EncodedFieldTableLength(FieldTable table) { if ( table == null ) { // size is encoded as 4 octets return 4; } else { // size of the table plus 4 octets for the size return table.EncodedSize + 4; } }
private String ConsumeFromQueue(String queueName, bool noLocal, bool exclusive, AcknowledgeMode acknowledgeMode, String tag, bool browse) { FieldTable args = new FieldTable(); if(browse) { args["x-filter-no-consume"] = true; } args["x-filter-auto-close"] = false; AMQFrame basicConsume = BasicConsumeBody.CreateAMQFrame(_channelId, 0, queueName, tag, noLocal, acknowledgeMode == AcknowledgeMode.NoAcknowledge, exclusive, true, args); _replayFrames.Add(basicConsume); _connection.ProtocolWriter.Write(basicConsume); return tag; }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Exchange, string Type, bool Passive, bool Durable, bool AutoDelete, bool Internal, bool Nowait, FieldTable Arguments) { ExchangeDeclareBody body = new ExchangeDeclareBody(); body.Ticket = Ticket; body.Exchange = Exchange; body.Type = Type; body.Passive = Passive; body.Durable = Durable; body.AutoDelete = AutoDelete; body.Internal = Internal; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
internal void DoBind(string queueName, string exchangeName, string routingKey, FieldTable args) { _logger.Debug(string.Format("QueueBind queueName={0} exchangeName={1} routingKey={2}, arg={3}", queueName, exchangeName, routingKey, args)); AMQFrame queueBind = QueueBindBody.CreateAMQFrame(_channelId, 0, queueName, exchangeName, routingKey, false, args); lock (_connection.FailoverMutex) { _connection.ConvenientProtocolWriter.SyncWrite(queueBind, typeof(QueueBindOkBody)); } // AS FIXME: wasnae me _replayFrames.Add(QueueBindBody.CreateAMQFrame(_channelId, 0, queueName, exchangeName, routingKey, true, args)); }
// AMQP-level method. private void DeclareExchange(ushort channelId, ushort ticket, string exchangeName, string exchangeClass, bool passive, bool durable, bool autoDelete, bool xinternal, bool noWait, FieldTable args) { _logger.Debug(String.Format("DeclareExchange channelId={0} exchangeName={1} exchangeClass={2}", channelId, exchangeName, exchangeClass)); AMQFrame declareExchange = ExchangeDeclareBody.CreateAMQFrame(channelId, ticket, exchangeName, exchangeClass, passive, durable, autoDelete, xinternal, noWait, args); if (noWait) { lock (_connection.FailoverMutex) { _connection.ProtocolWriter.Write(declareExchange); } // AS FIXME: wasnae me _replayFrames.Add(declareExchange); } else { throw new NotImplementedException("Don't use nowait=false with DeclareExchange"); //_connection.ConvenientProtocolWriter.SyncWrite(declareExchange, typeof (ExchangeDeclareOkBody)); } }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Queue, string Exchange, string RoutingKey, bool Nowait, FieldTable Arguments) { QueueBindBody body = new QueueBindBody(); body.Ticket = Ticket; body.Queue = Queue; body.Exchange = Exchange; body.RoutingKey = RoutingKey; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer) { MetaData = EncodingUtils.ReadFieldTable(buffer); }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Queue, string Exchange, string RoutingKey, bool Nowait, FieldTable Arguments) { QueueBindBody body = new QueueBindBody(); body.Ticket = Ticket; body.Queue = Queue; body.Exchange = Exchange; body.RoutingKey = RoutingKey; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return frame; }
/// <summary> Returns a field table containing patterns to match the test header exchange against. </summary> /// /// <returns> A field table containing test patterns. </returns> private FieldTable CreatePatternAsFieldTable() { FieldTable matchTable = new FieldTable(); matchTable["match1"] = "foo"; matchTable["match2"] = ""; matchTable["x-match"] = "all"; return matchTable; }
public static void WriteFieldTableBytes(ByteBuffer buffer, FieldTable table) { if ( table != null ) { table.WriteToBuffer(buffer); } else { buffer.Put((uint)0); } }
public void TestQueueBrowsingLVQ() { // Create a topic with one producer and two consumers. SetUpEndPoint(0, true, false, TEST_ROUTING_KEY2 + testId, AcknowledgeMode.AutoAcknowledge, false, ExchangeNameDefaults.DIRECT, true, true, TEST_ROUTING_KEY2 + testId, false, false); FieldTable args = new FieldTable(); args.SetBoolean("qpid.last_value_queue", true); args.SetString("qpid.last_value_queue_key", "key"); testChannel[0].DeclareQueue(TEST_ROUTING_KEY2 + testId, true, false, false, args); testChannel[0].Bind(TEST_ROUTING_KEY2 + testId, ExchangeNameDefaults.DIRECT, TEST_ROUTING_KEY2 + testId); Thread.Sleep(500); for (int i = 0; i < 12; i++) { ITextMessage msg = testChannel[0].CreateTextMessage("msg"); msg.Headers.SetInt("key", i%6); testProducer[0].Send(msg); } Thread.Sleep(2000); SetUpEndPoint(1, false, true, TEST_ROUTING_KEY2 + testId, AcknowledgeMode.NoAcknowledge, false, ExchangeNameDefaults.DIRECT, true, true, TEST_ROUTING_KEY2 + testId, false, true); SetUpEndPoint(2, false, true, TEST_ROUTING_KEY2 + testId, AcknowledgeMode.NoAcknowledge, false, ExchangeNameDefaults.DIRECT, true, true, TEST_ROUTING_KEY2 + testId, false, true); Thread.Sleep(500); ConsumeNMessagesOnly(6, "msg", testConsumer[1]); ConsumeNMessagesOnly(6, "msg", testConsumer[2]); // Clean up any open consumers at the end of the test. CloseEndPoint(2); CloseEndPoint(1); CloseEndPoint(0); }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Queue, string ConsumerTag, bool NoLocal, bool NoAck, bool Exclusive, bool Nowait, FieldTable Arguments) { BasicConsumeBody body = new BasicConsumeBody(); body.Ticket = Ticket; body.Queue = Queue; body.ConsumerTag = ConsumerTag; body.NoLocal = NoLocal; body.NoAck = NoAck; body.Exclusive = Exclusive; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
public static AMQFrame CreateAMQFrame(ushort channelId, ushort Ticket, string Queue, bool Passive, bool Durable, bool Exclusive, bool AutoDelete, bool Nowait, FieldTable Arguments) { QueueDeclareBody body = new QueueDeclareBody(); body.Ticket = Ticket; body.Queue = Queue; body.Passive = Passive; body.Durable = Durable; body.Exclusive = Exclusive; body.AutoDelete = AutoDelete; body.Nowait = Nowait; body.Arguments = Arguments; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }
static public void StaticDeclareExchange(string exchangeName, string exchangeClass, bool passive, bool durable, bool autoDelete, bool xinternal, bool noWait, FieldTable args) { DefaultInstance.DeclareExchange(DefaultInstance._channelId, 0, exchangeName, exchangeClass, passive, durable, autoDelete, xinternal, noWait, args); }
public static AMQFrame CreateAMQFrame(ushort channelId, byte VersionMajor, byte VersionMinor, FieldTable ServerProperties, byte[] Mechanisms, byte[] Locales) { ConnectionStartBody body = new ConnectionStartBody(); body.VersionMajor = VersionMajor; body.VersionMinor = VersionMinor; body.ServerProperties = ServerProperties; body.Mechanisms = Mechanisms; body.Locales = Locales; AMQFrame frame = new AMQFrame(); frame.Channel = channelId; frame.BodyFrame = body; return(frame); }