summaryrefslogtreecommitdiff
path: root/qpid/dotnet/client-010/addins
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/dotnet/client-010/addins')
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config12
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs290
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj89
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs56
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj86
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs44
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs56
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj83
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs62
-rw-r--r--qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs54
-rw-r--r--qpid/dotnet/client-010/addins/README.txt29
11 files changed, 861 insertions, 0 deletions
diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config
new file mode 100644
index 0000000000..66bf63532e
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddIn/Excel.exe.config
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="Host" value="localhost" />
+ <add key="Port" value="5672" />
+ <add key="VirtualHost" value="test" />
+ <add key="UserName" value="guest" />
+ <add key="Password" value="guest" />
+ <!-- <add key="ProcessorAssembly" value="C:\Project\qpid\dotnet\client-010\addins\ExcelAddInMessageProcessor\bin\Debug\ExcelAddInMessageProcessor.dll"/>
+ <add key="ProcessorClass" value="ExcelAddInMessageProcessor.Processor"/> -->
+ </appSettings>
+</configuration> \ No newline at end of file
diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs
new file mode 100644
index 0000000000..66c9b7a8f9
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.cs
@@ -0,0 +1,290 @@
+/*
+*
+* 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.Collections.Generic;
+using System.Configuration;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Text;
+using Microsoft.Office.Interop.Excel;
+using org.apache.qpid.client;
+using org.apache.qpid.transport;
+
+namespace ExcelAddIn
+{
+ public delegate string ProcessMessage(IMessage m);
+
+ /// <summary>
+ /// This interface must be implemented so to use a user defined message processor
+ /// </summary>
+ public interface MessageProcessor
+ {
+ string ProcessMessage(IMessage m);
+ }
+
+ [ComVisible(true), ProgId("Qpid")]
+ public class ExcelAddIn : IRtdServer
+ {
+ private IRTDUpdateEvent _onMessage;
+ private readonly Dictionary<int, IMessage> _topicMessages = new Dictionary<int, IMessage>();
+ private readonly Dictionary<string, QpidListener> _queueListener = new Dictionary<string, QpidListener>();
+ private readonly Dictionary<int, string> _topicQueueName = new Dictionary<int, string>();
+ private IClient _client;
+ private IClientSession _session;
+ private ProcessMessage _messageProcessor;
+
+ #region properties
+
+ public IRTDUpdateEvent OnMessage
+ {
+ get { return _onMessage; }
+ }
+
+ public Dictionary<int, IMessage> TopicMessages
+ {
+ get { return _topicMessages; }
+ }
+
+ public IClientSession Session
+ {
+ get { return _session; }
+ }
+
+ #endregion
+
+
+ #region IRtdServer Members
+
+ /// <summary>
+ /// Called when Excel requests the first RTD topic for the server.
+ /// Connect to the broker, returns a on success and 0 otherwise
+ /// </summary>
+ /// <param name="CallbackObject"></param>
+ /// <returns></returns>
+ public int ServerStart(IRTDUpdateEvent CallbackObject)
+ {
+ _onMessage = CallbackObject;
+ string host = "localhost";
+ string port = "5673";
+ string virtualhost = "test";
+ string username = "guest";
+ string password = "guest";
+ _messageProcessor = getMessage;
+
+ if( ConfigurationManager.AppSettings["Host"] != null )
+ {
+ host = ConfigurationManager.AppSettings["Host"];
+ }
+ if (ConfigurationManager.AppSettings["Port"] != null)
+ {
+ port = ConfigurationManager.AppSettings["Port"];
+ }
+ if (ConfigurationManager.AppSettings["VirtualHost"] != null)
+ {
+ virtualhost = ConfigurationManager.AppSettings["VirtualHost"];
+ }
+ if (ConfigurationManager.AppSettings["Username"] != null)
+ {
+ username = ConfigurationManager.AppSettings["UserName"];
+ }
+ if (ConfigurationManager.AppSettings["Password"] != null)
+ {
+ password = ConfigurationManager.AppSettings["Password"];
+ }
+ if (ConfigurationManager.AppSettings["ProcessorAssembly"] != null)
+ {
+ try
+ {
+ Assembly a = Assembly.LoadFrom(ConfigurationManager.AppSettings["ProcessorAssembly"]);
+ Object o = a.CreateInstance(ConfigurationManager.AppSettings["ProcessorClass"]);
+ MessageProcessor p = (MessageProcessor) o;
+ _messageProcessor = p.ProcessMessage;
+ }
+ catch (Exception e)
+ {
+ System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace);
+ return 0;
+ }
+ }
+
+ System.Windows.Forms.MessageBox.Show("Connection parameters: \n host: " + host + "\n port: "
+ + port + "\n user: " + username);
+ try
+ {
+ _client = new Client();
+ _client.Connect(host, Convert.ToInt16(port), virtualhost, username, password);
+ // create a session
+ _session = _client.CreateSession(0);
+ }
+ catch (Exception e)
+ {
+ System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace);
+ return 0;
+ }
+
+ // always successful
+ return 1;
+ }
+
+ /// <summary>
+ /// Called whenever Excel requests a new RTD topic from the RealTimeData server.
+ /// </summary>
+ /// <param name="TopicID"></param>
+ /// <param name="Strings"></param>
+ /// <param name="GetNewValues"></param>
+ /// <returns></returns>
+ public object ConnectData(int TopicID, ref Array Strings, ref bool GetNewValues)
+ {
+ try
+ {
+ string queuename = "defaultExcelAddInQueue";
+ string destinationName = "ExcelAddIn-" + queuename;
+ if( Strings.Length > 0 )
+ {
+ queuename = (string) Strings.GetValue(0);
+ }
+ // Error message if the queue does not exist
+ QueueQueryResult result = (QueueQueryResult)_session.QueueQuery(queuename).Result;
+ if( result.GetQueue() == null )
+ {
+ System.Windows.Forms.MessageBox.Show("Error: \n queue " + queuename + " does not exist");
+ return "error";
+ }
+
+ QpidListener listener;
+ _topicMessages.Add(TopicID, null);
+ _topicQueueName.Add(TopicID, queuename);
+ if (_queueListener.ContainsKey(queuename))
+ {
+ listener = _queueListener[queuename];
+ listener.addTopic(TopicID);
+ }
+ else
+ {
+ listener = new QpidListener(this);
+ listener.addTopic(TopicID);
+ _queueListener.Add(queuename, listener);
+ _session.AttachMessageListener(listener, destinationName);
+ _session.MessageSubscribe(queuename, destinationName, MessageAcceptMode.EXPLICIT,
+ MessageAcquireMode.PRE_ACQUIRED, null, 0, null);
+ // issue credits
+ _session.MessageSetFlowMode(destinationName, MessageFlowMode.WINDOW);
+ _session.MessageFlow(destinationName, MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES);
+ _session.MessageFlow(destinationName, MessageCreditUnit.MESSAGE, 1000);
+ _session.Sync();
+ }
+ }
+ catch (Exception e)
+ {
+ System.Windows.Forms.MessageBox.Show("Error: \n" + e.StackTrace);
+ return "error";
+ }
+ return "waiting";
+ }
+
+ /// <summary>
+ /// Called whenever Excel no longer requires a specific topic.
+ /// </summary>
+ /// <param name="TopicID"></param>
+ public void DisconnectData(int TopicID)
+ {
+ _topicMessages.Remove(TopicID);
+ string queueName = _topicQueueName[TopicID];
+ if (_topicQueueName.Remove(TopicID) && !_topicQueueName.ContainsValue(queueName))
+ {
+ _session.MessageStop("ExcelAddIn-" + queueName);
+ _session.MessageListeners.Remove("ExcelAddIn-" + queueName);
+ }
+ }
+
+ public int Heartbeat()
+ {
+ return 1;
+ }
+
+ public Array RefreshData(ref int TopicCount)
+ {
+ Array result = new object[2, _topicMessages.Count];
+ foreach (KeyValuePair<int, IMessage> pair in _topicMessages)
+ {
+ result.SetValue(pair.Key, 0, pair.Key);
+ string value = _messageProcessor(pair.Value);
+ result.SetValue(value, 1, pair.Key);
+ }
+ TopicCount = _topicMessages.Count;
+ return result;
+ }
+
+ public void ServerTerminate()
+ {
+
+ }
+
+ #endregion
+ //END IRTDServer METHODS
+
+ private string getMessage(IMessage m)
+ {
+ string res;
+ BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
+ byte[] body = new byte[m.Body.Length - m.Body.Position];
+ reader.Read(body, 0, body.Length);
+ ASCIIEncoding enc = new ASCIIEncoding();
+ res = enc.GetString(body);
+ return res;
+ }
+
+ }
+
+ class QpidListener : IMessageListener
+ {
+ private readonly ExcelAddIn _excel;
+ private readonly List<int> _topics = new List<int>();
+
+ public QpidListener(ExcelAddIn excel)
+ {
+ _excel = excel;
+ }
+
+ public void addTopic(int topic)
+ {
+ _topics.Add(topic);
+ }
+
+ public void MessageTransfer(IMessage m)
+ {
+ foreach (int i in _topics)
+ {
+ if (_excel.TopicMessages.ContainsKey(i))
+ {
+ _excel.TopicMessages[i] = m;
+ }
+ }
+ // ack this message
+ RangeSet rs = new RangeSet();
+ rs.Add(m.Id);
+ _excel.Session.MessageAccept(rs);
+ _excel.OnMessage.UpdateNotify();
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj
new file mode 100644
index 0000000000..b44bf9cc69
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddIn/ExcelAddIn.csproj
@@ -0,0 +1,89 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<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>{85EFD719-39F6-4471-90FF-9E621430344B}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ExcelAddIn</RootNamespace>
+ <AssemblyName>Qpid Excel AddIn</AssemblyName>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ </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>
+ <RegisterForComInterop>true</RegisterForComInterop>
+ <DocumentationFile>bin\Debug\Qpid Excel AddIn.XML</DocumentationFile>
+ </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="Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="**\*.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\client\Client.csproj">
+ <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
+ <Name>Client</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\App.config">
+ <Link>App.config</Link>
+ </None>
+ </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>
diff --git a/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddIn/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..67e95f69a3
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddIn/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.Reflection;
+using System.Runtime.CompilerServices;
+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 Excel AddIn")]
+[assembly: AssemblyDescription("Built from svn revision number: ")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Software Foundation")]
+[assembly: AssemblyProduct("Qpid Excel AddIn")]
+[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("3bbd4414-60df-407f-9c64-c14b221167af")]
+
+// 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("0.5.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj
new file mode 100644
index 0000000000..447ded4b55
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/ExcelAddInMessageProcessor.csproj
@@ -0,0 +1,86 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<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>{C2AE83A3-D5D1-469D-8611-A4738B9997CF}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ExcelAddInMessageProcessor</RootNamespace>
+ <AssemblyName>ExcelAddInMessageProcessor</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </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="**\*.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\client\Client.csproj">
+ <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
+ <Name>Client</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\ExcelAddIn\ExcelAddIn.csproj">
+ <Project>{85EFD719-39F6-4471-90FF-9E621430344B}</Project>
+ <Name>ExcelAddIn</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\App.config">
+ <Link>App.config</Link>
+ </None>
+ </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>
diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs
new file mode 100644
index 0000000000..e414da131f
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Processor.cs
@@ -0,0 +1,44 @@
+/*
+*
+* 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.IO;
+using System.Text;
+using org.apache.qpid.client;
+
+namespace ExcelAddInMessageProcessor
+{
+ class Processor : ExcelAddIn.MessageProcessor
+ {
+ public string ProcessMessage(IMessage m)
+ {
+ BinaryReader reader = new BinaryReader(m.Body, Encoding.UTF8);
+ byte[] body = new byte[m.Body.Length - m.Body.Position];
+ reader.Read(body, 0, body.Length);
+ ASCIIEncoding enc = new ASCIIEncoding();
+ string res = enc.GetString(body);
+ if (m.ApplicationHeaders.ContainsKey("price"))
+ {
+ res = res + ": price: " + m.ApplicationHeaders["price"];
+ }
+ return res;
+ }
+ }
+} \ No newline at end of file
diff --git a/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..302007674f
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddInMessageProcessor/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.Reflection;
+using System.Runtime.CompilerServices;
+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("ExcelAddInMessageProcessor")]
+[assembly: AssemblyDescription("Built from svn revision number: ")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Software Foundation")]
+[assembly: AssemblyProduct("ExcelAddInMessageProcessor")]
+[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("d20b2d75-7b8b-4f7d-8a81-40a4cce94195")]
+
+// 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("0.5.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj
new file mode 100644
index 0000000000..d9b1b63737
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/ExcelAddInProducer.csproj
@@ -0,0 +1,83 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<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>{80F00C3B-EB38-4B3B-9F77-68977A30B155}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ExcelAddInProducer</RootNamespace>
+ <AssemblyName>Qpid Excel AddIn Producer</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </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.configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="**\*.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\client\Client.csproj">
+ <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
+ <Name>Client</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\App.config">
+ <Link>App.config</Link>
+ </None>
+ </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>
diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs
new file mode 100644
index 0000000000..a8bbdf2fbd
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Program.cs
@@ -0,0 +1,62 @@
+/*
+*
+* 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.Configuration;
+using System.Text;
+using System.Threading;
+using org.apache.qpid.client;
+
+namespace ExcelAddInProducer
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ string host = ConfigurationManager.AppSettings["Host"];
+ int port = int.Parse(ConfigurationManager.AppSettings["Port"]);
+ string virtualhost = ConfigurationManager.AppSettings["VirtualHost"];
+ string username = ConfigurationManager.AppSettings["Username"];
+ string password = ConfigurationManager.AppSettings["Password"];
+
+ Client client = new Client();
+ Console.WriteLine("Client created");
+ client.Connect(host, port, virtualhost, username, password);
+ Console.WriteLine("Connection established");
+
+ IClientSession ssn = client.CreateSession(50000);
+ Console.WriteLine("Session created");
+ ssn.QueueDeclare("queue1", null, null);
+ ssn.ExchangeBind("queue1", "amq.direct", "queue1", null);
+ IMessage message = new Message();
+ message.ApplicationHeaders.Add("price", 0);
+ for (int i = 0; i < 100; i++)
+ {
+ message.ClearData();
+ message.AppendData( Encoding.UTF8.GetBytes("test: " + i));
+ message.ApplicationHeaders["price"] = i;
+ ssn.MessageTransfer("amq.direct", "queue1", message);
+ Thread.Sleep(1000);
+ }
+
+ client.Close();
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..28fe3427cb
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/ExcelAddInProducer/Properties/AssemblyInfo.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.Reflection;
+using System.Runtime.CompilerServices;
+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 Excel AddIn Producer")]
+[assembly: AssemblyDescription("Built from svn revision number: ")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Software Foundation")]
+[assembly: AssemblyProduct("Qpid Excel AddIn Producer")]
+[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("3416a5c2-eb70-4d77-b401-dfa659bd419e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("0.5.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/dotnet/client-010/addins/README.txt b/qpid/dotnet/client-010/addins/README.txt
new file mode 100644
index 0000000000..5f8df77189
--- /dev/null
+++ b/qpid/dotnet/client-010/addins/README.txt
@@ -0,0 +1,29 @@
+This project contains three sub-projects:
+- The RTD excell Addin
+- A sample client sending messages to queue1
+- A ample message processor
+
+RDT AddIn
+Excel provides a function called RTD (real-time data) that lets you specify a COM server via its ProgId here "Qpid" so that you can push qpid messages into Excel.
+For using the Qpid RTD follows those steps:
+
+1) Copy the configuration Excel.exe.config into C:\Program Files\Microsoft Office\Office12
+2) Edit Excel.exe.xml and set the targeted Qpid broker host, port number
+3) Select the cell or cell range to contain the information
+4) enter the following formula =rtd("Qpid",,"myQueue") Where MyQueue is the queue from which you wish to receive messages from
+
+Note: The Qpid RTD is a COM-AddIn that must be registered with Excel. This is done automatically when compiling the Addin with visual studio.
+
+The default behavior of the RDT AddIn is to display the message payload. This could be altered by specifying your own message processor.
+A Message processor is a class that implements the API ExcelAddIn.MessageProcessor. For example, the provided processor in client-010\addins\ExcelAddInMessageProcessor displays the message body and the the header price when specified.
+
+To use you own message processor follows those steps:
+1) Write your own message processor that extends ExcelAddIn.MessageProcessor
+2) Edit Excel.exe.config and uncomment the entries:
+ <add key="ProcessorAssembly" value="<path>\qpid\dotnet\client-010\addins\ExcelAddInMessageProcessor\bin\Debug\ExcelAddInMessageProcessor.dll"/>
+ <add key="ProcessorClass" value="ExcelAddInMessageProcessor.Processor"/>
+- ProcessorAssembly is the path on the Assembly that contains your processor class
+- ProcessorClass is your processor class name
+3) run excel and define a rtd function
+
+Note: the provided ExcelAddInProducer can be used for testing the provided message processor. As messages are sent to queue1 the following rtd fucntion should be used =rtd("Qpiud",,"queue1") \ No newline at end of file