updated Anomaly Detector and Wind Turbine Data Generator samples for Preview 5
This commit is contained in:
Родитель
237ec5dc03
Коммит
5c1ee4c06b
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.0.0-preview.4" />
|
||||
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.0.0-preview.5" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Producer
|
|||
|
||||
private const string TransactionsDumpFile = "mocktransactions.csv";
|
||||
|
||||
private static EventHubClient eventHubClient;
|
||||
private static EventHubProducerClient producerClient;
|
||||
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
|
@ -27,13 +27,13 @@ namespace Producer
|
|||
|
||||
private static async Task<int> MainAsync(string[] args)
|
||||
{
|
||||
// create an Event Hubs client using the namespace connection string and the event hub name
|
||||
eventHubClient = new EventHubClient(EventHubConnectionString, EventHubName);
|
||||
// create an Event Hubs Producer client using the namespace connection string and the event hub name
|
||||
producerClient = new EventHubProducerClient(EventHubConnectionString, EventHubName);
|
||||
|
||||
// send messages to the event hub
|
||||
await SendMessagesToEventHubAsync(1000);
|
||||
|
||||
await eventHubClient.CloseAsync();
|
||||
await producerClient.CloseAsync();
|
||||
|
||||
Console.WriteLine("Press [enter] to exit.");
|
||||
Console.ReadLine();
|
||||
|
@ -58,9 +58,6 @@ namespace Producer
|
|||
TransactionsDumpFile,
|
||||
$"CreditCardId,Timestamp,Location,Amount,Type{Environment.NewLine}");
|
||||
|
||||
// create a producer object that you can use to produce or send messages to the event hub
|
||||
EventHubProducer producer = eventHubClient.CreateProducer();
|
||||
|
||||
foreach (var t in transactions)
|
||||
{
|
||||
try
|
||||
|
@ -92,7 +89,7 @@ namespace Producer
|
|||
var ed = new EventData(Encoding.UTF8.GetBytes(message));
|
||||
|
||||
// send the message to the event hub using the producer object
|
||||
await producer.SendAsync(ed);
|
||||
await producerClient.SendAsync(ed);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace WindTurbineDataGenerator
|
|||
internal class Program
|
||||
{
|
||||
private const string EventHubConnectionString =
|
||||
"[provide the EH connection string]";
|
||||
"<EVENT HUBS NAMESPACE CONNECTION STRING>";
|
||||
|
||||
private const string EventHubName = "[provide the EH name]";
|
||||
private const string EventHubName = "<EVENT HUB NAME>";
|
||||
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
|
@ -39,11 +39,8 @@ namespace WindTurbineDataGenerator
|
|||
{
|
||||
var random = new Random((int)DateTimeOffset.UtcNow.Ticks);
|
||||
|
||||
// create an Event Hubs client using the namespace connection string and the event hub name
|
||||
EventHubClient client = new EventHubClient(EventHubConnectionString, EventHubName);
|
||||
|
||||
// create a producer object to send messages to the event hub
|
||||
EventHubProducer producer = client.CreateProducer();
|
||||
// create an Event Hubs Producer client using the namespace connection string and the event hub name
|
||||
EventHubProducerClient producerClient = new EventHubProducerClient(EventHubConnectionString, EventHubName);
|
||||
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
|
@ -63,7 +60,7 @@ namespace WindTurbineDataGenerator
|
|||
Console.Write(".");
|
||||
|
||||
// send the message to the event hub
|
||||
await producer.SendAsync(devicesData);
|
||||
await producerClient.SendAsync(devicesData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Azure.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Azure.Core.1.0.0-preview.9\lib\netstandard2.0\Azure.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Azure.Core.1.0.0\lib\netstandard2.0\Azure.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Azure.Messaging.EventHubs, Version=5.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Azure.Messaging.EventHubs.5.0.0-preview.4\lib\netstandard2.0\Azure.Messaging.EventHubs.dll</HintPath>
|
||||
<HintPath>..\packages\Azure.Messaging.EventHubs.5.0.0-preview.5\lib\netstandard2.0\Azure.Messaging.EventHubs.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Azure.Amqp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Azure.Amqp.2.4.2\lib\net45\Microsoft.Azure.Amqp.dll</HintPath>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<HintPath>..\packages\Microsoft.Azure.EventHubs.1.0.2\lib\net451\Microsoft.Azure.EventHubs.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0-rc1.19456.4\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
|
@ -56,7 +56,7 @@
|
|||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.6.0-rc1.19456.4\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
|
@ -108,7 +108,7 @@
|
|||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Channels, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Channels.4.6.0-rc1.19456.4\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
|
||||
<HintPath>..\packages\System.Threading.Channels.4.6.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Azure.Core" version="1.0.0-preview.9" targetFramework="net461" />
|
||||
<package id="Azure.Messaging.EventHubs" version="5.0.0-preview.4" targetFramework="net461" />
|
||||
<package id="Azure.Core" version="1.0.0" targetFramework="net461" />
|
||||
<package id="Azure.Messaging.EventHubs" version="5.0.0-preview.5" targetFramework="net461" />
|
||||
<package id="Microsoft.Azure.Amqp" version="2.4.2" targetFramework="net461" />
|
||||
<package id="Microsoft.Azure.EventHubs" version="1.0.2" targetFramework="net461" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0-rc1.19456.4" targetFramework="net461" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
|
||||
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.6.0-rc1.19456.4" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Memory" version="4.5.3" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets" version="4.0.0" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets.Client" version="4.0.2" targetFramework="net461" />
|
||||
|
@ -19,6 +19,6 @@
|
|||
<package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="net461" />
|
||||
<package id="System.Threading.Channels" version="4.6.0-rc1.19456.4" targetFramework="net461" />
|
||||
<package id="System.Threading.Channels" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net461" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче