зеркало из https://github.com/microsoft/AMBROSIA.git
Working Streaming Demo
This commit is contained in:
Родитель
d5e02c0fcb
Коммит
579a6daad8
|
@ -10,29 +10,37 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Ambrosia;
|
||||
using Mono.Options;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace Analytics
|
||||
{
|
||||
[DataContract]
|
||||
class Analytics : Immortal, IAnalytics
|
||||
class Analytics : Immortal<IAnalyticsProxy>, IAnalytics
|
||||
{
|
||||
Subject<StreamEvent<Tweet>> _tweetConduit;
|
||||
Process _queryProcess;
|
||||
IObservable<StreamEvent<Tweet>> _inputObservable;
|
||||
|
||||
[DataMember]
|
||||
IDashboardProxy _dashboard;
|
||||
|
||||
[DataMember]
|
||||
bool _serializedQueryOnce;
|
||||
|
||||
|
||||
public Analytics()
|
||||
{
|
||||
_serializedQueryOnce = false;
|
||||
}
|
||||
|
||||
protected override async Task<bool> OnFirstStart()
|
||||
{
|
||||
Console.WriteLine("analytics starting entry point");
|
||||
_dashboard = GetProxy<IDashboardProxy>(DashboardServiceName);
|
||||
var query = CreateQuery();
|
||||
_queryProcess = query.Restore();
|
||||
Console.WriteLine("analytics ending entry point");
|
||||
lock (_dashboard)
|
||||
{
|
||||
var query = CreateQuery();
|
||||
_queryProcess = query.Restore();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -76,25 +84,68 @@ namespace Analytics
|
|||
|
||||
public async Task OnNextAsync(StreamEvent<Tweet> next)
|
||||
{
|
||||
_tweetConduit.OnNext(next);
|
||||
lock (_dashboard)
|
||||
{
|
||||
if (_queryProcess != null)
|
||||
{
|
||||
_tweetConduit.OnNext(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSave(Stream stream)
|
||||
{
|
||||
if (_queryProcess != null)
|
||||
{
|
||||
_queryProcess.Checkpoint(stream);
|
||||
lock (_dashboard)
|
||||
{
|
||||
_queryProcess.Checkpoint(stream);
|
||||
_serializedQueryOnce = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void BecomingPrimary()
|
||||
{
|
||||
// Read Twitter auth information and topics of interest from App.config
|
||||
var twitterConfig = ReadTwitterInputConfig();
|
||||
|
||||
// Create an observable of tweets with sentiment
|
||||
_inputObservable = TwitterStream.Create(twitterConfig);
|
||||
|
||||
_inputObservable.ForEachAsync(
|
||||
x =>
|
||||
{
|
||||
if (x.IsData)
|
||||
{
|
||||
Console.WriteLine("{0}", x.ToString());
|
||||
thisProxy.OnNextFork(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnRestore(Stream stream)
|
||||
{
|
||||
if (stream.Length > 0)
|
||||
if (_serializedQueryOnce)
|
||||
{
|
||||
Console.WriteLine("Deserializing Trill Query!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
var query = CreateQuery();
|
||||
_queryProcess = query.Restore(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public static TwitterConfig ReadTwitterInputConfig()
|
||||
{
|
||||
return new TwitterConfig
|
||||
{
|
||||
// Put your keys and secrets here
|
||||
oauth_consumer_key = "",
|
||||
oauth_consumer_secret = "",
|
||||
oauth_token = "",
|
||||
oauth_token_secret = "",
|
||||
twitter_keywords = "Office Microsoft,Surface Microsoft,Phone Window,Windows 8,SQL Server,SharePoint,Bing,Skype,XBox,System Center,Microsoft,msftluv"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,11 +5,13 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using TwitterObservable;
|
||||
using Microsoft.StreamProcessing;
|
||||
using Ambrosia;
|
||||
|
||||
namespace Analytics
|
||||
{
|
||||
public interface IAnalytics
|
||||
{
|
||||
[ImpulseHandler]
|
||||
void OnNext(StreamEvent<Tweet> next);
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@
|
|||
<DefineConstants>NETCORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.6.3" />
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.12.1" />
|
||||
<PackageReference Include="Trill">
|
||||
<Version>2018.3.2.1</Version>
|
||||
</PackageReference>
|
||||
|
|
|
@ -26,8 +26,8 @@ namespace DashboardFancy
|
|||
{
|
||||
dash = this;
|
||||
InitializeComponent();
|
||||
int receivePort = 1001;
|
||||
int sendPort = 1000;
|
||||
int receivePort = 3001;
|
||||
int sendPort = 3000;
|
||||
var myClient = new TwitterDashboard(this);
|
||||
new Thread(new ThreadStart(() => _container = AmbrosiaFactory.Deploy<IDashboard>(DashboardServiceName, myClient, receivePort, sendPort))).Start();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<DefineConstants>NETCORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.6.3" />
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.12.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GeneratedSourceFiles\DashboardAPIGeneratedNet46\latest\DashboardAPIGeneratedNet46.csproj" />
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<DefineConstants>NETCORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.6.3" />
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.12.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TwitterObservable\TwitterObservable.csproj" />
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>net46</TargetFrameworks>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<Platforms>x64</Platforms>
|
||||
<RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TargetFramework>net46</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.6.3" />
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.12.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="2.7.0" />
|
||||
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
|
||||
<PackageReference Include="Remote.Linq" Version="5.8.1" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />
|
||||
<PackageReference Include="Trill" Version="2018.3.2.1" />
|
||||
<ProjectReference Include="..\..\..\TwitterObservable\TwitterObservable.csproj" />
|
||||
<PackageReference Update="Microsoft.NETCore.App=" Version="2.0.0=" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace Analytics
|
|||
[Ambrosia.InstanceProxy(typeof(IAnalytics))]
|
||||
public interface IAnalyticsProxy
|
||||
{
|
||||
Task OnNextAsync(Microsoft.StreamProcessing.StreamEvent<TwitterObservable.Tweet> p_0);
|
||||
void OnNextFork(Microsoft.StreamProcessing.StreamEvent<TwitterObservable.Tweet> p_0);
|
||||
}
|
||||
}
|
|
@ -22,58 +22,6 @@ namespace Analytics
|
|||
{
|
||||
}
|
||||
|
||||
async Task
|
||||
IAnalyticsProxy.OnNextAsync(Microsoft.StreamProcessing.StreamEvent<TwitterObservable.Tweet> p_0)
|
||||
{
|
||||
await OnNextAsync(p_0);
|
||||
}
|
||||
|
||||
async Task
|
||||
OnNextAsync(Microsoft.StreamProcessing.StreamEvent<TwitterObservable.Tweet> p_0)
|
||||
{
|
||||
SerializableTaskCompletionSource rpcTask;
|
||||
// Make call, wait for reply
|
||||
// Compute size of serialized arguments
|
||||
var totalArgSize = 0;
|
||||
|
||||
int arg0Size = 0;
|
||||
byte[] arg0Bytes = null;
|
||||
|
||||
// Argument 0
|
||||
arg0Bytes = Ambrosia.BinarySerializer.Serialize<Microsoft.StreamProcessing.StreamEvent<TwitterObservable.Tweet>>(p_0);
|
||||
arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
|
||||
|
||||
totalArgSize += arg0Size;
|
||||
|
||||
var wp = this.StartRPC<object>(methodIdentifier: 1 /* method identifier for OnNext */, lengthOfSerializedArguments: totalArgSize, taskToWaitFor: out rpcTask);
|
||||
var asyncContext = new AsyncContext { SequenceNumber = Immortal.CurrentSequenceNumber };
|
||||
|
||||
// Serialize arguments
|
||||
|
||||
|
||||
// Serialize arg0
|
||||
wp.curLength += wp.PageBytes.WriteInt(wp.curLength, arg0Bytes.Length);
|
||||
Buffer.BlockCopy(arg0Bytes, 0, wp.PageBytes, wp.curLength, arg0Bytes.Length);
|
||||
wp.curLength += arg0Bytes.Length;
|
||||
|
||||
|
||||
ReleaseBufferAndSend();
|
||||
|
||||
var taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
|
||||
var currentResult = await taskToWaitFor;
|
||||
|
||||
var isSaved = await Immortal.TrySaveContextContinuationAsync(currentResult);
|
||||
|
||||
if (isSaved)
|
||||
{
|
||||
taskToWaitFor = Immortal.CallCache.Data[asyncContext.SequenceNumber].GetAwaitableTaskWithAdditionalInfoAsync();
|
||||
currentResult = await taskToWaitFor;
|
||||
}
|
||||
|
||||
await Immortal.TryTakeCheckpointContinuationAsync(currentResult);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void IAnalyticsProxy.OnNextFork(Microsoft.StreamProcessing.StreamEvent<TwitterObservable.Tweet> p_0)
|
||||
{
|
||||
|
@ -91,7 +39,7 @@ arg0Size = IntSize(arg0Bytes.Length) + arg0Bytes.Length;
|
|||
|
||||
totalArgSize += arg0Size;
|
||||
|
||||
var wp = this.StartRPC<object>(1 /* method identifier for OnNext */, totalArgSize, out rpcTask, RpcTypes.RpcType.FireAndForget);
|
||||
var wp = this.StartRPC<object>(1 /* method identifier for OnNext */, totalArgSize, out rpcTask, RpcTypes.RpcType.Impulse);
|
||||
|
||||
// Serialize arguments
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>net46</TargetFrameworks>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<Platforms>x64</Platforms>
|
||||
<RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net46</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.6.3" />
|
||||
<PackageReference Include="AmbrosiaLibCS" Version="2018.12.12.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="2.7.0" />
|
||||
<PackageReference Include="Mono.Options.Core" Version="1.0.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />
|
||||
<ProjectReference Include="..\..\..\TwitterObservable\TwitterObservable.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<PackageReference Update="Microsoft.NETCore.App=" Version="2.0.0=" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TwitterSubscription", "TwitterSubscription\TwitterSubscription.csproj", "{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TwitterObservable", "TwitterObservable\TwitterObservable.csproj", "{15BB3B74-3463-4D4F-8174-550890CA14AC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analytics", "Analytics\Analytics.csproj", "{FB65021C-C468-428C-8593-DF682ED562AB}"
|
||||
|
@ -37,16 +35,6 @@ Global
|
|||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Debug|x64.Build.0 = Debug|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Release|ARM.ActiveCfg = Release|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Release|x64.ActiveCfg = Release|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Release|x64.Build.0 = Release|x64
|
||||
{CE3A9D8D-C0A2-44A4-9572-0FAC5FB6CE5E}.Release|x86.ActiveCfg = Release|x64
|
||||
{15BB3B74-3463-4D4F-8174-550890CA14AC}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{15BB3B74-3463-4D4F-8174-550890CA14AC}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{15BB3B74-3463-4D4F-8174-550890CA14AC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
@ -107,26 +95,38 @@ Global
|
|||
{1AA08A35-A6F6-4857-AF3A-B3D375F02008}.Release|x64.ActiveCfg = Release|x64
|
||||
{1AA08A35-A6F6-4857-AF3A-B3D375F02008}.Release|x64.Build.0 = Release|x64
|
||||
{1AA08A35-A6F6-4857-AF3A-B3D375F02008}.Release|x86.ActiveCfg = Release|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|x64.Build.0 = Debug|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|ARM.ActiveCfg = Release|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|x64.ActiveCfg = Release|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|x64.Build.0 = Release|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|x86.ActiveCfg = Release|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|x64.Build.0 = Debug|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|ARM.ActiveCfg = Release|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|x64.ActiveCfg = Release|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|x64.Build.0 = Release|x64
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|x86.ActiveCfg = Release|x64
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D27B415A-179E-4EEB-9AA3-4A00090346F3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{DEDC47FA-3820-4E67-B49F-133826F190D4}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ITwitterDashboard
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>10ceea7d-7648-47eb-9b0b-2aafeb5dd7e5</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ITwitterDashboard</RootNamespace>
|
||||
<AssemblyName>ITwitterDashboard</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</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.Core"/>
|
||||
<Reference Include="System.Xml.Linq"/>
|
||||
<Reference Include="System.Data.DataSetExtensions"/>
|
||||
|
||||
|
||||
<Reference Include="Microsoft.CSharp"/>
|
||||
|
||||
<Reference Include="System.Data"/>
|
||||
|
||||
<Reference Include="System.Net.Http"/>
|
||||
|
||||
<Reference Include="System.Xml"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,36 +0,0 @@
|
|||
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("ITwitterDashboard")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ITwitterDashboard")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("10ceea7d-7648-47eb-9b0b-2aafeb5dd7e5")]
|
||||
|
||||
// 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")]
|
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Azure.KeyVault.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.4.1.0" newVersion="1.4.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Xml.ReaderWriter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,57 +0,0 @@
|
|||
using Research.Franklin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TwitterDashboardAPI;
|
||||
using TwitterObservable;
|
||||
using static Research.Franklin.ServiceConfiguration;
|
||||
|
||||
namespace TwitterDashboard
|
||||
{
|
||||
[DataContract]
|
||||
class TwitterDashboard : Zombie, ITwitterDashboard
|
||||
{
|
||||
public TwitterDashboard()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void EntryPoint()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnNext(AnalyticsResultString next)
|
||||
{
|
||||
Console.WriteLine("{0}", next.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int receivePort = 1001;
|
||||
int sendPort = 1000;
|
||||
|
||||
if (args.Length == 2)
|
||||
{
|
||||
receivePort = int.Parse(args[0]);
|
||||
sendPort = int.Parse(args[1]);
|
||||
}
|
||||
|
||||
Console.WriteLine("Pausing execution. Press enter to deploy and continue.");
|
||||
Console.ReadLine();
|
||||
|
||||
var myClient = new TwitterDashboard();
|
||||
|
||||
using (var c = FranklinFactory.Deploy<ITwitterDashboard>(DashboardServiceName, myClient, receivePort, sendPort))
|
||||
{
|
||||
// nothing to call on c, just doing this for calling Dispose.
|
||||
Console.WriteLine("Press enter to terminate program.");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
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("TwitterDashboard")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TwitterDashboard")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("635fbc57-8f95-40b6-92c0-66e7060e4686")]
|
||||
|
||||
// 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")]
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{635FBC57-8F95-40B6-92C0-66E7060E4686}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>TwitterDashboard</RootNamespace>
|
||||
<AssemblyName>TwitterDashboard</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<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' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<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|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Franklin\Franklin.csproj">
|
||||
<Project>{15423008-6afb-4d2b-844c-51a6c10d82e3}</Project>
|
||||
<Name>Franklin</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ServiceConfiguration\ServiceConfiguration.csproj">
|
||||
<Project>{1aa08a35-a6f6-4857-af3a-b3d375f02008}</Project>
|
||||
<Name>ServiceConfiguration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TwitterDashboardAPI\TwitterDashboardAPI.csproj">
|
||||
<Project>{94a07b70-d77e-46ac-8b30-41c20b8ff907}</Project>
|
||||
<Name>TwitterDashboardAPI</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TwitterObservable\TwitterObservable.csproj">
|
||||
<Project>{15bb3b74-3463-4d4f-8174-550890ca14ac}</Project>
|
||||
<Name>TwitterObservable</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,36 +0,0 @@
|
|||
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("TwitterHostAPI")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TwitterHostAPI")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("3962824f-9a7d-47af-ba9b-4a852ad7e8cc")]
|
||||
|
||||
// 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")]
|
|
@ -1,26 +0,0 @@
|
|||
using Microsoft.StreamProcessing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TwitterObservable;
|
||||
|
||||
namespace TwitterHostAPI
|
||||
{
|
||||
public interface ITwitterHostIDL
|
||||
{
|
||||
void OnNext();
|
||||
}
|
||||
|
||||
public interface ITwitterHost
|
||||
{
|
||||
void OnNext(StreamEvent<Tweet> next);
|
||||
}
|
||||
|
||||
public interface ITwitterHostProxy : ITwitterHost
|
||||
{
|
||||
Task OnNextAsync(StreamEvent<Tweet> next);
|
||||
void OnNextFork(StreamEvent<Tweet> next);
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{3962824F-9A7D-47AF-BA9B-4A852AD7E8CC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TwitterHostAPI</RootNamespace>
|
||||
<AssemblyName>TwitterHostAPI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.StreamProcessing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0695e91d4f0d7afa, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Trill.2018.1.26.2\lib\net45\Microsoft.StreamProcessing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.StreamProcessing.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0695e91d4f0d7afa, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Trill.2018.1.26.2\lib\net45\Microsoft.StreamProcessing.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.StreamProcessing.Serializer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0695e91d4f0d7afa, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Trill.2018.1.26.2\lib\net45\Microsoft.StreamProcessing.Serializer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TwitterHostAPI.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TwitterObservable\TwitterObservable.csproj">
|
||||
<Project>{15bb3b74-3463-4d4f-8174-550890ca14ac}</Project>
|
||||
<Name>TwitterObservable</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -17,7 +17,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="2.7.0" />
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>12.0.1</Version>
|
||||
<Version>11.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Reactive.Linq">
|
||||
<Version>4.1.2</Version>
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Configuration;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Reactive.Linq;
|
||||
using TwitterObservable;
|
||||
using Analytics;
|
||||
using static Ambrosia.ServiceConfiguration;
|
||||
using System.Threading;
|
||||
using Ambrosia;
|
||||
using Mono.Options;
|
||||
using Empty = Microsoft.StreamProcessing.Empty;
|
||||
|
||||
namespace TwitterHost
|
||||
{
|
||||
[DataContract]
|
||||
sealed class TwitterSubscription : Immortal
|
||||
{
|
||||
[DataMember]
|
||||
IAnalyticsProxy _resilientTwitterProxy;
|
||||
|
||||
public TwitterSubscription()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// read settings from configuration file
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static TwitterConfig ReadTwitterInputConfig()
|
||||
{
|
||||
return new TwitterConfig
|
||||
{
|
||||
// Put your keys and secrets here
|
||||
oauth_consumer_key = "",
|
||||
oauth_consumer_secret = "",
|
||||
oauth_token = "",
|
||||
oauth_token_secret = "",
|
||||
twitter_keywords = "Office Microsoft,Surface Microsoft,Phone Window,Windows 8,SQL Server,SharePoint,Bing,Skype,XBox,System Center,Microsoft,msftluv"
|
||||
};
|
||||
}
|
||||
|
||||
protected override async Task<bool> OnFirstStart()
|
||||
{
|
||||
// Read Twitter auth information and topics of interest from App.config
|
||||
var twitterConfig = ReadTwitterInputConfig();
|
||||
|
||||
// Create an observable of tweets with sentiment
|
||||
var inputObservable = TwitterStream.Create(twitterConfig);
|
||||
|
||||
_resilientTwitterProxy = GetProxy<IAnalyticsProxy>(AnalyticsServiceName);
|
||||
inputObservable.ForEachAsync(
|
||||
x =>
|
||||
{
|
||||
if (x.IsData)
|
||||
{
|
||||
Console.WriteLine("{0}", x.ToString());
|
||||
_resilientTwitterProxy.OnNextFork(x);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
private static int _receivePort = -1;
|
||||
private static int _sendPort = -1;
|
||||
private static string _serviceName = SubscriptionServiceName;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
ParseAndValidateOptions(args);
|
||||
|
||||
//Console.WriteLine("Pausing execution. Press enter to deploy and continue.");
|
||||
//Console.ReadLine();
|
||||
|
||||
var myClient = new TwitterSubscription();
|
||||
|
||||
// Use "Empty" as the type parameter because this container doesn't run a service that responds to any RPC calls.
|
||||
using (var c = AmbrosiaFactory.Deploy<Empty>(_serviceName, myClient, _receivePort, _sendPort))
|
||||
{
|
||||
// nothing to call on c, just doing this for calling Dispose.
|
||||
//Console.WriteLine("Press enter to terminate program.");
|
||||
//Console.ReadLine();
|
||||
Thread.Sleep(TimeSpan.FromDays(10));
|
||||
}
|
||||
}
|
||||
|
||||
private static void ParseAndValidateOptions(string[] args)
|
||||
{
|
||||
var options = ParseOptions(args, out var shouldShowHelp);
|
||||
ValidateOptions(options, shouldShowHelp);
|
||||
}
|
||||
|
||||
private static OptionSet ParseOptions(string[] args, out bool shouldShowHelp)
|
||||
{
|
||||
var showHelp = false;
|
||||
var options = new OptionSet {
|
||||
{ "rp|recievePort=", "The service recieve from port [REQUIRED].", rp => _receivePort = int.Parse(rp) },
|
||||
{ "sp|sendPort=", "The service send to port. [REQUIRED]", sp => _sendPort = int.Parse(sp) },
|
||||
{ "n|serviceName=", "The service name.", n => _serviceName = n },
|
||||
{ "h|help", "show this message and exit", h => showHelp = h != null },
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
options.Parse(args);
|
||||
}
|
||||
catch (OptionException e)
|
||||
{
|
||||
Console.WriteLine("Invalid arguments: " + e.Message);
|
||||
ShowHelp(options);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
shouldShowHelp = showHelp;
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
private static void ValidateOptions(OptionSet options, bool shouldShowHelp)
|
||||
{
|
||||
var errorMessage = string.Empty;
|
||||
if (_sendPort == -1) errorMessage += "Send port is required.\n";
|
||||
if (_receivePort == -1) errorMessage += "Recieve port is required.\n";
|
||||
|
||||
if (errorMessage != string.Empty)
|
||||
{
|
||||
Console.WriteLine(errorMessage);
|
||||
ShowHelp(options);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
if (shouldShowHelp) ShowHelp(options);
|
||||
}
|
||||
|
||||
private static void ShowHelp(OptionSet options)
|
||||
{
|
||||
var name = typeof(Program).Assembly.GetName().Name;
|
||||
#if NETCORE
|
||||
Console.WriteLine($"Usage: dotnet {name}.dll [OPTIONS]\nOptions:");
|
||||
#else
|
||||
Console.WriteLine($"Usage: {name}.exe [OPTIONS]\nOptions:");
|
||||
#endif
|
||||
options.WriteOptionDescriptions(Console.Out);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
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("TwitterHost")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
//[assembly: AssemblyConfiguration("")]
|
||||
//[assembly: AssemblyCompany("")]
|
||||
//[assembly: AssemblyProduct("TwitterHost")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("ce3a9d8d-c0a2-44a4-9572-0fac5fb6ce5e")]
|
||||
|
||||
// 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")]
|
|
@ -1,28 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net46</TargetFrameworks>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<Platforms>x64</Platforms>
|
||||
<RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<RootNamespace>TwitterSubscription</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^net\d'))">
|
||||
<DefineConstants>NETFRAMEWORK</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netstandard\d'))">
|
||||
<DefineConstants>NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('$(TargetFramework)', '^netcoreapp\d'))">
|
||||
<DefineConstants>NETCORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Reactive.Linq" Version="4.1.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GeneratedSourceFiles\AnalyticsAPIGeneratedNet46\latest\AnalyticsAPIGeneratedNet46.csproj" />
|
||||
<ProjectReference Include="..\ServiceConfiguration\ServiceConfiguration.csproj" />
|
||||
<ProjectReference Include="..\TwitterObservable\TwitterObservable.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче