Mavnn's blog

Stuff from my brain

Representing EasyNetQ Message Subscriptions as Blocking Queues

EasyNetQ (https://github.com/mikehadlow/EasyNetQ) is a simple wrapper for RabbitMq that allows you to trivially send and receive plain .net objects over the wire (as long as they can be serialized). It handles all the details of setting up exchanges and queues for you, and as long as your use case fits its (deliberately) simple pattern it’s very convenient.

Unfortunately, if you want to use it in a more functional landscape (*cough* from F# *cough*), the fact that it exposes subscriptions via registering a callback is not the ideal interface. In these situations, it’s much easier to handle (and reason about) a lazy infinite sequence of messages that you can then handle however you want, including in the simplest case just sitting on the sequence in a small tail call recursive function.
So EasyFQ was born. Weighing in at a mighty 16 lines of F# code, it contains one function: SeqSubscibe<’a> : (IBus -> string -> seq<’a>).
There’s a .fsx with example usage in the GitHub repository: https://github.com/michael-newton-15below/EasyFQ
I suppose the next step is to pester Mike into making it a Nuget package under the EasyNetQ umbrella…

 

Teaching Good Programming Style

So, I have several people from technical/mathematical backgrounds who are interested in learning more about programming, specifically with .net in some cases.

Tooling is easy; Visual Studio Express, Monodevelop and Sharp Develop are all freely available.

The question is, where would you start people off in terms of learning good, solid (see what I did there?) coding practices? Give them small projects and critique? Are there good open source projects for starters to get involved with?

Given the intelligence and background of these people, teaching them syntax is the least of my worries: a basic tutorial and Project Euler will have them writing code that works in no time. Most of them even have 'toy project' level skills in other programming languages. It's helping them learn how to build projects that work without falling into all the classic pitfalls of spaghetti code, or at least helping them climb out as quickly as possible.

The thing that springs to mind (given there is several people) is to find a real world project that could be split into several 'trivial' pieces that would need to communicate with each other; immediate opportunities to teach things like messaging, modularization and IoC (especially with some not very strict TDD built in). After the tutorial/Project Euler stage above, obviously.

Suggestions? Other ideas?

Stress Testing EasyNetQ Services With F#

Having recently moved one of our (http://15below.com) infrastructure services from using MSMQs to RabbitMq (via using EasyNetQ: https://github.com/mikehadlow/EasyNetQ), I then wanted to run it through some simple stress tests. One of the reasons for this is that the old service used to time out on messages regularly, leaving them in a dead letter queue and requiring us to write the 'DeadLetterProcessor' (a complete service in it's own right) to deal with the time outs.

74 lines of F# later, I was hitting the service with 40,000 requests spread across 4 parallel processes.

And the results: 18 seconds to process the lot, with no time outs or losses. Requests were going in faster than the service could process them, but Rabbit was admirably handling that side of things, and with the new setup multiple copies of the service would automatically round robin requests if that was ever needed.

Adious, DeadLetterProcessor: it was nice deleting you…

GPL Munitions

Awesome discussion on the finer points of whether having a Linux based cruise missile launched at you entitles you to a copy of the source code running on it.

And whether commando raids are a valid form of delivery…

'US Navy buys Linux to guide drone fleet (The Register) [LWN.net]'

http://lwn.net/Articles/501536/

More Progress

I mean, a table and everything. We're talking real civilization.

More progress

Untitled

Untitled

Good stuff for furniture building. And not as dramatic as the picture suggests!

Boxes, Boxes Everywhere…

…and not a drop to drink. Note to self: dehydrating yourself moving house is stupid and best avoided!

Pictures of boxes at both ends (and the van).

Boxes, boxes everywhere...