You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2008/10/31 18:43:12 UTC
svn commit: r709503 [4/4] - in /activemq/activemq-dotnet/Apache.NMS.WCF: ./
branches/ tags/ trunk/ trunk/lib/ trunk/lib/net-3.5/ trunk/src/
trunk/src/main/ trunk/src/main/csharp/ trunk/src/main/csharp/Configuration/
trunk/src/main/ndoc/ trunk/src/test/...
Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsInputChannel.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsInputChannel.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsInputChannel.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsInputChannel.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,342 @@
+/*
+ * 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.ServiceModel;
+using System.ServiceModel.Channels;
+using System.Text;
+using Apache.NMS;
+using ISession = Apache.NMS.ISession;
+
+namespace Apache.NMS.WCF
+{
+ /// <summary>
+ /// Channel for receiving messages.
+ /// </summary>
+ public class NmsInputChannel : NmsChannelBase, IInputChannel
+ {
+ #region Constructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="NmsInputChannel"/> class.
+ /// </summary>
+ /// <param name="bufferManager">The buffer manager.</param>
+ /// <param name="encoderFactory">The encoder factory.</param>
+ /// <param name="address">The address.</param>
+ /// <param name="parent">The parent.</param>
+ /// <exception cref="T:System.ArgumentNullException">
+ /// <paramref name="channelManager"/> is null.</exception>
+ public NmsInputChannel(BufferManager bufferManager, MessageEncoderFactory encoderFactory, EndpointAddress address, NmsChannelListener parent)
+ : base(bufferManager, encoderFactory, address, parent, parent.Destination, parent.DestinationType)
+ {
+ _localAddress = address;
+ _messages = new InputQueue<Message>();
+ }
+
+ #endregion
+
+ //Hands the message off to other components higher up the
+ //channel stack that have previously called BeginReceive()
+ //and are waiting for messages to arrive on this channel.
+ internal void Dispatch(Message message)
+ {
+ _messages.EnqueueAndDispatch(message);
+ }
+
+ /// <summary>
+ /// Gets the property.
+ /// </summary>
+ /// <typeparam name="T">The type of the property to attempt to retrieve.</typeparam>
+ public override T GetProperty<T>()
+ {
+ if (typeof(T) == typeof(IInputChannel))
+ {
+ return (T)(object)this;
+ }
+
+ T messageEncoderProperty = Encoder.GetProperty<T>();
+ if (messageEncoderProperty != null)
+ {
+ return messageEncoderProperty;
+ }
+
+ return base.GetProperty<T>();
+ }
+
+ #region IInputChannel Members
+
+ /// <summary>
+ /// Returns the message received, if one is available. If a message is not available, blocks for a default interval of time.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.ServiceModel.Channels.Message" /> received.
+ /// </returns>
+ public Message Receive()
+ {
+ return Receive(DefaultReceiveTimeout);
+ }
+
+ /// <summary>
+ /// Returns the message received, if one is available. If a message is not available, blocks for a specified interval of time.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.ServiceModel.Channels.Message" /> received.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the receive operation has to complete before timing out and throwing a <see cref="T:System.TimeoutException" />.</param>
+ /// <exception cref="T:System.TimeoutException">The specified <paramref name="timeout" /> is exceeded before the operation is completed.</exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than zero.</exception>
+ public Message Receive(TimeSpan timeout)
+ {
+ Message message;
+ if (TryReceive(timeout, out message))
+ {
+ return message;
+ }
+ throw new TimeoutException(String.Format("Receive timed out after {0}. The time allotted to this operation may have been a portion of a longer timeout.", timeout));
+ }
+
+ /// <summary>
+ /// Tries to receive a message within a specified interval of time.
+ /// </summary>
+ /// <returns>
+ /// true if a message is received before the <paramref name="timeout" /> has been exceeded; otherwise false.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.IAsyncResult" /> returned by a call to one of the <see cref="System.ServiceModel.Channels.IInputChannel.BeginReceive" /> methods.</param>
+ /// <param name="message">The <see cref="T:System.ServiceModel.Channels.Message" /> received. </param>
+ /// <exception cref="T:System.TimeoutException">The specified <paramref name="timeout" /> is exceeded before the operation is completed.</exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than zero.</exception>
+ public bool TryReceive(TimeSpan timeout, out Message message)
+ {
+ NmsChannelHelper.ValidateTimeout(timeout);
+ return _messages.Dequeue(timeout, out message);
+ }
+
+ /// <summary>
+ /// Begins an asynchronous operation to receive a message that has a state object associated with it.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous message reception.
+ /// </returns>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives the notification of the asynchronous operation completion.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous operation.</param>
+ public IAsyncResult BeginReceive(AsyncCallback callback, object state)
+ {
+ return BeginReceive(DefaultReceiveTimeout, callback, state);
+ }
+
+ /// <summary>
+ /// Begins an asynchronous operation to receive a message that has a specified time out and state object associated with it.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous receive operation.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies the interval of time to wait for a message to become available.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives the notification of the asynchronous operation completion.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous operation.</param>
+ /// <exception cref="T:System.TimeoutException">The specified <paramref name="timeout" /> is exceeded before the operation is completed.</exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than zero.</exception>
+ public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ return BeginTryReceive(timeout, callback, state);
+ }
+
+ /// <summary>
+ /// Completes an asynchronous operation to receive a message.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.ServiceModel.Channels.Message" /> received.
+ /// </returns>
+ /// <param name="result">The <see cref="T:System.IAsyncResult" /> returned by a call to one of the <see cref="System.ServiceModel.Channels.IInputChannel.BeginReceive" /> methods.</param>
+ public Message EndReceive(IAsyncResult result)
+ {
+ return _messages.EndDequeue(result);
+ }
+
+ /// <summary>
+ /// Begins an asynchronous operation to receive a message that has a specified time out and state object associated with it.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous receive operation.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies the interval of time to wait for a message to become available.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives the notification of the asynchronous operation completion.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous operation.</param>
+ /// <exception cref="T:System.TimeoutException">The specified <paramref name="timeout" /> is exceeded before the operation is completed.</exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than zero.</exception>
+ public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ NmsChannelHelper.ValidateTimeout(timeout);
+ return _messages.BeginDequeue(timeout, callback, state);
+ }
+
+ /// <summary>
+ /// Completes the specified asynchronous operation to receive a message.
+ /// </summary>
+ /// <returns>
+ /// true if a message is received before the specified interval of time elapses; otherwise false.
+ /// </returns>
+ /// <param name="result">The <see cref="T:System.IAsyncResult" /> returned by a call to the <see cref="M:System.ServiceModel.Channels.IInputChannel.BeginTryReceive(System.TimeSpan,System.AsyncCallback,System.Object)" /> method.</param>
+ /// <param name="message">The <see cref="T:System.ServiceModel.Channels.Message" /> received. </param>
+ public bool EndTryReceive(IAsyncResult result, out Message message)
+ {
+ return _messages.EndDequeue(result, out message);
+ }
+
+ /// <summary>
+ /// Returns a value that indicates whether a message has arrived within a specified interval of time.
+ /// </summary>
+ /// <returns>
+ /// true if a message has arrived before the <paramref name="timeout" /> has been exceeded; otherwise false.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> specifies the maximum interval of time to wait for a message to arrive before timing out.</param>
+ /// <exception cref="T:System.TimeoutException">The specified <paramref name="timeout" /> is exceeded before the operation is completed.</exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than zero.</exception>
+ public bool WaitForMessage(TimeSpan timeout)
+ {
+ NmsChannelHelper.ValidateTimeout(timeout);
+ return _messages.WaitForItem(timeout);
+ }
+
+ /// <summary>
+ /// Begins an asynchronous wait-for-a-message-to-arrive operation that has a specified time out and state object associated with it.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous operation to wait for a message to arrive.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies the interval of time to wait for a message to become available.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives the notification of the asynchronous operation completion.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous operation.</param>
+ /// <exception cref="T:System.TimeoutException">The specified <paramref name="timeout" /> is exceeded before the operation is completed.</exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than zero.</exception>
+ public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ NmsChannelHelper.ValidateTimeout(timeout);
+ return _messages.BeginWaitForItem(timeout, callback, state);
+ }
+
+ /// <summary>
+ /// Completes the specified asynchronous wait-for-a-message operation.
+ /// </summary>
+ /// <returns>
+ /// true if a message has arrived before the timeout has been exceeded; otherwise false.
+ /// </returns>
+ /// <param name="result">The <see cref="T:System.IAsyncResult" /> that identifies the <see cref="M:System.ServiceModel.Channels.IInputChannel.BeginWaitForMessage(System.TimeSpan,System.AsyncCallback,System.Object)" /> operation to finish, and from which to retrieve an end result.</param>
+ public bool EndWaitForMessage(IAsyncResult result)
+ {
+ return _messages.EndWaitForItem(result);
+ }
+
+ /// <summary>
+ /// Gets the address on which the input channel receives messages.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.ServiceModel.EndpointAddress" /> on which the input channel receives messages.
+ /// </returns>
+ public EndpointAddress LocalAddress
+ {
+ get { return _localAddress; }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions to the closing state due to the invocation of a synchronous abort operation.
+ /// </summary>
+ protected override void OnAbort()
+ {
+ OnClose(TimeSpan.Zero);
+ }
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions to the closing state due to the invocation of a synchronous close operation.
+ /// </summary>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on close operation has to complete before timing out.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ protected override void OnClose(TimeSpan timeout)
+ {
+ NmsChannelHelper.ValidateTimeout(timeout);
+ _messages.Close();
+ }
+
+ /// <summary>
+ /// Completes an asynchronous operation on the close of a communication object.
+ /// </summary>
+ /// <param name="result">The <see cref="T:System.IAsyncResult" /> that is returned by a call to the <see cref="M:System.ServiceModel.Channels.CommunicationObject.OnEndClose(System.IAsyncResult)" /> method.</param>
+ protected override void OnEndClose(IAsyncResult result)
+ {
+ CompletedAsyncResult.End(result);
+ }
+
+ /// <summary>
+ /// Inserts processing after a communication object transitions to the closing state due to the invocation of an asynchronous close operation.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous on close operation.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on close operation has to complete before timing out.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives notification of the completion of the asynchronous on close operation.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous on close operation.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ OnClose(timeout);
+ return new CompletedAsyncResult(callback, state);
+ }
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions into the opening state which must complete within a specified interval of time.
+ /// </summary>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on open operation has to complete before timing out.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ /// <exception cref="T:System.TimeoutException">The interval of time specified by <paramref name="timeout" /> that was allotted for the operation was exceeded before the operation was completed.</exception>
+ protected override void OnOpen(TimeSpan timeout)
+ {
+ }
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions to the opening state due to the invocation of an asynchronous open operation.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous on open operation.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on open operation has to complete before timing out.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives notification of the completion of the asynchronous on open operation.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous on open operation.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ return new CompletedAsyncResult(callback, state);
+ }
+
+ /// <summary>
+ /// Completes an asynchronous operation on the open of a communication object.
+ /// </summary>
+ /// <param name="result">The <see cref="T:System.IAsyncResult" /> that is returned by a call to the <see cref="M:System.ServiceModel.Channels.CommunicationObject.OnEndOpen(System.IAsyncResult)" /> method.</param>
+ /// <exception cref="T:System.TimeoutException">The interval of time specified by the timeout that was allotted for the operation was exceeded before the operation was completed.</exception>
+ protected override void OnEndOpen(IAsyncResult result)
+ {
+ CompletedAsyncResult.End(result);
+ }
+
+ #region Private members
+
+ private readonly InputQueue<Message> _messages;
+ private EndpointAddress _localAddress;
+
+ #endregion
+ }
+}
\ No newline at end of file
Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsOutputChannel.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsOutputChannel.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsOutputChannel.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/csharp/NmsOutputChannel.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,316 @@
+/*
+ * 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.ServiceModel;
+using System.ServiceModel.Channels;
+using System.Text;
+using System.Xml;
+using Apache.NMS;
+
+namespace Apache.NMS.WCF
+{
+ /// <summary>
+ /// Channel for sending messages.
+ /// </summary>
+ public class NmsOutputChannel : NmsChannelBase, IOutputChannel
+ {
+ #region Constructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="NmsOutputChannel"/> class.
+ /// </summary>
+ /// <param name="bufferManager">The buffer manager.</param>
+ /// <param name="encoderFactory">The encoder factory.</param>
+ /// <param name="address">The address.</param>
+ /// <param name="parent">The parent.</param>
+ /// <param name="via">The via.</param>
+ public NmsOutputChannel(BufferManager bufferManager, MessageEncoderFactory encoderFactory, EndpointAddress address, NmsChannelFactory parent, Uri via)
+ : base(bufferManager, encoderFactory, address, parent, parent.Destination, parent.DestinationType)
+ {
+ _via = via;
+ _connection = ConnectionFactoryManager.GetInstance().CreateConnection(via);
+ _connection.Start();
+ }
+
+ #endregion
+
+ #region Implementation of IOutputChannel
+
+ /// <summary>
+ /// Transmits a message to the destination of the output channel.
+ /// </summary>
+ /// <param name="message">The <see cref="T:System.ServiceModel.Channels.Message" /> being sent on the output channel.</param>
+ public void Send(Message message)
+ {
+ Send(message, DefaultSendTimeout);
+ }
+
+ /// <summary>
+ /// Sends a message on the current output channel within a specified interval of time.
+ /// </summary>
+ /// <param name="message">The <see cref="T:System.ServiceModel.Channels.Message" /> being sent on the output channel.</param>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the send operation has to complete before timing out.</param>
+ public void Send(Message message, TimeSpan timeout)
+ {
+ ThrowIfDisposedOrNotOpen();
+
+ using (NMS.ISession session = _connection.CreateSession())
+ {
+ IDestination destination = NmsChannelHelper.GetDestination(session, Destination, DestinationType);
+ using (IMessageProducer producer = session.CreateProducer(destination))
+ {
+ producer.Persistent = true;
+ message.Headers.To = RemoteAddress.Uri;
+ //TODO: check if this is synonymous with the above operation
+ //RemoteAddress.ApplyTo(message);
+
+ ITextMessage request = session.CreateTextMessage(TranslateMessage(message));
+ producer.Send(request);
+ producer.Close();
+
+ Console.WriteLine("Sending message:");
+ Console.WriteLine(request.Text);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Translates the message using the appropriate SOAP versioning scheme.
+ /// </summary>
+ /// <param name="message">The message to be translated.</param>
+ private string TranslateMessage(Message message)
+ {
+ return (Encoder.MessageVersion == MessageVersion.Soap11)
+ ? TranslateMessageAsSoap11(message)
+ : TranslateMessageAsSoap12(message);
+ }
+
+ /// <summary>
+ /// Translates the message using the SOAP 1.1 schema.
+ /// </summary>
+ /// <param name="message">The message to be translated.</param>
+ private static string TranslateMessageAsSoap11(Message message)
+ {
+ StringBuilder sb = new StringBuilder();
+ XmlDictionaryWriter writer = XmlDictionaryWriter.CreateDictionaryWriter(XmlWriter.Create(sb));
+ message.WriteStartEnvelope(writer);
+ message.WriteBody(writer);
+ writer.Flush();
+
+ string raw = sb.ToString();
+ //to get past the damn utf 16 header
+ raw = raw.Substring(raw.LastIndexOf("?>") + 2).Trim();
+
+ //well there is no WriteEndEnvelope(writer) method:-)
+ return raw + "</s:Envelope>";
+ }
+
+ /// <summary>
+ /// Translates the message using the SOAP 1.2 schema.
+ /// </summary>
+ /// <param name="message">The message to be translated.</param>
+ private static string TranslateMessageAsSoap12(Message message)
+ {
+ string raw = message.ToString();
+ raw = raw.Substring(raw.LastIndexOf("?>") + 1).Trim();
+ return raw;
+ }
+
+ /// <summary>
+ /// Begins an asynchronous operation to transmit a message to the destination of the output channel.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous message transmission.
+ /// </returns>
+ /// <param name="message">The <see cref="T:System.ServiceModel.Channels.Message" /> being sent on the output channel. </param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate. </param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous send operation.</param>
+ public IAsyncResult BeginSend(Message message, AsyncCallback callback, object state)
+ {
+ return BeginSend(message, DefaultSendTimeout, callback, state);
+ }
+
+ /// <summary>
+ /// Begins an asynchronous operation to transmit a message to the destination of the output channel within a specified interval of time.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous send operation.
+ /// </returns>
+ /// <param name="message">The <see cref="T:System.ServiceModel.Channels.Message" /> being sent on the output channel.</param>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the send operation has to complete before timing out.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives the notification of the asynchronous operation send completion.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous send operation.</param>
+ public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ ThrowIfDisposedOrNotOpen();
+ return new NmsAsyncResult(this, message, callback, state);
+ }
+
+ /// <summary>
+ /// Completes an asynchronous operation to transmit a message to the destination of the output channel.
+ /// </summary>
+ /// <param name="result">The <see cref="T:System.IAsyncResult"/> returned by a call to the <see cref="System.ServiceModel.Channels.IOutputChannel.BeginSend"/> method.</param>
+ public void EndSend(IAsyncResult result)
+ {
+ NmsAsyncResult.End(result);
+ }
+
+ /// <summary>
+ /// Gets the URI that contains the transport address to which messages are sent on the output channel.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.Uri" /> that contains the transport address to which messages are sent on the output channel.
+ /// </returns>
+ public Uri Via
+ {
+ get { return _via; }
+ }
+
+ #endregion
+
+ #region Implementation of CommunicationObject
+
+ /// <summary>
+ /// Gets the property.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <returns></returns>
+ public override T GetProperty<T>()
+ {
+ if (typeof(T) == typeof(IOutputChannel))
+ {
+ return (T)(object)this;
+ }
+
+ T messageEncoderProperty = Encoder.GetProperty<T>();
+ if (messageEncoderProperty != null)
+ {
+ return messageEncoderProperty;
+ }
+
+ return base.GetProperty<T>();
+ }
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions to the closing state due to the invocation of a synchronous abort operation.
+ /// </summary>
+ protected override void OnAbort()
+ {
+ OnClose(TimeSpan.Zero);
+ }
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions to the closing state due to the invocation of a synchronous close operation.
+ /// </summary>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on close operation has to complete before timing out.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ protected override void OnClose(TimeSpan timeout)
+ {
+ if (_connection != null)
+ {
+ _connection.Close();
+ _connection.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Completes an asynchronous operation on the close of a communication object.
+ /// </summary>
+ /// <param name="result">The <see cref="T:System.IAsyncResult" /> that is returned by a call to the <see cref="M:System.ServiceModel.Channels.CommunicationObject.OnEndClose(System.IAsyncResult)" /> method.</param>
+ protected override void OnEndClose(IAsyncResult result)
+ {
+ CompletedAsyncResult.End(result);
+ }
+
+ /// <summary>
+ /// Inserts processing after a communication object transitions to the closing state due to the invocation of an asynchronous close operation.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous on close operation.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on close operation has to complete before timing out.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives notification of the completion of the asynchronous on close operation.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous on close operation.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ OnClose(timeout);
+ return new CompletedAsyncResult(callback, state);
+ }
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions into the opening state which must complete within a specified interval of time.
+ /// </summary>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on open operation has to complete before timing out.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ /// <exception cref="T:System.TimeoutException">The interval of time specified by <paramref name="timeout" /> that was allotted for the operation was exceeded before the operation was completed.</exception>
+ protected override void OnOpen(TimeSpan timeout)
+ {
+ }
+
+ /// <summary>
+ /// Inserts processing on a communication object after it transitions to the opening state due to the invocation of an asynchronous open operation.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous on open operation.
+ /// </returns>
+ /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on open operation has to complete before timing out.</param>
+ /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives notification of the completion of the asynchronous on open operation.</param>
+ /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous on open operation.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
+ protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
+ {
+ return new CompletedAsyncResult(callback, state);
+ }
+
+ /// <summary>
+ /// Completes an asynchronous operation on the open of a communication object.
+ /// </summary>
+ /// <param name="result">The <see cref="T:System.IAsyncResult" /> that is returned by a call to the <see cref="M:System.ServiceModel.Channels.CommunicationObject.OnEndOpen(System.IAsyncResult)" /> method.</param>
+ protected override void OnEndOpen(IAsyncResult result)
+ {
+ CompletedAsyncResult.End(result);
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Encodes the message.
+ /// </summary>
+ /// <param name="message">The message.</param>
+ public ArraySegment<byte> EncodeMessage(Message message)
+ {
+ try
+ {
+ return Encoder.WriteMessage(message, Int32.MaxValue, BufferManager);
+ }
+ finally
+ {
+ // The message is consumed by serialising it, so clean up here.
+ message.Close();
+ }
+ }
+
+ #region Private members
+
+ private readonly Uri _via;
+ private readonly IConnection _connection;
+
+ #endregion
+ }
+}
\ No newline at end of file
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/ndoc/
------------------------------------------------------------------------------
bugtraq:label = Issue#:
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/ndoc/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/ndoc/
------------------------------------------------------------------------------
bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%
Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/ndoc/NamespaceSummary.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/ndoc/NamespaceSummary.xml?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/ndoc/NamespaceSummary.xml (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/main/ndoc/NamespaceSummary.xml Fri Oct 31 10:43:10 2008
@@ -0,0 +1,21 @@
+<!--
+ 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.
+-->
+<namespaces>
+ <namespace name="Apache.NMS.ActiveMQ.WCF">
+ The <b>Apache.NMS.ActiveMQ.WCF</b> namespace implements a Windows Communications Foundation transport for ActiveMQ.
+ </namespace>
+</namespaces>
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/
------------------------------------------------------------------------------
bugtraq:label = Issue#:
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/
------------------------------------------------------------------------------
bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/csharp/
------------------------------------------------------------------------------
bugtraq:label = Issue#:
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/csharp/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/csharp/
------------------------------------------------------------------------------
bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%
Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/csharp/CommonAssemblyInfo.cs?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/csharp/CommonAssemblyInfo.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/src/test/csharp/CommonAssemblyInfo.cs Fri Oct 31 10:43:10 2008
@@ -0,0 +1,28 @@
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+[assembly: ComVisibleAttribute(false)]
+[assembly: CLSCompliantAttribute(true)]
+[assembly: AssemblyTitleAttribute("WCF Provider for ActiveMQ Class Library")]
+[assembly: AssemblyDescriptionAttribute("WCF Provider for ActiveMQ Class Library (.Net Messaging Library Implementation): " +
+ "An implementation of Windows Communications Framework API for ActiveMQ")]
+[assembly: AssemblyConfigurationAttribute("SNAPSHOT")]
+[assembly: AssemblyCompanyAttribute("http://activemq.apache.org/nms")]
+[assembly: AssemblyProductAttribute("WCF Provider for ActiveMQ Class Library")]
+[assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2008 Apache Software Foundation")]
+[assembly: AssemblyTrademarkAttribute("")]
+[assembly: AssemblyCultureAttribute("")]
+[assembly: AssemblyVersionAttribute("1.1.0")]
+[assembly: AssemblyInformationalVersionAttribute("1.1.0")]
+
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vendor/
------------------------------------------------------------------------------
bugtraq:label = Issue#:
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vendor/
------------------------------------------------------------------------------
--- bugtraq:message (added)
+++ bugtraq:message Fri Oct 31 10:43:10 2008
@@ -0,0 +1 @@
+Fixes [AMQNET-%BUGID%]. (See https://issues.apache.org/activemq/browse/AMQNET-%BUGID%)
Propchange: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vendor/
------------------------------------------------------------------------------
bugtraq:url = https://issues.apache.org/activemq/browse/AMQNET-%BUGID%
Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.csproj?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.csproj (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.csproj Fri Oct 31 10:43:10 2008
@@ -0,0 +1,134 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{96BAB638-2ECF-4648-8553-8FE6B9A4816F}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Apache.NMS.WCF</RootNamespace>
+ <AssemblyName>Apache.NMS.WCF</AssemblyName>
+ <WarningLevel>4</WarningLevel>
+ <SignAssembly>false</SignAssembly>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ <SccProjectName>Svn</SccProjectName>
+ <SccLocalPath>Svn</SccLocalPath>
+ <SccAuxPath>Svn</SccAuxPath>
+ <SccProvider>SubversionScc</SccProvider>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkSubset>
+ </TargetFrameworkSubset>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>build\net-3.5\debug\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;NET,NET_2_0,NET_3_5</DefineConstants>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <DocumentationFile>build\net-3.5\debug\Apache.NMS.WCF.xml</DocumentationFile>
+ <NoWarn>0419</NoWarn>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <Optimize>true</Optimize>
+ <OutputPath>build\net-3.5\release\</OutputPath>
+ <DefineConstants>TRACE;NET,NET_2_0,NET_3_5</DefineConstants>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <DebugType>full</DebugType>
+ <DocumentationFile>build\net-3.5\release\Apache.NMS.WCF.xml</DocumentationFile>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <NoWarn>0419</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Apache.NMS, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>vendor\Apache.NMS\net-3.5\Apache.NMS.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Runtime.Serialization">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.ServiceModel">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="LICENSE.txt">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="nant-common.xml" />
+ <Content Include="NOTICE.txt">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="README.txt" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="src\main\csharp\AsyncResult.cs" />
+ <Compile Include="src\main\csharp\CommonAssemblyInfo.cs" />
+ <Compile Include="src\main\csharp\Configuration\AddressingVersions.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsBinding.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsBindingCollection.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsBindingElement.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsConfigurationDefaults.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsConfigurationStrings.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsConstants.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsTransportBindingElement.cs" />
+ <Compile Include="src\main\csharp\Configuration\NmsTransportElement.cs" />
+ <Compile Include="src\main\csharp\ConnectionFactoryManager.cs" />
+ <Compile Include="src\main\csharp\InputQueue.cs" />
+ <Compile Include="src\main\csharp\NmsAsyncResult.cs" />
+ <Compile Include="src\main\csharp\NmsChannelBase.cs" />
+ <Compile Include="src\main\csharp\NmsChannelFactory.cs" />
+ <Compile Include="src\main\csharp\NmsChannelHelper.cs" />
+ <Compile Include="src\main\csharp\NmsChannelListener.cs" />
+ <Compile Include="src\main\csharp\NmsInputChannel.cs" />
+ <Compile Include="src\main\csharp\NmsOutputChannel.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="nant.build" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+</Project>
\ No newline at end of file
Added: activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.sln
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.sln?rev=709503&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.sln (added)
+++ activemq/activemq-dotnet/Apache.NMS.WCF/trunk/vs2008-nms-wcf.sln Fri Oct 31 10:43:10 2008
@@ -0,0 +1,24 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vs2008-nms-wcf", "vs2008-nms-wcf.csproj", "{96BAB638-2ECF-4648-8553-8FE6B9A4816F}"
+EndProject
+Global
+ GlobalSection(SubversionScc) = preSolution
+ Svn-Managed = True
+ Manager = AnkhSVN - Subversion Support for Visual Studio
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {96BAB638-2ECF-4648-8553-8FE6B9A4816F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {96BAB638-2ECF-4648-8553-8FE6B9A4816F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {96BAB638-2ECF-4648-8553-8FE6B9A4816F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {96BAB638-2ECF-4648-8553-8FE6B9A4816F}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal