From 8faa1d55ca1507ae4913e5476f21fbcd83e70bfe Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Thu, 24 Jun 2010 12:40:11 +0000 Subject: QPID-2589 - Patch from Chuck Rolke Visual Basic example added, UUID support added, C# Hello World example added. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@957531 13f79535-47bb-0310-9956-ffa450edef68 --- .../Properties/AssemblyInfo.cs | 36 ++++++++++ .../csharp.example.helloworld.cs | 55 +++++++++++++++ .../csharp.example.helloworld.csproj | 81 ++++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs create mode 100644 cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs create mode 100644 cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj (limited to 'cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld') diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..2b96ce9122 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("csharp.direct.sender")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("csharp.direct.sender")] +[assembly: AssemblyCopyright("Copyright ? 2010")] +[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("19ce67e4-db90-4480-88c4-3721f47634c7")] + +// 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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs new file mode 100644 index 0000000000..336970a3ba --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.cs @@ -0,0 +1,55 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +using System; +using Org.Apache.Qpid.Messaging; + +namespace Org.Apache.Qpid.Messaging { + class Program { + static void Main(string[] args) { + String broker = args.Length > 0 ? args[0] : "localhost:5672"; + String address = args.Length > 1 ? args[1] : "amq.topic"; + + Connection connection = null; + try { + connection = new Connection(broker); + connection.Open(); + Session session = connection.CreateSession(); + + Receiver receiver = session.CreateReceiver(address); + Sender sender = session.CreateSender(address); + + sender.Send(new Message("Hello world!")); + + Message message = new Message(); + message = receiver.Fetch(DurationConstants.SECOND * 1); + Console.WriteLine("{0}", message.GetContent()); + session.Acknowledge(); + + connection.Close(); + } catch (Exception e) { + Console.WriteLine("Exception {0}.", e); + if (null != connection) + connection.Close(); + } + } + } +} diff --git a/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj new file mode 100644 index 0000000000..3038ed64a3 --- /dev/null +++ b/cpp/bindings/qpid/dotnet/examples/csharp.example.helloworld/csharp.example.helloworld.csproj @@ -0,0 +1,81 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {8CC1C265-0507-44A3-9483-8FAF48513F4D} + Exe + Properties + csharp.example.helloworld + csharp.example.helloworld + v3.5 + 512 + + + true + full + false + ..\..\..\..\..\src\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\..\..\src\Release\ + TRACE + prompt + 4 + + + true + ..\..\..\..\..\src\Debug\ + DEBUG;TRACE + full + x86 + prompt + + + ..\..\..\..\..\src\Release\ + TRACE + true + pdbonly + x86 + prompt + + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + {AA5A3B83-5F98-406D-A01C-5A921467A57D} + Org.Apache.Qpid.Messaging + + + + + -- cgit v1.2.1