Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

EventHubTrigger Poblems

$
0
0

Hello everyone,

after I followed the instructions on the following articles

https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function

 https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs

I have created an EventHubTrigger, which looks like this:

using System;

public static void Run(string myEventHubMessage, ILogger log)
{
log.LogInformation($'C# Event Hub trigger function processed a message: {myEventHubMessage}');
}


This did work without any problems, but since I do need additional meta information, I changed the code to the following (described in the second linked article):

#r 'Microsoft.ServiceBus'
using System.Text;
using System;
using Microsoft.ServiceBus.Messaging;

public static void Run(EventData myEventHubMessage, ILogger log)
{
log.LogInformation($'EnqueuedTimeUtc={myEventHubMessage.EnqueuedTimeUtc}');
log.LogInformation($'SequenceNumber={myEventHubMessage.SequenceNumber}');
log.LogInformation($'Offset={myEventHubMessage.Offset}');
} 


But this code results in the following error messages (btw I have also tied to use the deprected TraceWriter instead of ILogger to exactly follow the article but this results in the same error)

2018-10-11T14:22:24.814 [Error] run.csx(1,1): error CS0006: Metadata file 'Microsoft.ServiceBus' could not be found 2018-10-11T14:22:24.903 [Error] run.csx(4,17): error CS0234: The type or namespace name 'ServiceBus' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) 

My question is now, does anyone have a clue what to do in order to get this small piece of code running?

Of course it has to have something to do with the assemblies but the aricle states, that when working in the online portal-editor, there are no further steps to do,.

Man thanks in advance

Felix

PS:

host.json :

{

  "version": "2.0"

}

Content of extensions.csproj is:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>

    <TargetFramework>netstandard2.0</TargetFramework>

    <WarningsAsErrors />

  </PropertyGroup>

  <ItemGroup>

    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="3.0.0" />

    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="3.0.0" />

    <PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.0.1" />

 </ItemGroup>

</Project>


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>