You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by sh...@apache.org on 2010/04/28 00:02:16 UTC
svn commit: r938694 - in /qpid/trunk/qpid/wcf/samples/Channel/AppConfig: ./
ConfigDemo.cs ConfigDemo.csproj
Author: shuston
Date: Tue Apr 27 22:02:16 2010
New Revision: 938694
URL: http://svn.apache.org/viewvc?rev=938694&view=rev
Log:
Applied patch from QPID-2516. New sample for WCF Channel configuration.
Added:
qpid/trunk/qpid/wcf/samples/Channel/AppConfig/
qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.cs
qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.csproj
Added: qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.cs?rev=938694&view=auto
==============================================================================
--- qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.cs (added)
+++ qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.cs Tue Apr 27 22:02:16 2010
@@ -0,0 +1,109 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+
+namespace Apache.Qpid.Samples.Channel.Config
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Configuration;
+ using System.Diagnostics;
+ using System.IO;
+ using System.ServiceModel;
+ using System.ServiceModel.Channels;
+ using System.ServiceModel.Description;
+ using System.Threading;
+ using System.Text;
+ using System.Xml;
+ using Apache.Qpid.Channel;
+
+ [ServiceContract]
+ public interface IMessageProcessor
+ {
+ [OperationContract(IsOneWay = true, Action = "Process")]
+ void Process(string s);
+ }
+
+ public class DemoService : IMessageProcessor
+ {
+ private static ManualResetEvent messageArrived;
+
+ public DemoService()
+ {
+ }
+
+ public static ManualResetEvent MessageArrived
+ {
+ get
+ {
+ if (messageArrived == null)
+ {
+ messageArrived = new ManualResetEvent(false);
+ }
+
+ return messageArrived;
+ }
+ }
+
+ public void Process(string s)
+ {
+ Console.WriteLine("DemoService got message: {0}", s);
+ MessageArrived.Set();
+ }
+ }
+
+
+ public class ConfigDemo
+ {
+ static string demoQueueName = "wcf_config_demo";
+
+ static void BindingDemo(string bindingName, string queueName)
+ {
+ AmqpBinding binding = new AmqpBinding(bindingName);
+
+ Uri inUri = new Uri("amqp:" + queueName);
+ EndpointAddress outEndpoint = new EndpointAddress("amqp:amq.direct?routingkey=" + queueName);
+
+ ServiceHost serviceHost = new ServiceHost(typeof(DemoService));
+ serviceHost.AddServiceEndpoint(typeof(IMessageProcessor), binding, inUri);
+ serviceHost.Open();
+
+ ChannelFactory<IMessageProcessor> cf = new ChannelFactory<IMessageProcessor>(binding, outEndpoint);
+ cf.Open();
+ IMessageProcessor proxy = cf.CreateChannel();
+
+ // client and service are ready, so send a message
+ DemoService.MessageArrived.Reset();
+ Console.WriteLine("sending a message via " + bindingName);
+ proxy.Process("a sample message via " + bindingName);
+
+ // wait until it is safe to close down the service
+ DemoService.MessageArrived.WaitOne();
+ cf.Close();
+ serviceHost.Close();
+ }
+
+
+ static void Main(string[] mainArgs)
+ {
+ BindingDemo("amqpSampleBinding", demoQueueName);
+ }
+ }
+}
Added: qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.csproj
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.csproj?rev=938694&view=auto
==============================================================================
--- qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.csproj (added)
+++ qpid/trunk/qpid/wcf/samples/Channel/AppConfig/ConfigDemo.csproj Tue Apr 27 22:02:16 2010
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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 ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{46C5594A-3E8C-44AF-8F53-2A3004ED0311}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>ConfigDemo</RootNamespace>
+ <AssemblyName>ConfigDemo</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ <StartupObject>Apache.Qpid.Samples.Channel.Config.ConfigDemo</StartupObject>
+ </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>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ </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>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x86\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>bin\x86\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x86</PlatformTarget>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Apache.Qpid.Channel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=679e1f50b62dbace, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\src\Apache\Qpid\Channel\bin\Release\Apache.Qpid.Channel.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Runtime.Serialization">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.ServiceModel">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.ServiceModel.Web">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.XML" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ConfigDemo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\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>
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org