From 5518fd899d97459bcd8c45b850da447697a60fe8 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Wed, 23 Apr 2008 23:56:38 +0000 Subject: QPID-832 sync from M2.x git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@651113 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/dotnet/Qpid.Messaging/AcknowledgeMode.cs | 42 ++++ .../Qpid.Messaging/ChannelLimitReachedException.cs | 60 +++++ qpid/dotnet/Qpid.Messaging/DeliveryMode.cs | 28 +++ .../Qpid.Messaging/ExchangeClassConstants.cs | 29 +++ qpid/dotnet/Qpid.Messaging/ExchangeNameDefaults.cs | 42 ++++ qpid/dotnet/Qpid.Messaging/IBytesMessage.cs | 63 ++++++ qpid/dotnet/Qpid.Messaging/IChannel.cs | 252 +++++++++++++++++++++ qpid/dotnet/Qpid.Messaging/ICloseable.cs | 38 ++++ qpid/dotnet/Qpid.Messaging/IConnection.cs | 55 +++++ qpid/dotnet/Qpid.Messaging/IConnectionFactory.cs | 28 +++ qpid/dotnet/Qpid.Messaging/IConnectionListener.cs | 59 +++++ qpid/dotnet/Qpid.Messaging/IFieldTable.cs | 42 ++++ qpid/dotnet/Qpid.Messaging/IHeaders.cs | 67 ++++++ qpid/dotnet/Qpid.Messaging/IMessage.cs | 97 ++++++++ qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs | 79 +++++++ qpid/dotnet/Qpid.Messaging/IMessagePublisher.cs | 92 ++++++++ qpid/dotnet/Qpid.Messaging/ITextMessage.cs | 27 +++ .../Qpid.Messaging/MessageConsumerBuilder.cs | 105 +++++++++ .../Qpid.Messaging/MessageNotReadableException.cs | 39 ++++ .../Qpid.Messaging/MessageNotWritableException.cs | 38 ++++ .../Qpid.Messaging/MessagePublisherBuilder.cs | 91 ++++++++ .../Qpid.Messaging/Properties/AssemblyInfo.cs | 56 +++++ qpid/dotnet/Qpid.Messaging/Qpid.Messaging.csproj | 69 ++++++ qpid/dotnet/Qpid.Messaging/QpidException.cs | 43 ++++ .../Qpid.Messaging/ResourceAllocationException.cs | 39 ++++ qpid/dotnet/Qpid.Messaging/default.build | 24 ++ 26 files changed, 1604 insertions(+) create mode 100644 qpid/dotnet/Qpid.Messaging/AcknowledgeMode.cs create mode 100644 qpid/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs create mode 100644 qpid/dotnet/Qpid.Messaging/DeliveryMode.cs create mode 100644 qpid/dotnet/Qpid.Messaging/ExchangeClassConstants.cs create mode 100644 qpid/dotnet/Qpid.Messaging/ExchangeNameDefaults.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IBytesMessage.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IChannel.cs create mode 100644 qpid/dotnet/Qpid.Messaging/ICloseable.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IConnection.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IConnectionFactory.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IConnectionListener.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IFieldTable.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IHeaders.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IMessage.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs create mode 100644 qpid/dotnet/Qpid.Messaging/IMessagePublisher.cs create mode 100644 qpid/dotnet/Qpid.Messaging/ITextMessage.cs create mode 100644 qpid/dotnet/Qpid.Messaging/MessageConsumerBuilder.cs create mode 100644 qpid/dotnet/Qpid.Messaging/MessageNotReadableException.cs create mode 100644 qpid/dotnet/Qpid.Messaging/MessageNotWritableException.cs create mode 100644 qpid/dotnet/Qpid.Messaging/MessagePublisherBuilder.cs create mode 100644 qpid/dotnet/Qpid.Messaging/Properties/AssemblyInfo.cs create mode 100644 qpid/dotnet/Qpid.Messaging/Qpid.Messaging.csproj create mode 100644 qpid/dotnet/Qpid.Messaging/QpidException.cs create mode 100644 qpid/dotnet/Qpid.Messaging/ResourceAllocationException.cs create mode 100644 qpid/dotnet/Qpid.Messaging/default.build (limited to 'qpid/dotnet/Qpid.Messaging') diff --git a/qpid/dotnet/Qpid.Messaging/AcknowledgeMode.cs b/qpid/dotnet/Qpid.Messaging/AcknowledgeMode.cs new file mode 100644 index 0000000000..4896b64f68 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/AcknowledgeMode.cs @@ -0,0 +1,42 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public enum AcknowledgeMode + { + AutoAcknowledge, + ClientAcknowledge, + DupsOkAcknowledge, + SessionTransacted, + + /// + /// Indicates that no client acknowledgements are required. Broker assumes that once it has + /// delivered a message packet successfully it is acknowledged. + /// + NoAcknowledge, + + /// + /// Pre acknowledge means that an ack is sent per message but sent before user code has processed + /// the message (i.e. before the onMessage() call or the receive() method has returned). + /// + PreAcknowledge + } +} diff --git a/qpid/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs b/qpid/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs new file mode 100644 index 0000000000..8b43422f5c --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs @@ -0,0 +1,60 @@ +/* + * + * 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. + * + */ + +using System; +using System.Runtime.Serialization; + +namespace Apache.Qpid.Messaging +{ + [Serializable] + public class ChannelLimitReachedException : ResourceAllocationException + { + private long _limit; + + public ChannelLimitReachedException(long limit) + : base("Unable to create session since maximum number of sessions per connection is " + + limit + ". Either close one or more sessions or increase the " + + "maximum number of sessions per connection (or contact your OpenAMQ administrator.") + { + _limit = limit; + } + + protected ChannelLimitReachedException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + _limit = info.GetInt64("Limit"); + } + + public long Limit + { + get + { + return _limit; + } + } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("Limit", _limit); + } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/DeliveryMode.cs b/qpid/dotnet/Qpid.Messaging/DeliveryMode.cs new file mode 100644 index 0000000000..3c4713ee2a --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/DeliveryMode.cs @@ -0,0 +1,28 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public enum DeliveryMode + { + NonPersistent, + Persistent + } +} diff --git a/qpid/dotnet/Qpid.Messaging/ExchangeClassConstants.cs b/qpid/dotnet/Qpid.Messaging/ExchangeClassConstants.cs new file mode 100644 index 0000000000..984e8b0f17 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/ExchangeClassConstants.cs @@ -0,0 +1,29 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public class ExchangeClassConstants + { + public readonly static string TOPIC = "topic"; + public readonly static string DIRECT = "direct"; + public readonly static string HEADERS = "headers"; + } +} diff --git a/qpid/dotnet/Qpid.Messaging/ExchangeNameDefaults.cs b/qpid/dotnet/Qpid.Messaging/ExchangeNameDefaults.cs new file mode 100644 index 0000000000..2689fb5e46 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/ExchangeNameDefaults.cs @@ -0,0 +1,42 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public class ExchangeNameDefaults + { + public readonly static string TOPIC = "amq.topic"; + public readonly static string DIRECT = "amq.direct"; + public readonly static string HEADERS = "amq.match"; + public readonly static string FANOUT = "amq.fanout"; + + /// Defines the identifying type name of topic exchanges. + public readonly static string TOPIC_EXCHANGE_CLASS = "topic"; + + /// Defines the identifying type name of direct exchanges. + public readonly static string DIRECT_EXCHANGE_CLASS = "direct"; + + /// Defines the identifying type name of headers exchanges. + public readonly static string HEADERS_EXCHANGE_CLASS = "headers"; + + /// Defines the identifying type name of fanout exchanges. + public readonly static string FANOUT_EXCHANGE_CLASS = "fanout"; + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IBytesMessage.cs b/qpid/dotnet/Qpid.Messaging/IBytesMessage.cs new file mode 100644 index 0000000000..5be942423d --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IBytesMessage.cs @@ -0,0 +1,63 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public interface IBytesMessage : IMessage + { + long BodyLength { get; } + + bool ReadBoolean(); + void WriteBoolean(bool value); + + byte ReadByte(); + int ReadBytes(byte[] array); + int ReadBytes(byte[] array, int length); + void WriteByte(byte value); + void WriteBytes(byte[] value); + void WriteBytes(byte[] value, int offset, int length); + + char ReadChar(); + void WriteChar(char value); + + double ReadDouble(); + void WriteDouble(double value); + + float ReadFloat(); + void WriteFloat(float value); + + int ReadInt(); + void WriteInt(int value); + + long ReadLong(); + void WriteLong(long value); + + short ReadShort(); + void WriteShort(short value); + + short ReadSignedByte(); + void WriteSignedByte(short value); + + string ReadUTF(); + void WriteUTF(string value); + + void Reset(); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IChannel.cs b/qpid/dotnet/Qpid.Messaging/IChannel.cs new file mode 100644 index 0000000000..461867b34a --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IChannel.cs @@ -0,0 +1,252 @@ +/* + * + * 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. + * + */ +using System; + +namespace Apache.Qpid.Messaging +{ + public delegate void MessageReceivedDelegate(IMessage msg); + + /// + /// IChannel provides methods to access the commands in AMQP that operate at the channel level. This can be summarized as + /// the ability to declare queues and exchanges, bind queues to exchanges, create messages of various types, declare transaction + /// boundaries (commit and rollback), and to set up producers and consumers on the channel. + /// + ///

You can create a channel by using the CreateChannel() method + /// of the connection object. + /// + ///

+ ///
CRC Card
Responsibilities + ///
Declare queues. + ///
Declare exchanges. + ///
Bind queues to exchanges. + ///
Create messages. + ///
Set up message consumers on the channel. + ///
Set up message producers on the channel. + ///
Commit the current transaction. + ///
Roll-back the current transaction. + ///
Close the channel. + ///
+ ///

+ public interface IChannel : IDisposable, ICloseable + { + /// + /// Acknowledge mode for messages received. + /// + AcknowledgeMode AcknowledgeMode { get; } + + /// + /// True if the channel should use transactions. + /// + bool Transacted { get; } + + /// + /// Prefetch value to be used as the default for + /// consumers created on this channel. + /// + int DefaultPrefetch { get; } + + /// + /// Prefetch low value to be used as the default for + /// consumers created on this channel. + /// + int DefaultPrefetchLow { get; } + + /// + /// Prefetch high value to be used as the default for + /// consumers created on this channel. + /// + int DefaultPrefetchHigh { get; } + + /// + /// Declare a new exchange. + /// + /// Name of the exchange + /// Class of the exchange, from + void DeclareExchange(string exchangeName, string exchangeClass); + + /// + /// Declare a new exchange using the default exchange class. + /// + /// Name of the exchange + void DeleteExchange(string exchangeName); + + /// + /// Declare a new queue with the specified set of arguments. + /// + /// Name of the queue + /// True if the queue should be durable + /// True if the queue should be exclusive to this channel + /// True if the queue should be deleted when the channel closes + void DeclareQueue(string queueName, bool isDurable, bool isExclusive, bool isAutoDelete); + + /// + /// Delete a queue with the specifies arguments. + /// + /// Name of the queue to delete + /// If true, the queue will not deleted if it has no consumers + /// If true, the queue will not deleted if it has no messages + /// If true, the server will not respond to the method + void DeleteQueue(string queueName, bool ifUnused, bool ifEmpty, bool noWait); + + /// + /// Generate a new Unique name to use for a queue. + /// + /// A unique name to this channel + string GenerateUniqueName(); + + /// + /// Removes all messages from a queue. + /// + /// Name of the queue to delete + /// If true, the server will not respond to the method + void PurgeQueue(string queueName, bool noWait); + + /// + /// Bind a queue to the specified exchange. + /// + /// Name of queue to bind + /// Name of exchange to bind to + /// Routing key + void Bind(string queueName, string exchangeName, string routingKey); + + /// + /// Bind a queue to the specified exchange. + /// + /// Name of queue to bind + /// Name of exchange to bind to + /// Routing key + /// Table of arguments for the binding. Used to bind with a Headers Exchange + void Bind(string queueName, string exchangeName, string routingKey, IFieldTable args); + + /// + /// Create a new empty message with no body. + /// + /// The new message + IMessage CreateMessage(); + + /// + /// Create a new message of the specified MIME type. + /// + /// The mime type to create + /// The new message + IMessage CreateMessage(string mimeType); + + /// + /// Creates a new message for bytes (application/octet-stream). + /// + /// The new message + IBytesMessage CreateBytesMessage(); + + /// + /// Creates a new text message (text/plain) with empty content. + /// + /// The new message + ITextMessage CreateTextMessage(); + + /// + /// Creates a new text message (text/plain) with a body. + /// + /// Initial body of the message + /// The new message + ITextMessage CreateTextMessage(string initialValue); + + #region Consuming + + /// + /// Creates a new Consumer using the builder pattern. + /// + /// Name of queue to receive messages from + /// The builder object + MessageConsumerBuilder CreateConsumerBuilder(string queueName); + + /// + /// Creates a new consumer. + /// + /// Name of queue to receive messages from + /// Low prefetch value + /// High prefetch value + /// If true, messages sent on this channel will not be received by this consumer + /// If true, the consumer opens the queue in exclusive mode + /// The new consumer + IMessageConsumer CreateConsumer(string queueName, + int prefetchLow, + int prefetchHigh, + bool noLocal, + bool exclusive); + + /// + /// Unsubscribe from a queue. + /// + /// Subscription name + void Unsubscribe(string subscriptionName); + + #endregion + + #region Publishing + + /// + /// Create a new message publisher using the builder pattern. + /// + /// The builder object + MessagePublisherBuilder CreatePublisherBuilder(); + + /// + /// Create a new message publisher. + /// + /// Name of exchange to publish to + /// Routing key + /// Default delivery mode + /// Default TTL time of messages + /// If true, sent immediately + /// If true, the broker will return an error + /// (as a connection exception) if the message cannot be delivered + /// Default message priority + /// The new message publisher + IMessagePublisher CreatePublisher(string exchangeName, + string routingKey, + DeliveryMode deliveryMode, + long timeToLive, + bool immediate, + bool mandatory, + int priority); + + #endregion + + #region Transactions + + /// + /// Recover after transaction failure. + /// + void Recover(); + + /// + /// Commit the transaction. + /// + void Commit(); + + /// + /// Rollback the transaction. + /// + void Rollback(); + + #endregion + } +} diff --git a/qpid/dotnet/Qpid.Messaging/ICloseable.cs b/qpid/dotnet/Qpid.Messaging/ICloseable.cs new file mode 100644 index 0000000000..3c9d66047d --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/ICloseable.cs @@ -0,0 +1,38 @@ +/* + * + * 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. + * + */ +using System; + +namespace Apache.Qpid.Messaging +{ + /// An ICloseable is a resource that can be explicitly closed. Generally speaking a closed resource can no longer be used, and the + /// act of closing a resource is usually interpreted as a signal that the closed item can have its resource cleaned up and de-allocated. + /// + ///

+ ///
CRC Card
Responsibilities Collaborations + ///
Close (and clean-up) a resource. + ///
+ ///

+ public interface ICloseable + { + /// Close the resource. + void Close(); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IConnection.cs b/qpid/dotnet/Qpid.Messaging/IConnection.cs new file mode 100644 index 0000000000..f664137e02 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IConnection.cs @@ -0,0 +1,55 @@ +/* + * + * 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. + * + */ +using System; + +namespace Apache.Qpid.Messaging +{ + public delegate void ExceptionListenerDelegate(Exception ex); + + public interface IConnection : IDisposable, ICloseable + { + /// + /// The connection listener that has been registered with this connection. + /// + IConnectionListener ConnectionListener + { + get; + set; + } + + ExceptionListenerDelegate ExceptionListener { get; set; } + + string ClientID { get; set; } + + /// the maximum number of sessions supported by this Connection + int MaximumChannelCount + { + get; + } + + IChannel CreateChannel(bool transacted, AcknowledgeMode acknowledgeMode); + IChannel CreateChannel(bool transacted, AcknowledgeMode acknowledgeMode, int prefetch); + IChannel CreateChannel(bool transacted, AcknowledgeMode acknowledgeMode, int prefetchHigh, int prefetchLow); + + void Start(); + void Stop(); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IConnectionFactory.cs b/qpid/dotnet/Qpid.Messaging/IConnectionFactory.cs new file mode 100644 index 0000000000..f141d509be --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IConnectionFactory.cs @@ -0,0 +1,28 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public interface IConnectionFactory + { + IConnection CreateConnection(); + IConnection CreateConnection(string userId, string password); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IConnectionListener.cs b/qpid/dotnet/Qpid.Messaging/IConnectionListener.cs new file mode 100644 index 0000000000..02d9eb38da --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IConnectionListener.cs @@ -0,0 +1,59 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public interface IConnectionListener + { + /// + /// Called when bytes have been transmitted to the server + /// + /// count the number of bytes sent in total since the connection was opened + void BytesSent(long count); + + /// + /// Called when some bytes have been received on a connection + /// + /// count the number of bytes received in total since the connection was opened + void BytesReceived(long count); + + /// + /// Called after the infrastructure has detected that failover is required but before attempting failover. + /// + /// redirect true if the broker requested redirect. false if failover is occurring due to a connection error. + /// true to continue failing over, false to veto failover and raise a connection exception + bool PreFailover(bool redirect); + + /// + /// Called after connection has been made to another broker after failover has been started but before + /// any resubscription has been done. + /// true to continue with resubscription, false to prevent automatic resubscription. This is useful in + /// cases where the application wants to handle resubscription. Note that in the latter case all sessions, producers + /// and consumers are invalidated. + /// + /// Called once failover has completed successfully. This is called irrespective of whether the client has + /// vetoed automatic resubscription. + /// + void FailoverComplete(); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IFieldTable.cs b/qpid/dotnet/Qpid.Messaging/IFieldTable.cs new file mode 100644 index 0000000000..730ce399d4 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IFieldTable.cs @@ -0,0 +1,42 @@ +/* + * + * 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. + * + */ +using System.Collections; + +namespace Apache.Qpid.Messaging +{ + public interface IFieldTable : IEnumerable + { + int Count { get; } + + object this[string key] { get; set; } + + /// + /// Adds all the items from another field table in this one. + /// Will overwrite any items in the current table with the same key. + /// + /// the source field table + void AddAll(IFieldTable source); + + bool Contains(string s); + void Clear(); + void Remove(string key); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IHeaders.cs b/qpid/dotnet/Qpid.Messaging/IHeaders.cs new file mode 100644 index 0000000000..7fdf26ebda --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IHeaders.cs @@ -0,0 +1,67 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + /// + /// IHeaders represents the header fields of an AMQ message and provides methods to access those fields. There are accessor methods to + /// get and set each header field for each supported header field data type. + /// + /// + /// + /// + /// + ///
CRC Card
Responsibilities
Provide accessors for all supported header field types.
Check if a set of headers contains a named property.
+ /// + ///
+ public interface IHeaders + { + bool Contains(string name); + + object this[string name] { get; set; } + + bool GetBoolean(string name); + void SetBoolean(string name, bool value); + + byte GetByte(string name); + void SetByte(string name, byte value); + + //sbyte GetSByte(string name); + //void SetSByte(string name, sbyte value); + + short GetShort(string name); + void SetShort(string name, short value); + + int GetInt(string name); + void SetInt(string name, int value); + + long GetLong(string name); + void SetLong(string name, long value); + + float GetFloat(string name); + void SetFloat(string name, float value); + + double GetDouble(string name); + void SetDouble(string name, double value); + + string GetString(string name); + void SetString(string name, string value); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IMessage.cs b/qpid/dotnet/Qpid.Messaging/IMessage.cs new file mode 100644 index 0000000000..20ae5ee130 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IMessage.cs @@ -0,0 +1,97 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public interface IMessage + { + /// + /// The MIME Content Type + /// + string ContentType { get; set;} + /// + /// The MIME Content Encoding + /// + string ContentEncoding { get; set; } + /// + /// The application correlation identifier + /// + string CorrelationId { get; set; } + /// + /// The application correlation identifier, as an array of bytes + /// + byte[] CorrelationIdAsBytes { get; set; } + /// + /// Non-persistent (1) or persistent (2) + /// + DeliveryMode DeliveryMode { get; set; } + /// + /// Message expiration specification + /// + long Expiration { get; set; } + /// + /// The application message identifier + /// + string MessageId { get; set; } + /// + /// The message priority, 0 to 9 + /// + byte Priority { get; set; } + /// + /// True if the message has been redelivered + /// + bool Redelivered { get; set; } + /// + /// Exchange name of the reply-to address + /// + string ReplyToExchangeName { get; set; } + /// + /// Routing key of the reply-to address + /// + string ReplyToRoutingKey { get; set; } + /// + /// The message timestamp + /// + long Timestamp { get; set; } + /// + /// The message type name + /// + string Type { get; set; } + /// + /// Message headers + /// + IHeaders Headers { get; } + /// + /// The creating user id + /// + string UserId { get; set; } + /// + /// The creating application id + /// + string AppId { get; set; } + /// + /// Intra-cluster routing identifier + /// + string ClusterId { get; set; } + + void Acknowledge(); + void ClearBody(); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs b/qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs new file mode 100644 index 0000000000..86b5405707 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IMessageConsumer.cs @@ -0,0 +1,79 @@ +/* + * + * 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. + * + */ +using System; + +namespace Apache.Qpid.Messaging +{ + /// + /// Describes an object that can be used to receive (consume) + /// messages from an AMQP queue. + /// + /// + /// Consumers are created using either + /// or using + /// the builder pattern (preferred) with + /// . + /// + /// + /// Consumers offer two different ways of receiving messages: + /// You can attach a delegate to the + /// event and be notified when a message arrives, or you can + /// use the and + /// methods to control when you receive messages. Be aware that you can use + /// one or the other, but not both at the same time. + /// + /// + /// Regardless of which method you choose, the prefetch settings + /// specified when creating the channel will still control when messages + /// are actually received from the AMQP broker. Any messages that arrive + /// between the prefetch window will be queued by the channel + /// until they can be delivered to the consumer (either though the event + /// or until the consumer actively calls ). + /// + /// + public interface IMessageConsumer : IDisposable, ICloseable + { + /// + /// Fired when a message is received from the broker by the consumer + /// + MessageReceivedDelegate OnMessage { get; set; } + + /// + /// Wait infinitely for a message to be received from the broker + /// + /// The message received + IMessage Receive(); + + /// + /// Wait the specified time until a message is receive from the broker + /// + /// Maximum number of milliseconds to wait for a message + /// The message received, or null if the timeout expires + IMessage Receive(long delay); + + /// + /// Return a message if one is already available in the channel. + /// Does not wait for one to be received from the broker. + /// + /// The message, if it was available, otherwise null + IMessage ReceiveNoWait(); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/IMessagePublisher.cs b/qpid/dotnet/Qpid.Messaging/IMessagePublisher.cs new file mode 100644 index 0000000000..d895a9749b --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/IMessagePublisher.cs @@ -0,0 +1,92 @@ +/* + * + * 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. + * + */ +using System; + +namespace Apache.Qpid.Messaging +{ + /// + /// Defines an object capable of publishing messages + /// to an AMQP broker. + /// + /// + /// A publisher can be created using either + /// or + /// using the builder pattern (preferred) with + /// + /// + public interface IMessagePublisher : IDisposable, ICloseable + { + /// + /// Default delivery mode to use with this publisher + /// + DeliveryMode DeliveryMode { get; set; } + /// + /// Name of exchange messages are published to + /// + string ExchangeName { get; } + /// + /// Routing key used when publishing messages + /// + string RoutingKey { get; } + /// + /// If true, a message ID will not be generated by the publisher + /// when sending the message + /// + bool DisableMessageID { get; set; } + /// + /// If true, no timestamp will be added to the message + /// when publishing it + /// + bool DisableMessageTimestamp { get; set; } + /// + /// Default priority used when publishing messages + /// + int Priority { get; set; } + /// + /// Default time to live used when publishing messages + /// + long TimeToLive { get; set; } + /// + /// Set the default MIME type for messages produced by this producer. + /// This reduces the overhead of each message. + /// + string MimeType { get; set; } + /// + /// Set the default encoding for messages produced by this producer. + /// This reduces the overhead of each message. + /// + string Encoding { get; set; } + + /// + /// Publish a message, using any default values configured + /// + /// Message to publish + void Send(IMessage msg); + /// + /// Publish a message with the specified options + /// + /// Message to publish + /// Delivery mode to use + /// Priority of the message + /// Time to live of the message + void Send(IMessage msg, DeliveryMode deliveryMode, int priority, long timeToLive); + } +} diff --git a/qpid/dotnet/Qpid.Messaging/ITextMessage.cs b/qpid/dotnet/Qpid.Messaging/ITextMessage.cs new file mode 100644 index 0000000000..902beb70f8 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/ITextMessage.cs @@ -0,0 +1,27 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public interface ITextMessage : IMessage + { + string Text { get; set; } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/MessageConsumerBuilder.cs b/qpid/dotnet/Qpid.Messaging/MessageConsumerBuilder.cs new file mode 100644 index 0000000000..fbf94d7c27 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/MessageConsumerBuilder.cs @@ -0,0 +1,105 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + /// + /// MessageConsumerBuilder provides a builder with a fluent interface to assist with creating message consumers on a channel. + /// + ///

+ ///
CRC Card
Responsibilities Collaborations + ///
Create message consumers from consume parameters. + ///
+ ///

+ /// + /// It may be better to replace the Create method with a DeclareBindAndCreate method, that declares and binds the consumers queue, + /// as well as creating the consumer. This is a common use case, so the method will generally be usefull. Need to consider situations where + /// the declare and bind is not to be done, for example when resubscribing to a durable subscription. There may be others too. + public class MessageConsumerBuilder + { + private bool _noLocal = false; + + private bool _exclusive = false; + + //private bool _durable = false; + //private string _subscriptionName = null; + + private IChannel _channel; + + private readonly string _queueName; + + private int _prefetchLow; + + private int _prefetchHigh; + + public MessageConsumerBuilder(IChannel channel, string queueName) + { + _channel = channel; + _queueName = queueName; + _prefetchHigh = _channel.DefaultPrefetchHigh; + _prefetchLow = _channel.DefaultPrefetchLow; + } + + public MessageConsumerBuilder WithPrefetchLow(int prefetchLow) + { + _prefetchLow = prefetchLow; + return this; + } + + public MessageConsumerBuilder WithPrefetchHigh(int prefetchHigh) + { + _prefetchHigh = prefetchHigh; + return this; + } + + public MessageConsumerBuilder WithNoLocal(bool noLocal) + { + _noLocal = noLocal; + return this; + } + + public MessageConsumerBuilder WithExclusive(bool exclusive) + { + _exclusive = exclusive; + return this; + } + + /* + public MessageConsumerBuilder WithDurable(bool durable) + { + _durable = durable; + return this; + } + */ + + /* + public MessageConsumerBuilder WithSubscriptionName(string subscriptionName) + { + _subscriptionName = subscriptionName; + return this; + } + */ + + public IMessageConsumer Create() + { + return _channel.CreateConsumer(_queueName, _prefetchLow, _prefetchHigh, _noLocal, _exclusive); + } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/MessageNotReadableException.cs b/qpid/dotnet/Qpid.Messaging/MessageNotReadableException.cs new file mode 100644 index 0000000000..2afcffd531 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/MessageNotReadableException.cs @@ -0,0 +1,39 @@ +/* + * + * 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. + * + */ + +using System; +using System.Runtime.Serialization; + +namespace Apache.Qpid.Messaging +{ + [Serializable] + public class MessageNotReadableException : QpidException + { + public MessageNotReadableException(string reason) : base(reason) + { + } + + protected MessageNotReadableException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/MessageNotWritableException.cs b/qpid/dotnet/Qpid.Messaging/MessageNotWritableException.cs new file mode 100644 index 0000000000..9b00f01948 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/MessageNotWritableException.cs @@ -0,0 +1,38 @@ +/* + * + * 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. + * + */ +using System; +using System.Runtime.Serialization; + +namespace Apache.Qpid.Messaging +{ + [Serializable] + public class MessageNotWriteableException : QpidException + { + public MessageNotWriteableException(string reason) : base(reason) + { + } + + protected MessageNotWriteableException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/MessagePublisherBuilder.cs b/qpid/dotnet/Qpid.Messaging/MessagePublisherBuilder.cs new file mode 100644 index 0000000000..79c7575d0a --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/MessagePublisherBuilder.cs @@ -0,0 +1,91 @@ +/* + * + * 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. + * + */ +namespace Apache.Qpid.Messaging +{ + public class MessagePublisherBuilder + { + /// + /// Default value for immediate flag is false, i.e. a consumer does not need to be attached to a queue + /// + const bool DEFAULT_IMMEDIATE = false; + + /// + /// Default value for mandatory flag is true, i.e. server will not silently drop messages where no queue is + /// connected to the exchange for the message + /// + const bool DEFAULT_MANDATORY = true; + + IChannel _channel; + string _exchangeName = null; + string _routingKey = null; + DeliveryMode _deliveryMode = DeliveryMode.Persistent; + long _timeToLive; + bool _immediate = DEFAULT_IMMEDIATE; + bool _mandatory = DEFAULT_MANDATORY; + int _priority = 0; + + public MessagePublisherBuilder(IChannel channel) + { + _channel = channel; + } + + public MessagePublisherBuilder WithRoutingKey(string routingKey) + { + _routingKey = routingKey; + return this; + } + + public MessagePublisherBuilder WithExchangeName(string exchangeName) + { + _exchangeName = exchangeName; + return this; + } + + public MessagePublisherBuilder WithDeliveryMode(DeliveryMode deliveryMode) + { + _deliveryMode = deliveryMode; + return this; + } + + public MessagePublisherBuilder WithTimeToLive(long timeToLive) + { + _timeToLive = timeToLive; + return this; + } + + public MessagePublisherBuilder WithImmediate(bool immediate) + { + _immediate = immediate; + return this; + } + + public MessagePublisherBuilder WithMandatory(bool mandatory) + { + _mandatory = mandatory; + return this; + } + + public IMessagePublisher Create() + { + return _channel.CreatePublisher(_exchangeName, _routingKey, _deliveryMode, _timeToLive, _immediate, _mandatory, _priority); + } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/Properties/AssemblyInfo.cs b/qpid/dotnet/Qpid.Messaging/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ab14b1faf0 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/Properties/AssemblyInfo.cs @@ -0,0 +1,56 @@ +/* + * + * 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. + * + */ +using System; +using System.Reflection; +using System.Runtime.InteropServices; +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Apache.Qpid.Messaging")] +[assembly: AssemblyDescription("Built from svn revision number: ")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache Software Foundation")] +[assembly: AssemblyProduct("Apache.Qpid.Messaging")] +[assembly: AssemblyCopyright("Apache Software Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("e74f1805-b355-42e0-ba70-afc7c8570f03")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("2.1.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: CLSCompliant(true)] diff --git a/qpid/dotnet/Qpid.Messaging/Qpid.Messaging.csproj b/qpid/dotnet/Qpid.Messaging/Qpid.Messaging.csproj new file mode 100644 index 0000000000..90354bece6 --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/Qpid.Messaging.csproj @@ -0,0 +1,69 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {6688F826-C58E-4C1B-AA1F-22AFAB4B7D07} + Library + Properties + Apache.Qpid.Messaging + Apache.Qpid.Messaging + true + + + true + full + false + ..\bin\net-2.0\debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\bin\net-2.0\release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qpid/dotnet/Qpid.Messaging/QpidException.cs b/qpid/dotnet/Qpid.Messaging/QpidException.cs new file mode 100644 index 0000000000..3e39f2293d --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/QpidException.cs @@ -0,0 +1,43 @@ +/* + * + * 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. + * + */ +using System; +using System.Runtime.Serialization; + +namespace Apache.Qpid.Messaging +{ + [Serializable] + public class QpidException : Exception + { + public QpidException(string reason) : base(reason) + { + } + + public QpidException(string reason, Exception e) + : base(reason, e) + { + } + + protected QpidException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/ResourceAllocationException.cs b/qpid/dotnet/Qpid.Messaging/ResourceAllocationException.cs new file mode 100644 index 0000000000..954dcdd94c --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/ResourceAllocationException.cs @@ -0,0 +1,39 @@ +/* + * + * 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. + * + */ + +using System; +using System.Runtime.Serialization; + +namespace Apache.Qpid.Messaging +{ + [Serializable] + public class ResourceAllocationException : QpidException + { + public ResourceAllocationException(string reason) : base(reason) + { + } + + protected ResourceAllocationException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } + } +} diff --git a/qpid/dotnet/Qpid.Messaging/default.build b/qpid/dotnet/Qpid.Messaging/default.build new file mode 100644 index 0000000000..789258bfad --- /dev/null +++ b/qpid/dotnet/Qpid.Messaging/default.build @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + -- cgit v1.2.1