summaryrefslogtreecommitdiff
path: root/wcf
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2010-04-27 22:02:16 +0000
committerStephen D. Huston <shuston@apache.org>2010-04-27 22:02:16 +0000
commite8235b0d5eaf981a39d71e2df0cf11cf854bd9fe (patch)
tree40a29c02f9851d353765950cd7a1e0772158dbc3 /wcf
parentc534d7ae8038fab332c8b354efebe34513fa6c88 (diff)
downloadqpid-python-e8235b0d5eaf981a39d71e2df0cf11cf854bd9fe.tar.gz
Applied patch from QPID-2516. New sample for WCF Channel configuration.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@938694 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'wcf')
-rw-r--r--wcf/samples/Channel/AppConfig/ConfigDemo.cs109
-rw-r--r--wcf/samples/Channel/AppConfig/ConfigDemo.csproj143
2 files changed, 252 insertions, 0 deletions
diff --git a/wcf/samples/Channel/AppConfig/ConfigDemo.cs b/wcf/samples/Channel/AppConfig/ConfigDemo.cs
new file mode 100644
index 0000000000..3a7eaef57f
--- /dev/null
+++ b/wcf/samples/Channel/AppConfig/ConfigDemo.cs
@@ -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);
+ }
+ }
+}
diff --git a/wcf/samples/Channel/AppConfig/ConfigDemo.csproj b/wcf/samples/Channel/AppConfig/ConfigDemo.csproj
new file mode 100644
index 0000000000..41ee6c4f0d
--- /dev/null
+++ b/wcf/samples/Channel/AppConfig/ConfigDemo.csproj
@@ -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>