F#: Azure Service Bus (Topic Subscription)

Azure Topic Listener namespace Notifications.DataGateway open System open System.Text open System.Diagnostics open System.Threading.Tasks open Azure.Messaging.ServiceBus open Newtonsoft.Json open Notifications.DataTransfer open Notifications.DataGateway type AzureTopicListener<'T>(subscriptionInfo:SubscriptionInfo) as x = let topic = subscriptionInfo.Topic let subscription = subscriptionInfo.Subscription let connectionString = subscriptionInfo.ConnectionString let requested = Event<_>() let mutable serviceBusClient : ServiceBusClient = null let mutable processor : ServiceBusProcessor = …

Review: Pro Auto Sound of Miami

Introduction I paid the owner, Luis, of “Pro Auto Sound of Miami”, nearly $2,728.34 (including tax) to enhance the sound quality of my vehicle’s existing 16 speaker, 1050 watts sound system. Prior to trusting the business, Pro Auto Sound of Miami, with my new vehicle, I spent several days researching custom car audio businesses and …

F#: Extract key value pairs from an app config file

The following snippet extracts key value pairs from the AppSettings section of an app config file: let appSettings = ConfigurationManager.AppSettings let serviceKeys = ConfigurationManager.AppSettings.AllKeys |> Seq.filter (fun k -> k.ToString().EndsWith "Fn") |> Seq.map (fun k -> (k,appSettings.GetValues(k).First())) <appSettings> <add key="MyAzureFn" value="some_value_1"/> <add key="MyOtherAzureFn" value="some_value_2"/> <add key="MyThirdAzureFn" value="some_value_3"/> </appSettings>

Deploying Azure SignalR

Update the upstream URL pattern so that it contains the SignalR extension key: The SignalR extension key can be found under App Keys: Appendix: using System.Threading.Tasks; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Azure.WebJobs.Extensions.SignalRService; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using static AzureSignalR.LocationReporting.Language; namespace AzureSignalR.Functions { public class LocationHub : ServerlessHub { const string NewMessageTarget = "newMessage"; …

Azure SignalR Client – Group connection

SignalR Client using Microsoft.AspNetCore.SignalR.Client; using static OrderRequest.Core; namespace SignalR.Support { public enum Connection { IsDisconnected, IsConnecting, IsConnected, } public class ClientSignalR { static ClientSignalR _clientSignalR; public static ClientSignalR Instance { get { if (_clientSignalR == null) { _clientSignalR = new ClientSignalR(); } return _clientSignalR; } } private ClientSignalR() { } public event Action<object> OnMessageReceived; HubConnection …

F# SQLProvider: In Action

Intro There's an F# library that provides an ORM experience that is arguably superior to Entity Framework. This library is the SqlProvider. Establishing Connection The following code establishes a connection to SQL Server: namespace DevOps.DataGateway open FSharp.Data.Sql module SqlConnection = //---------------------------------------------------------------------------------------------------- // UPDATE CONNECTION STRING !!! //---------------------------------------------------------------------------------------------------- [<Literal>] let string = "Data Source=MY_MACHINE_NAME\SqlExpress;Initial Catalog=DevOps;Integrated Security=True" …

Twilio Integration with F#

Intro I decided to document some Twilio integration details for a hobby project that I'm working on. Sms Module Here's the core module for sending an Sms via Twilio: namespace CourierPayroll.DataGateway open Twilio open Twilio.Types open Twilio.Rest.Api.V2010.Account open CourierPayroll.DataTransfer module Sms = let formattedNumber (toPhone:string) = let usaCode = "+1" let phoneWithPrefix = if toPhone.Chars …