Updated Branches: refs/heads/trunk 95fc0c060 -> b4dafca86
Renaming to ActiveMQExamples Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/b4dafca8 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/b4dafca8 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/b4dafca8 Branch: refs/heads/trunk Commit: b4dafca8696e6f9ed5eb10ec41dae9fd36e81d45 Parents: 95fc0c0 Author: Hiram Chirino <[email protected]> Authored: Thu Oct 10 10:46:06 2013 -0400 Committer: Hiram Chirino <[email protected]> Committed: Thu Oct 10 10:46:14 2013 -0400 ---------------------------------------------------------------------- .../ActiveMQExamples/ActiveMQExamples.sln | 26 +++++ .../ActiveMQExamples/ActiveMQExamples.userprefs | 30 ++++++ .../ActiveMQExamples/Listener/AssemblyInfo.cs | 44 ++++++++ .../ActiveMQExamples/Listener/Listener.cs | 106 +++++++++++++++++++ .../ActiveMQExamples/Listener/Listener.csproj | 1 + .../ActiveMQExamples/Listener/NMSTracer.cs | 78 ++++++++++++++ .../ActiveMQExamples/Publisher/AssemblyInfo.cs | 44 ++++++++ .../ActiveMQExamples/Publisher/NMSTracer.cs | 78 ++++++++++++++ .../ActiveMQExamples/Publisher/Publisher.cs | 87 +++++++++++++++ .../ActiveMQExamples/Publisher/Publisher.csproj | 1 + .../csharp/ApolloExamples/ApolloExamples.sln | 26 ----- .../ApolloExamples/ApolloExamples.userprefs | 30 ------ .../ApolloExamples/Listener/AssemblyInfo.cs | 44 -------- .../csharp/ApolloExamples/Listener/Listener.cs | 106 ------------------- .../ApolloExamples/Listener/Listener.csproj | 1 - .../csharp/ApolloExamples/Listener/NMSTracer.cs | 78 -------------- .../ApolloExamples/Publisher/AssemblyInfo.cs | 44 -------- .../ApolloExamples/Publisher/NMSTracer.cs | 78 -------------- .../ApolloExamples/Publisher/Publisher.cs | 87 --------------- .../ApolloExamples/Publisher/Publisher.csproj | 1 - 20 files changed, 495 insertions(+), 495 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.sln ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.sln b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.sln new file mode 100644 index 0000000..ade0d24 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Publisher", "Publisher\Publisher.csproj", "{0FEEC122-F3FD-4148-A461-0A724AE0C691}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Listener", "Listener\Listener.csproj", "{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Debug|x86.ActiveCfg = Debug|x86 + {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Debug|x86.Build.0 = Debug|x86 + {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Release|x86.ActiveCfg = Release|x86 + {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Release|x86.Build.0 = Release|x86 + {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Debug|x86.ActiveCfg = Debug|x86 + {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Debug|x86.Build.0 = Debug|x86 + {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Release|x86.ActiveCfg = Release|x86 + {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + StartupItem = Listener\Listener.csproj + EndGlobalSection +EndGlobal http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.userprefs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.userprefs b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.userprefs new file mode 100644 index 0000000..25e20b3 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/ActiveMQExamples.userprefs @@ -0,0 +1,30 @@ +<Properties> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" ctype="Workspace" /> + <MonoDevelop.Ide.Workbench ActiveDocument="Publisher/Publisher.cs" ctype="Workbench"> + <Files> + <File FileName="Listener/Listener.cs" Line="51" Column="48" /> + <File FileName="Publisher/Publisher.cs" Line="35" Column="30" /> + </Files> + <Pads> + <Pad Id="ProjectPad"> + <State expanded="True"> + <Node name="Listener" expanded="True"> + <Option id="ShowVersionControlOverlays" value="True" /> + <Option id="ShowAllFiles" value="False" /> + </Node> + <Node name="Publisher" expanded="True" selected="True"> + <Option id="ShowVersionControlOverlays" value="True" /> + <Option id="ShowAllFiles" value="False" /> + </Node> + </State> + </Pad> + <Pad Id="ClassPad"> + <State selected="True" /> + </Pad> + </Pads> + </MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.DebuggingService.Breakpoints> + <BreakpointStore /> + </MonoDevelop.Ide.DebuggingService.Breakpoints> + <MonoDevelop.Ide.DebuggingService.PinnedWatches ctype="PinnedWatchStore" /> +</Properties> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/AssemblyInfo.cs b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/AssemblyInfo.cs new file mode 100644 index 0000000..a1f96a9 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/AssemblyInfo.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.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Listener")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.cs b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.cs new file mode 100644 index 0000000..91971a5 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.cs @@ -0,0 +1,106 @@ +/* + * 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 Apache.NMS; +using Apache.NMS.Stomp; + +namespace ActiveMQ.Example +{ + class Listemer + { + public static void Main(string[] args) + { + Console.WriteLine("Starting up Listener."); + + String user = env("ACTIVEMQ_USER", "admin"); + String password = env("ACTIVEMQ_PASSWORD", "password"); + String host = env("ACTIVEMQ_HOST", "localhost"); + int port = Int32.Parse(env("ACTIVEMQ_PORT", "61613")); + String destination = arg(args, 0, "event"); + + String brokerUri = "stomp:tcp://" + host + ":" + port + "?transport.useLogging=true"; + NMSConnectionFactory factory = new NMSConnectionFactory(brokerUri); + + IConnection connection = factory.CreateConnection(user, password); + connection.Start(); + ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge); + IDestination dest = session.GetTopic(destination); + + IMessageConsumer consumer = session.CreateConsumer(dest); + DateTime start = DateTime.Now; + long count = 0; + + Console.WriteLine("Waiting for messages..."); + while (true) + { + IMessage msg = consumer.Receive(); + if (msg is ITextMessage) + { + ITextMessage txtMsg = msg as ITextMessage; + String body = txtMsg.Text; + if ("SHUTDOWN".Equals(body)) + { + TimeSpan diff = DateTime.Now - start; + Console.WriteLine(String.Format("Received {0} in {1} seconds", count, (1.0*diff.TotalMilliseconds/1000.0))); + break; + } + else + { + if (count == 0) + { + start = DateTime.Now; + } + count ++; + if (count % 1000 == 0) + { + Console.WriteLine(String.Format("Received {0} messages.", count)); + } + } + + } + else + { + Console.WriteLine("Unexpected message type: " + msg.GetType().Name); + } + } + + Console.WriteLine("Shutting down Listener."); + connection.Close(); + } + + private static String env(String key, String defaultValue) + { + String rc = System.Environment.GetEnvironmentVariable(key); + if (rc == null) + { + return defaultValue; + } + return rc; + } + + private static String arg(String []args, int index, String defaultValue) + { + if (index < args.Length) + { + return args[index]; + } + return defaultValue; + } + } +} http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.csproj ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.csproj b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.csproj new file mode 100644 index 0000000..9813110 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/Listener.csproj @@ -0,0 +1 @@ +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}</ProjectGuid> <OutputType>Exe</OutputType> <RootNamespace>Listener</RootNamespace> <AssemblyName>Listener</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug</OutputPath> <DefineConstants>DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLeve l> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <DebugType>none</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Release</OutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="Apache.NMS, Version=1.5.0.2196, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\mono-2.0\debug\Apache.NMS.dll</HintPath> </Reference> <Reference Include="Apache.NMS.Stomp, Version=1.6.0.2211, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\ mono-2.0\debug\Apache.NMS.Stomp.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Listener.cs" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="NMSTracer.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/NMSTracer.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/NMSTracer.cs b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/NMSTracer.cs new file mode 100755 index 0000000..b37af66 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Listener/NMSTracer.cs @@ -0,0 +1,78 @@ +/* + * 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 ActiveMQ.Example +{ + public class NmsTracer : Apache.NMS.ITrace + { + #region ITrace Members + public void Debug(string message) + { + Console.WriteLine("DEBUG: " + message); + } + + public void Error(string message) + { + Console.WriteLine("ERROR: " + message); + } + + public void Fatal(string message) + { + Console.WriteLine("FATAL: " + message); + } + + public void Info(string message) + { + Console.WriteLine("INFO: " + message); + } + + public void Warn(string message) + { + Console.WriteLine("WARN: " + message); + } + + public bool IsDebugEnabled + { + get { return true; } + } + + public bool IsErrorEnabled + { + get { return true; } + } + + public bool IsFatalEnabled + { + get { return true; } + } + + public bool IsInfoEnabled + { + get { return true; } + } + + public bool IsWarnEnabled + { + get { return true; } + } + + #endregion + } +} + http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/AssemblyInfo.cs b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/AssemblyInfo.cs new file mode 100644 index 0000000..2628d12 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/AssemblyInfo.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.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("Publisher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/NMSTracer.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/NMSTracer.cs b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/NMSTracer.cs new file mode 100755 index 0000000..b37af66 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/NMSTracer.cs @@ -0,0 +1,78 @@ +/* + * 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 ActiveMQ.Example +{ + public class NmsTracer : Apache.NMS.ITrace + { + #region ITrace Members + public void Debug(string message) + { + Console.WriteLine("DEBUG: " + message); + } + + public void Error(string message) + { + Console.WriteLine("ERROR: " + message); + } + + public void Fatal(string message) + { + Console.WriteLine("FATAL: " + message); + } + + public void Info(string message) + { + Console.WriteLine("INFO: " + message); + } + + public void Warn(string message) + { + Console.WriteLine("WARN: " + message); + } + + public bool IsDebugEnabled + { + get { return true; } + } + + public bool IsErrorEnabled + { + get { return true; } + } + + public bool IsFatalEnabled + { + get { return true; } + } + + public bool IsInfoEnabled + { + get { return true; } + } + + public bool IsWarnEnabled + { + get { return true; } + } + + #endregion + } +} + http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.cs b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.cs new file mode 100644 index 0000000..178afa2 --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.cs @@ -0,0 +1,87 @@ +/* + * 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 Apache.NMS; +using Apache.NMS.Stomp; + +namespace ActiveMQ.Example +{ + class Publisher + { + public static void Main (string[] args) + { + String user = env("ACTIVEMQ_USER", "admin"); + String password = env("ACTIVEMQ_PASSWORD", "password"); + String host = env("ACTIVEMQ_HOST", "localhost"); + int port = Int32.Parse(env("ACTIVEMQ_PORT", "61613")); + String destination = arg(args, 0, "event"); + + int messages = 10000; + int size = 256; + + String DATA = "abcdefghijklmnopqrstuvwxyz"; + String body = ""; + for(int i=0; i < size; i ++) + { + body += DATA[i%DATA.Length]; + } + + String brokerUri = "stomp:tcp://" + host + ":" + port; + NMSConnectionFactory factory = new NMSConnectionFactory(brokerUri); + + IConnection connection = factory.CreateConnection(user, password); + connection.Start(); + ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge); + IDestination dest = session.GetTopic(destination); + IMessageProducer producer = session.CreateProducer(dest); + producer.DeliveryMode = MsgDeliveryMode.NonPersistent; + + for (int i=1; i <= messages; i ++) + { + producer.Send(session.CreateTextMessage(body)); + if ((i % 1000) == 0) + { + Console.WriteLine(String.Format("Sent {0} messages", i)); + } + } + + producer.Send(session.CreateTextMessage("SHUTDOWN")); + connection.Close(); + } + + private static String env(String key, String defaultValue) + { + String rc = System.Environment.GetEnvironmentVariable(key); + if (rc == null) + { + return defaultValue; + } + return rc; + } + + private static String arg(String []args, int index, String defaultValue) + { + if (index < args.Length) + { + return args[index]; + } + return defaultValue; + } + } +} http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.csproj ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.csproj b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.csproj new file mode 100644 index 0000000..1f4e30e --- /dev/null +++ b/assembly/src/release/examples/stomp/csharp/ActiveMQExamples/Publisher/Publisher.csproj @@ -0,0 +1 @@ +<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0FEEC122-F3FD-4148-A461-0A724AE0C691}</ProjectGuid> <OutputType>Exe</OutputType> <RootNamespace>Publisher</RootNamespace> <AssemblyName>Publisher</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug</OutputPath> <DefineConstants>DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLe vel> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <DebugType>none</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Release</OutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="Apache.NMS, Version=1.5.0.2196, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\mono-2.0\debug\Apache.NMS.dll</HintPath> </Reference> <Reference Include="Apache.NMS.Stomp, Version=1.6.0.2211, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\buil d\mono-2.0\debug\Apache.NMS.Stomp.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Publisher.cs" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="NMSTracer.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln b/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln deleted file mode 100644 index ade0d24..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Publisher", "Publisher\Publisher.csproj", "{0FEEC122-F3FD-4148-A461-0A724AE0C691}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Listener", "Listener\Listener.csproj", "{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Debug|x86.ActiveCfg = Debug|x86 - {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Debug|x86.Build.0 = Debug|x86 - {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Release|x86.ActiveCfg = Release|x86 - {08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Release|x86.Build.0 = Release|x86 - {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Debug|x86.ActiveCfg = Debug|x86 - {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Debug|x86.Build.0 = Debug|x86 - {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Release|x86.ActiveCfg = Release|x86 - {0FEEC122-F3FD-4148-A461-0A724AE0C691}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = Listener\Listener.csproj - EndGlobalSection -EndGlobal http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs deleted file mode 100644 index 25e20b3..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs +++ /dev/null @@ -1,30 +0,0 @@ -<Properties> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" ctype="Workspace" /> - <MonoDevelop.Ide.Workbench ActiveDocument="Publisher/Publisher.cs" ctype="Workbench"> - <Files> - <File FileName="Listener/Listener.cs" Line="51" Column="48" /> - <File FileName="Publisher/Publisher.cs" Line="35" Column="30" /> - </Files> - <Pads> - <Pad Id="ProjectPad"> - <State expanded="True"> - <Node name="Listener" expanded="True"> - <Option id="ShowVersionControlOverlays" value="True" /> - <Option id="ShowAllFiles" value="False" /> - </Node> - <Node name="Publisher" expanded="True" selected="True"> - <Option id="ShowVersionControlOverlays" value="True" /> - <Option id="ShowAllFiles" value="False" /> - </Node> - </State> - </Pad> - <Pad Id="ClassPad"> - <State selected="True" /> - </Pad> - </Pads> - </MonoDevelop.Ide.Workbench> - <MonoDevelop.Ide.DebuggingService.Breakpoints> - <BreakpointStore /> - </MonoDevelop.Ide.DebuggingService.Breakpoints> - <MonoDevelop.Ide.DebuggingService.PinnedWatches ctype="PinnedWatchStore" /> -</Properties> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs deleted file mode 100644 index a1f96a9..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Listener")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.*")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs deleted file mode 100644 index 91971a5..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 Apache.NMS; -using Apache.NMS.Stomp; - -namespace ActiveMQ.Example -{ - class Listemer - { - public static void Main(string[] args) - { - Console.WriteLine("Starting up Listener."); - - String user = env("ACTIVEMQ_USER", "admin"); - String password = env("ACTIVEMQ_PASSWORD", "password"); - String host = env("ACTIVEMQ_HOST", "localhost"); - int port = Int32.Parse(env("ACTIVEMQ_PORT", "61613")); - String destination = arg(args, 0, "event"); - - String brokerUri = "stomp:tcp://" + host + ":" + port + "?transport.useLogging=true"; - NMSConnectionFactory factory = new NMSConnectionFactory(brokerUri); - - IConnection connection = factory.CreateConnection(user, password); - connection.Start(); - ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge); - IDestination dest = session.GetTopic(destination); - - IMessageConsumer consumer = session.CreateConsumer(dest); - DateTime start = DateTime.Now; - long count = 0; - - Console.WriteLine("Waiting for messages..."); - while (true) - { - IMessage msg = consumer.Receive(); - if (msg is ITextMessage) - { - ITextMessage txtMsg = msg as ITextMessage; - String body = txtMsg.Text; - if ("SHUTDOWN".Equals(body)) - { - TimeSpan diff = DateTime.Now - start; - Console.WriteLine(String.Format("Received {0} in {1} seconds", count, (1.0*diff.TotalMilliseconds/1000.0))); - break; - } - else - { - if (count == 0) - { - start = DateTime.Now; - } - count ++; - if (count % 1000 == 0) - { - Console.WriteLine(String.Format("Received {0} messages.", count)); - } - } - - } - else - { - Console.WriteLine("Unexpected message type: " + msg.GetType().Name); - } - } - - Console.WriteLine("Shutting down Listener."); - connection.Close(); - } - - private static String env(String key, String defaultValue) - { - String rc = System.Environment.GetEnvironmentVariable(key); - if (rc == null) - { - return defaultValue; - } - return rc; - } - - private static String arg(String []args, int index, String defaultValue) - { - if (index < args.Length) - { - return args[index]; - } - return defaultValue; - } - } -} http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj deleted file mode 100644 index 9813110..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}</ProjectGuid> <OutputType>Exe</OutputType> <RootNamespace>Listener</RootNamespace> <AssemblyName>Listener</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug</OutputPath> <DefineConstants>DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLeve l> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <DebugType>none</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Release</OutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="Apache.NMS, Version=1.5.0.2196, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\mono-2.0\debug\Apache.NMS.dll</HintPath> </Reference> <Reference Include="Apache.NMS.Stomp, Version=1.6.0.2211, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\ mono-2.0\debug\Apache.NMS.Stomp.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Listener.cs" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="NMSTracer.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs deleted file mode 100755 index b37af66..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 ActiveMQ.Example -{ - public class NmsTracer : Apache.NMS.ITrace - { - #region ITrace Members - public void Debug(string message) - { - Console.WriteLine("DEBUG: " + message); - } - - public void Error(string message) - { - Console.WriteLine("ERROR: " + message); - } - - public void Fatal(string message) - { - Console.WriteLine("FATAL: " + message); - } - - public void Info(string message) - { - Console.WriteLine("INFO: " + message); - } - - public void Warn(string message) - { - Console.WriteLine("WARN: " + message); - } - - public bool IsDebugEnabled - { - get { return true; } - } - - public bool IsErrorEnabled - { - get { return true; } - } - - public bool IsFatalEnabled - { - get { return true; } - } - - public bool IsInfoEnabled - { - get { return true; } - } - - public bool IsWarnEnabled - { - get { return true; } - } - - #endregion - } -} - http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs deleted file mode 100644 index 2628d12..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Publisher")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.0.*")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs deleted file mode 100755 index b37af66..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 ActiveMQ.Example -{ - public class NmsTracer : Apache.NMS.ITrace - { - #region ITrace Members - public void Debug(string message) - { - Console.WriteLine("DEBUG: " + message); - } - - public void Error(string message) - { - Console.WriteLine("ERROR: " + message); - } - - public void Fatal(string message) - { - Console.WriteLine("FATAL: " + message); - } - - public void Info(string message) - { - Console.WriteLine("INFO: " + message); - } - - public void Warn(string message) - { - Console.WriteLine("WARN: " + message); - } - - public bool IsDebugEnabled - { - get { return true; } - } - - public bool IsErrorEnabled - { - get { return true; } - } - - public bool IsFatalEnabled - { - get { return true; } - } - - public bool IsInfoEnabled - { - get { return true; } - } - - public bool IsWarnEnabled - { - get { return true; } - } - - #endregion - } -} - http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs deleted file mode 100644 index 178afa2..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 Apache.NMS; -using Apache.NMS.Stomp; - -namespace ActiveMQ.Example -{ - class Publisher - { - public static void Main (string[] args) - { - String user = env("ACTIVEMQ_USER", "admin"); - String password = env("ACTIVEMQ_PASSWORD", "password"); - String host = env("ACTIVEMQ_HOST", "localhost"); - int port = Int32.Parse(env("ACTIVEMQ_PORT", "61613")); - String destination = arg(args, 0, "event"); - - int messages = 10000; - int size = 256; - - String DATA = "abcdefghijklmnopqrstuvwxyz"; - String body = ""; - for(int i=0; i < size; i ++) - { - body += DATA[i%DATA.Length]; - } - - String brokerUri = "stomp:tcp://" + host + ":" + port; - NMSConnectionFactory factory = new NMSConnectionFactory(brokerUri); - - IConnection connection = factory.CreateConnection(user, password); - connection.Start(); - ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge); - IDestination dest = session.GetTopic(destination); - IMessageProducer producer = session.CreateProducer(dest); - producer.DeliveryMode = MsgDeliveryMode.NonPersistent; - - for (int i=1; i <= messages; i ++) - { - producer.Send(session.CreateTextMessage(body)); - if ((i % 1000) == 0) - { - Console.WriteLine(String.Format("Sent {0} messages", i)); - } - } - - producer.Send(session.CreateTextMessage("SHUTDOWN")); - connection.Close(); - } - - private static String env(String key, String defaultValue) - { - String rc = System.Environment.GetEnvironmentVariable(key); - if (rc == null) - { - return defaultValue; - } - return rc; - } - - private static String arg(String []args, int index, String defaultValue) - { - if (index < args.Length) - { - return args[index]; - } - return defaultValue; - } - } -} http://git-wip-us.apache.org/repos/asf/activemq/blob/b4dafca8/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj ---------------------------------------------------------------------- diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj deleted file mode 100644 index 1f4e30e..0000000 --- a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj +++ /dev/null @@ -1 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0FEEC122-F3FD-4148-A461-0A724AE0C691}</ProjectGuid> <OutputType>Exe</OutputType> <RootNamespace>Publisher</RootNamespace> <AssemblyName>Publisher</AssemblyName> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug</OutputPath> <DefineConstants>DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLe vel> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <DebugType>none</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Release</OutputPath> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> <Externalconsole>true</Externalconsole> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="Apache.NMS, Version=1.5.0.2196, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\mono-2.0\debug\Apache.NMS.dll</HintPath> </Reference> <Reference Include="Apache.NMS.Stomp, Version=1.6.0.2211, Culture=neutral, PublicKeyToken=82756feee3957618"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\dev\activemq\NMS.Stomp\buil d\mono-2.0\debug\Apache.NMS.Stomp.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="Publisher.cs" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="NMSTracer.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> </Project> \ No newline at end of file
