C:\Users\Peter> All Windows developers are Console App stars!
For nearly a quarter of a century of Windows development, Console Applications are by far the most common type of application I've written. When we need to spin up a service client, test or demonstrate some small piece of code or functionality, one of the simplest and quickest ways is a Console App.
PowerShell is fast replacing many of the DevOps tasks that may have had me reaching for a Console App.
However, neither of these are easily shared. They also rely on the development environment and PC setup of the recipient.
Recently, I developed a Logic App that took service bus messages, pulled templates from Blob Storage, generated emails with attachments and posted them via O365.
When I was faced with the need to test the Logic App, my natural thought was of course spin up a quick Console App as a Service Bus client, to send test messages.
So I prepared myself for the usual ritual, which in this case would have been something like...
Open Visual Studio
New console app
NuGet for Service Bus
Browse to the SB blade and copy the connection string
Paste it into app.config
Write the code to pull the conn string from config and create a TopicClient
Load the JSON into a BrokeredMessage... and send!
This can take, at the very least, 15-30 minutes.
If I wanted a colleague or a client to test, it's not cool or safe to send someone an exe.
So you send the whole solution, which they build and run themselves.
Or I'd often copy the contents of the Program class, or just the Main method into an email.
That's assuming they even have Visual Studio installed.
But then I thought, here is a Logic App, there is a Send Message action. Surely it's quicker to...
5. Select, or make a connection to your Service Bus
6. Select the queue/topic
7. Add the JSON message and [optionally] any user properties.
In this case there is a property that the SB subscriber of my other Logic App uses, to filter the messages by.
8. Save and Run!
C:\Users\Peter> These steps took me under a minute!
I can now send a colleague the URL to the Logic App in the portal. Or at worst, just the ARM scripted resource.
They can tweak the parameters and try it themselves, from right there in the portal.
No more zipping and sending the whole Visual Studio solution!
No more emailing code snippets or installing NuGet libraries.
Not this time at least!
You can manually run the trigger for your Logic Apps as shown below (but if there's nothing to do, it won't run)
If you use a recurring trigger like above, you can disable your Logic App, when its not needed.
The cost of each run is shown
truly tiny, for a personal or even SME sized function.
This example costs two actions, as the trigger counts as well.
Console Apps have been around as long as I can remember. They are the first thing I'd always have thought to use...
Logic Apps have only been around since
, but they are already transforming my developer habits!
Obviously, I expect to be needing Console Apps for a very long time yet, but [thankfully] less and less so.
This just shows how that Utopian dream of "shared code" really is beginning to become a reality!