summaryrefslogtreecommitdiff
path: root/dotnet/Qpid.Messaging
diff options
context:
space:
mode:
authorSteven Shaw <steshaw@apache.org>2006-11-25 22:04:39 +0000
committerSteven Shaw <steshaw@apache.org>2006-11-25 22:04:39 +0000
commit7c1f9158be7a5d1124a48f42f8d7dcfb6d5df2a6 (patch)
tree3122525268281cd9df870e0a9cb309ee7410a424 /dotnet/Qpid.Messaging
parent8f32ca18d5281eaa5baafa769c99fa70c830b14f (diff)
downloadqpid-python-7c1f9158be7a5d1124a48f42f8d7dcfb6d5df2a6.tar.gz
QPID-128 Initial import of the C# sources.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@479211 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Messaging')
-rw-r--r--dotnet/Qpid.Messaging/AcknowledgeMode.cs42
-rw-r--r--dotnet/Qpid.Messaging/ChannelLimitReachedException.cs43
-rw-r--r--dotnet/Qpid.Messaging/DeliveryMode.cs28
-rw-r--r--dotnet/Qpid.Messaging/ExchangeClassConstants.cs29
-rw-r--r--dotnet/Qpid.Messaging/ExchangeNameDefaults.cs29
-rw-r--r--dotnet/Qpid.Messaging/IBytesMessage.cs63
-rw-r--r--dotnet/Qpid.Messaging/IChannel.cs95
-rw-r--r--dotnet/Qpid.Messaging/IConnection.cs54
-rw-r--r--dotnet/Qpid.Messaging/IConnectionFactory.cs28
-rw-r--r--dotnet/Qpid.Messaging/IConnectionListener.cs59
-rw-r--r--dotnet/Qpid.Messaging/IFieldTable.cs42
-rw-r--r--dotnet/Qpid.Messaging/IHeaders.cs53
-rw-r--r--dotnet/Qpid.Messaging/IMessage.cs47
-rw-r--r--dotnet/Qpid.Messaging/IMessageConsumer.cs33
-rw-r--r--dotnet/Qpid.Messaging/IMessagePublisher.cs55
-rw-r--r--dotnet/Qpid.Messaging/ITextMessage.cs27
-rw-r--r--dotnet/Qpid.Messaging/MessageConsumerBuilder.cs74
-rw-r--r--dotnet/Qpid.Messaging/MessageNotReadableException.cs29
-rw-r--r--dotnet/Qpid.Messaging/MessageNotWritableException.cs29
-rw-r--r--dotnet/Qpid.Messaging/MessagePublisherBuilder.cs91
-rw-r--r--dotnet/Qpid.Messaging/Properties/AssemblyInfo.cs56
-rw-r--r--dotnet/Qpid.Messaging/Qpid.Messaging.csproj69
-rw-r--r--dotnet/Qpid.Messaging/QpidException.cs36
-rw-r--r--dotnet/Qpid.Messaging/ResourceAllocationException.cs29
24 files changed, 1140 insertions, 0 deletions
diff --git a/dotnet/Qpid.Messaging/AcknowledgeMode.cs b/dotnet/Qpid.Messaging/AcknowledgeMode.cs
new file mode 100644
index 0000000000..efd9e8493c
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public enum AcknowledgeMode
+ {
+ AutoAcknowledge,
+ ClientAcknowledge,
+ DupsOkAcknowledge,
+ SessionTransacted,
+
+ /// <summary>
+ /// Indicates that no client acknowledgements are required. Broker assumes that once it has
+ /// delivered a message packet successfully it is acknowledged.
+ /// </summary>
+ NoAcknowledge,
+
+ /// <summary>
+ /// 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).
+ /// </summary>
+ PreAcknowledge
+ }
+}
diff --git a/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs b/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs
new file mode 100644
index 0000000000..645c0d0cdd
--- /dev/null
+++ b/dotnet/Qpid.Messaging/ChannelLimitReachedException.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.
+ *
+ */
+namespace Qpid.Messaging
+{
+ 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;
+ }
+
+ public long Limit
+ {
+ get
+ {
+ return _limit;
+ }
+ }
+ }
+}
diff --git a/dotnet/Qpid.Messaging/DeliveryMode.cs b/dotnet/Qpid.Messaging/DeliveryMode.cs
new file mode 100644
index 0000000000..af706260a5
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public enum DeliveryMode
+ {
+ NonPersistent,
+ Persistent
+ }
+}
diff --git a/dotnet/Qpid.Messaging/ExchangeClassConstants.cs b/dotnet/Qpid.Messaging/ExchangeClassConstants.cs
new file mode 100644
index 0000000000..2e36a7b920
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public class ExchangeClassConstants
+ {
+ public readonly static string TOPIC = "topic";
+ public readonly static string DIRECT = "direct";
+ public readonly static string HEADERS = "headers";
+ }
+} \ No newline at end of file
diff --git a/dotnet/Qpid.Messaging/ExchangeNameDefaults.cs b/dotnet/Qpid.Messaging/ExchangeNameDefaults.cs
new file mode 100644
index 0000000000..13d0d73f84
--- /dev/null
+++ b/dotnet/Qpid.Messaging/ExchangeNameDefaults.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 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";
+ }
+} \ No newline at end of file
diff --git a/dotnet/Qpid.Messaging/IBytesMessage.cs b/dotnet/Qpid.Messaging/IBytesMessage.cs
new file mode 100644
index 0000000000..0d19e9c523
--- /dev/null
+++ b/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 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/dotnet/Qpid.Messaging/IChannel.cs b/dotnet/Qpid.Messaging/IChannel.cs
new file mode 100644
index 0000000000..247d164ae7
--- /dev/null
+++ b/dotnet/Qpid.Messaging/IChannel.cs
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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 Qpid.Messaging
+{
+ public delegate void MessageReceivedDelegate(IMessage msg);
+
+ public interface IChannel : IDisposable
+ {
+ AcknowledgeMode AcknowledgeMode { get; }
+ bool Transacted { get; }
+
+ /// <summary>
+ /// Prefetch value to be used as the default for consumers created on this channel.
+ /// </summary>
+ int DefaultPrefetch
+ {
+ get;
+ set;
+ }
+
+ void DeclareExchange(string exchangeName, string exchangeClass);
+ void DeleteExchange(string exchangeName);
+
+ void DeclareQueue(string queueName, bool isDurable, bool isExclusive, bool isAutoDelete);
+ void DeleteQueue();
+
+ string GenerateUniqueName();
+ IFieldTable CreateFieldTable();
+
+ void Bind(string queueName, string exchangeName, string routingKey);
+ void Bind(string queueName, string exchangeName, string routingKey, IFieldTable args);
+
+ IMessage CreateMessage();
+ IBytesMessage CreateBytesMessage();
+ ITextMessage CreateTextMessage();
+ ITextMessage CreateTextMessage(string initialValue);
+
+ #region Consuming
+
+ MessageConsumerBuilder CreateConsumerBuilder(string queueName);
+
+ IMessageConsumer CreateConsumer(string queueName,
+ int prefetch,
+ bool noLocal,
+ bool exclusive,
+ bool durable,
+ string subscriptionName);
+
+ void Unsubscribe(string subscriptionName);
+
+ #endregion
+
+ #region Publishing
+
+ MessagePublisherBuilder CreatePublisherBuilder();
+
+ IMessagePublisher CreatePublisher(string exchangeName,
+ string routingKey,
+ DeliveryMode deliveryMode,
+ long timeToLive,
+ bool immediate,
+ bool mandatory,
+ int priority);
+
+ #endregion
+
+ #region Transactions
+
+ void Recover();
+ void Commit();
+ void Rollback();
+
+ #endregion
+ }
+}
diff --git a/dotnet/Qpid.Messaging/IConnection.cs b/dotnet/Qpid.Messaging/IConnection.cs
new file mode 100644
index 0000000000..25c3ae968d
--- /dev/null
+++ b/dotnet/Qpid.Messaging/IConnection.cs
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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 Qpid.Messaging
+{
+ public delegate void ExceptionListenerDelegate(Exception ex);
+
+ public interface IConnection : IDisposable
+ {
+ /// <summary>
+ /// The connection listener that has been registered with this connection.
+ /// </summary>
+ IConnectionListener ConnectionListener
+ {
+ get;
+ set;
+ }
+
+ ExceptionListenerDelegate ExceptionListener { get; set; }
+
+ string ClientID { get; set; }
+
+ /// <return>the maximum number of sessions supported by this Connection</return>
+ int MaximumChannelCount
+ {
+ get;
+ }
+
+ IChannel CreateChannel(bool transacted, AcknowledgeMode acknowledgeMode);
+ IChannel CreateChannel(bool transacted, AcknowledgeMode acknowledgeMode, int prefetch);
+
+ void Start();
+ void Stop();
+ }
+}
diff --git a/dotnet/Qpid.Messaging/IConnectionFactory.cs b/dotnet/Qpid.Messaging/IConnectionFactory.cs
new file mode 100644
index 0000000000..682bd9eb54
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public interface IConnectionFactory
+ {
+ IConnection CreateConnection();
+ IConnection CreateConnection(string userId, string password);
+ }
+}
diff --git a/dotnet/Qpid.Messaging/IConnectionListener.cs b/dotnet/Qpid.Messaging/IConnectionListener.cs
new file mode 100644
index 0000000000..a8112bd8e9
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public interface IConnectionListener
+ {
+ /// <summary>
+ /// Called when bytes have been transmitted to the server
+ /// </summary>
+ /// <param>count the number of bytes sent in total since the connection was opened</param>
+ void BytesSent(long count);
+
+ /// <summary>
+ /// Called when some bytes have been received on a connection
+ /// </summary>
+ /// <param>count the number of bytes received in total since the connection was opened</param>
+ void BytesReceived(long count);
+
+ /// <summary>
+ /// Called after the infrastructure has detected that failover is required but before attempting failover.
+ /// </summary>
+ /// <param>redirect true if the broker requested redirect. false if failover is occurring due to a connection error.</param>
+ /// <return>true to continue failing over, false to veto failover and raise a connection exception</return>
+ bool PreFailover(bool redirect);
+
+ /// <summary>
+ /// Called after connection has been made to another broker after failover has been started but before
+ /// any resubscription has been done.
+ /// <return> 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.
+ /// </return
+ bool PreResubscribe();
+
+ /// <summary>
+ /// Called once failover has completed successfully. This is called irrespective of whether the client has
+ /// vetoed automatic resubscription.
+ /// </summary>
+ void FailoverComplete();
+ }
+}
diff --git a/dotnet/Qpid.Messaging/IFieldTable.cs b/dotnet/Qpid.Messaging/IFieldTable.cs
new file mode 100644
index 0000000000..50d47e6769
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public interface IFieldTable : IEnumerable
+ {
+ int Count { get; }
+
+ object this[string key] { get; set; }
+
+ /// <summary>
+ /// Adds all the items from another field table in this one.
+ /// Will overwrite any items in the current table with the same key.
+ /// </summary>
+ /// <param name="source">the source field table</param>
+ void AddAll(IFieldTable source);
+
+ bool Contains(string s);
+ void Clear();
+ void Remove(string key);
+ }
+}
diff --git a/dotnet/Qpid.Messaging/IHeaders.cs b/dotnet/Qpid.Messaging/IHeaders.cs
new file mode 100644
index 0000000000..fb1514f24d
--- /dev/null
+++ b/dotnet/Qpid.Messaging/IHeaders.cs
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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 Qpid.Messaging
+{
+ public interface IHeaders
+ {
+ bool Contains(string name);
+
+ string 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);
+
+ 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/dotnet/Qpid.Messaging/IMessage.cs b/dotnet/Qpid.Messaging/IMessage.cs
new file mode 100644
index 0000000000..60febc942a
--- /dev/null
+++ b/dotnet/Qpid.Messaging/IMessage.cs
@@ -0,0 +1,47 @@
+/*
+ *
+ * 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 Qpid.Messaging
+{
+ public interface IMessage
+ {
+ string ContentType { get; set;}
+ string ContentEncoding { get; set; }
+ string CorrelationId { get; set; }
+ byte[] CorrelationIdAsBytes { get; set; }
+ DeliveryMode DeliveryMode { get; set; }
+ long Expiration { get; set; }
+ string MessageId { get; set; }
+ int Priority { get; set; }
+ bool Redelivered { get; set; }
+ string ReplyToExchangeName { get; set; }
+ string ReplyToRoutingKey { get; set; }
+ long Timestamp { get; set; }
+ string Type { get; set; }
+ IHeaders Headers { get; }
+
+ // XXX: UserId?
+ // XXX: AppId?
+ // XXX: ClusterId?
+
+ void Acknowledge();
+ void ClearBody();
+ }
+}
diff --git a/dotnet/Qpid.Messaging/IMessageConsumer.cs b/dotnet/Qpid.Messaging/IMessageConsumer.cs
new file mode 100644
index 0000000000..20e9bd4b38
--- /dev/null
+++ b/dotnet/Qpid.Messaging/IMessageConsumer.cs
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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 Qpid.Messaging
+{
+ public interface IMessageConsumer : IDisposable
+ {
+ MessageReceivedDelegate OnMessage { get; set; }
+
+ IMessage Receive();
+ IMessage Receive(long delay);
+ IMessage ReceiveNoWait();
+ }
+}
diff --git a/dotnet/Qpid.Messaging/IMessagePublisher.cs b/dotnet/Qpid.Messaging/IMessagePublisher.cs
new file mode 100644
index 0000000000..ba9b9a2d14
--- /dev/null
+++ b/dotnet/Qpid.Messaging/IMessagePublisher.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 Qpid.Messaging
+{
+ public interface IMessagePublisher : IDisposable
+ {
+ DeliveryMode DeliveryMode { get; set; }
+ string ExchangeName { get; }
+ string RoutingKey { get; }
+ bool DisableMessageID { get; set; }
+ bool DisableMessageTimestamp { get; set; }
+ int Priority { get; set; }
+ long TimeToLive { get; set; }
+
+ /// <summary>
+ /// Set the default MIME type for messages produced by this producer. This reduces the overhead of each message.
+ /// </summary>
+ /// <param>mimeType</param>
+ string MimeType
+ {
+ set;
+ }
+
+ /// <summary>
+ /// Set the default encoding for messages produced by this producer. This reduces the overhead of each message.
+ /// </summary>
+ string Encoding
+ {
+ set;
+ }
+
+ void Send(IMessage msg);
+ void Send(IMessage msg, DeliveryMode deliveryMode, int priority, long timeToLive);
+ }
+}
diff --git a/dotnet/Qpid.Messaging/ITextMessage.cs b/dotnet/Qpid.Messaging/ITextMessage.cs
new file mode 100644
index 0000000000..7b3b5305a6
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public interface ITextMessage : IMessage
+ {
+ string Text { get; set; }
+ }
+}
diff --git a/dotnet/Qpid.Messaging/MessageConsumerBuilder.cs b/dotnet/Qpid.Messaging/MessageConsumerBuilder.cs
new file mode 100644
index 0000000000..6699d63a79
--- /dev/null
+++ b/dotnet/Qpid.Messaging/MessageConsumerBuilder.cs
@@ -0,0 +1,74 @@
+/*
+ *
+ * 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 Qpid.Messaging
+{
+ public class MessageConsumerBuilder
+ {
+ private int _prefetch = 0;
+ private bool _noLocal = false;
+ private bool _exclusive = false;
+ private bool _durable = false;
+ private string _subscriptionName = null;
+ private IChannel _channel;
+ private readonly string _queueName;
+
+ public MessageConsumerBuilder(IChannel channel, string queueName)
+ {
+ _channel = channel;
+ _queueName = queueName;
+ }
+
+ public MessageConsumerBuilder withPrefetch(int prefetch)
+ {
+ _prefetch = prefetch;
+ 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, _prefetch, _noLocal, _exclusive, _durable, _subscriptionName);
+ }
+ }
+}
diff --git a/dotnet/Qpid.Messaging/MessageNotReadableException.cs b/dotnet/Qpid.Messaging/MessageNotReadableException.cs
new file mode 100644
index 0000000000..077a15e719
--- /dev/null
+++ b/dotnet/Qpid.Messaging/MessageNotReadableException.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 Qpid.Messaging
+{
+ public class MessageNotReadableException : QpidException
+ {
+ public MessageNotReadableException(string reason) : base(reason)
+ {
+ }
+ }
+}
diff --git a/dotnet/Qpid.Messaging/MessageNotWritableException.cs b/dotnet/Qpid.Messaging/MessageNotWritableException.cs
new file mode 100644
index 0000000000..26905e28f3
--- /dev/null
+++ b/dotnet/Qpid.Messaging/MessageNotWritableException.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 Qpid.Messaging
+{
+ public class MessageNotWriteableException : QpidException
+ {
+ public MessageNotWriteableException(string reason) : base(reason)
+ {
+ }
+ }
+}
diff --git a/dotnet/Qpid.Messaging/MessagePublisherBuilder.cs b/dotnet/Qpid.Messaging/MessagePublisherBuilder.cs
new file mode 100644
index 0000000000..ecee1b5c57
--- /dev/null
+++ b/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 Qpid.Messaging
+{
+ public class MessagePublisherBuilder
+ {
+ /// <summary>
+ /// Default value for immediate flag is false, i.e. a consumer does not need to be attached to a queue
+ /// </summary>
+ const bool DEFAULT_IMMEDIATE = false;
+
+ /// <summary>
+ /// 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
+ /// </summary>
+ 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);
+ }
+ }
+} \ No newline at end of file
diff --git a/dotnet/Qpid.Messaging/Properties/AssemblyInfo.cs b/dotnet/Qpid.Messaging/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..8b37576c42
--- /dev/null
+++ b/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("Qpid.Messaging")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Qpid")]
+[assembly: AssemblyProduct("Qpid.Messaging")]
+[assembly: AssemblyCopyright("Copyright (c) 2006 The 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+
+[assembly: CLSCompliant(true)] \ No newline at end of file
diff --git a/dotnet/Qpid.Messaging/Qpid.Messaging.csproj b/dotnet/Qpid.Messaging/Qpid.Messaging.csproj
new file mode 100644
index 0000000000..b61d40e90a
--- /dev/null
+++ b/dotnet/Qpid.Messaging/Qpid.Messaging.csproj
@@ -0,0 +1,69 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{6688F826-C58E-4C1B-AA1F-22AFAB4B7D07}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Qpid.Messaging</RootNamespace>
+ <AssemblyName>Qpid.Messaging</AssemblyName>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AcknowledgeMode.cs" />
+ <Compile Include="ChannelLimitReachedException.cs" />
+ <Compile Include="DeliveryMode.cs" />
+ <Compile Include="ExchangeClassConstants.cs" />
+ <Compile Include="ExchangeNameDefaults.cs" />
+ <Compile Include="IBytesMessage.cs" />
+ <Compile Include="IConnection.cs" />
+ <Compile Include="IConnectionFactory.cs" />
+ <Compile Include="IConnectionListener.cs" />
+ <Compile Include="IFieldTable.cs" />
+ <Compile Include="IHeaders.cs" />
+ <Compile Include="IMessage.cs" />
+ <Compile Include="IMessageConsumer.cs" />
+ <Compile Include="IMessagePublisher.cs" />
+ <Compile Include="IChannel.cs" />
+ <Compile Include="ITextMessage.cs" />
+ <Compile Include="MessageConsumerBuilder.cs" />
+ <Compile Include="MessageNotReadableException.cs" />
+ <Compile Include="MessageNotWritableException.cs" />
+ <Compile Include="MessagePublisherBuilder.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="QpidException.cs" />
+ <Compile Include="ResourceAllocationException.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/dotnet/Qpid.Messaging/QpidException.cs b/dotnet/Qpid.Messaging/QpidException.cs
new file mode 100644
index 0000000000..7f0c9873e5
--- /dev/null
+++ b/dotnet/Qpid.Messaging/QpidException.cs
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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 Qpid.Messaging
+{
+ public class QpidException : Exception
+ {
+ public QpidException(string reason) : base(reason)
+ {
+ }
+
+ public QpidException(string reason, Exception e)
+ : base(reason, e)
+ {
+ }
+ }
+}
diff --git a/dotnet/Qpid.Messaging/ResourceAllocationException.cs b/dotnet/Qpid.Messaging/ResourceAllocationException.cs
new file mode 100644
index 0000000000..076e374d60
--- /dev/null
+++ b/dotnet/Qpid.Messaging/ResourceAllocationException.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 Qpid.Messaging
+{
+ public class ResourceAllocationException : QpidException
+ {
+ public ResourceAllocationException(string reason) : base(reason)
+ {
+ }
+ }
+}