Skip to content

Commit

Permalink
Updating the dependecies
Browse files Browse the repository at this point in the history
  • Loading branch information
Kees Schollaart committed Apr 14, 2018
1 parent 03b7d02 commit 15d87b3
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ public MqttTriggerBinding(ParameterInfo parameter, MqttConnection connection, To

public Task<ITriggerData> BindAsync(object value, ValueBindingContext context)
{
_logger.LogDebug("MqttTriggerBinding.BindAsync");

var valueProvider = new ValueProvider(value);
return Task.FromResult<ITriggerData>(new TriggerData(valueProvider, _emptyBindingData));
}

public Task<IListener> CreateListenerAsync(ListenerFactoryContext context)
{
_logger.LogDebug("MqttTriggerBinding.CreateListenerAsync");

if (context == null)
{
throw new ArgumentNullException(nameof(context));
}

return Task.FromResult<IListener>(new MqttListener(_connection, _topics, context.Executor, _logger));
var listener = new MqttListener(_connection, _topics, context.Executor, _logger);

_logger.LogDebug("Listener for MqttTriggerBinding created");

return Task.FromResult<IListener>(listener);
}

public ParameterDescriptor ToParameterDescriptor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
<AssemblyName>CaseOnline.Azure.WebJobs.Extensions.Mqtt</AssemblyName>
<RootNamespace>CaseOnline.Azure.WebJobs.Extensions.Mqtt</RootNamespace>
<PackageId>CaseOnline.Azure.WebJobs.Extensions.Mqtt</PackageId>
<Description>This package contains the runtime assemblies for CaseOnline.Azure.WebJobs.Extensions.Mqtt. For more information, please visit https://github.com/keesschollaart81/CaseOnline.Azure.WebJobs.Extensions.Mqtt.</Description>
<Description>
This package enables you to:

* Trigger an Azure Function based on a MQTT Subscription
* Publish a message to a MQTT topic as a result of an Azure Function.

For more information, please visit https://github.com/keesschollaart81/CaseOnline.Azure.WebJobs.Extensions.Mqtt.</Description>
<PackageIconUrl>https://raw.githubusercontent.com/keesschollaart81/CaseOnline.Azure.WebJobs.Extensions.Mqtt/master/logo.png</PackageIconUrl>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>analyzers.ruleset</CodeAnalysisRuleSet>
Expand All @@ -37,6 +43,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta5" />
<PackageReference Include="MQTTnet" Version="2.7.1" />
<PackageReference Include="MQTTnet" Version="2.7.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public MqttConnection(IMqttClientFactory mqttClientFactory, MqttConfiguration co
/// </summary> ;
public override string ToString()
{
return $"Connection for config: {_config.ToString()}, connected: {Connected}";
return $"Connection for config: {_config.ToString()}, currently connected: {Connected}";
}

/// <summary>
Expand Down Expand Up @@ -88,22 +88,22 @@ private void ManagedMqttClientApplicationMessageProcessed(object sender, Applica
{
if (e.HasFailed)
{
_logger.LogError($"Message could not be processed for {this}, message: {e.Exception?.Message}", e.Exception);
_logger.LogError($"Message could not be processed for {this}, message: '{e.Exception?.Message}'", e.Exception);
}
}

private void ManagedMqttClientDisconnected(object sender, MqttClientDisconnectedEventArgs e)
{
Connected = false;
Connecting = false;
_logger.LogWarning($"MqttConnection Disconnected, previous connectivity state '{e.ClientWasConnected}' for {this}, message: {e.Exception?.Message}", e.Exception);
_logger.LogWarning($"MqttConnection Disconnected, previous connectivity state '{e.ClientWasConnected}' for {this}, message: '{e.Exception?.Message}'", e.Exception);
}

private void ManagedMqttClientConnected(object sender, MqttClientConnectedEventArgs e)
{
Connected = true;
Connecting = false;
_logger.LogInformation($"MqttConnection Connected, IsSessionPresent: '{e.IsSessionPresent}' for {this}");
_logger.LogInformation($"MqttConnection Connected for {this}");
}

private void ManagedMqttClientApplicationMessageReceived(object sender, MqttApplicationMessageReceivedEventArgs mqttApplicationMessageReceivedEventArgs)
Expand Down
4 changes: 2 additions & 2 deletions src/ExampleFunctions/ExampleFunctions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.12" />
<PackageReference Include="MQTTnet" Version="2.7.1" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.13" />
<PackageReference Include="MQTTnet" Version="2.7.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CaseOnline.Azure.WebJobs.Extensions.Mqtt\CaseOnline.Azure.WebJobs.Extensions.Mqtt.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
<ItemGroup>
<PackageReference Include="AsyncEnumerator" Version="2.1.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.0-beta5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="Moq" Version="4.7.145" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="Moq" Version="4.8.2" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@ public void Warning<TSource>(string message, params object[] parameters)
{
Logger.LogWarning(message, parameters);
}

public void Verbose<TSource>(string message, params object[] parameters)
{
Logger.LogTrace(message, parameters);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private async Task StartMqttServer()
MqttTcpChannel.CustomCertificateValidationCallback = RemoteValidation;
var logger = new MqttLogger(_logger);
var factory = new MqttFactory();
_mqttServer = factory.CreateMqttServer(new List<IMqttServerAdapter> { new MqttServerAdapter(logger) }, logger);
_mqttServer = factory.CreateMqttServer(new List<IMqttServerAdapter> { new MqttTcpServerAdapter(logger) }, logger);
_mqttServer.Started += Started;
_mqttServer.ClientConnected += ClientConnected;
_mqttServer.ClientDisconnected += ClientDisconnected;
Expand Down

0 comments on commit 15d87b3

Please sign in to comment.