• Enterprise Service Bus libraries for .NET

    As a software application becomes larger, you may want to break it into separate parts, both to manage complexity but also to aid scalability. But if you break an application apart, how will the separate parts communicate? One approach is to employ messaging using a publish/subscribe (pub/sub) bus.

    A few years ago, I worked on an application that used NServiceBus just for this purpose, but I thought it would be useful to survey the .NET landscape to find out what’s available today.

    Here’s a summary of the libraries I’ll be looking at over the next few blog posts:

    Name URL Transports Minimum Framework License Dependencies
    NServiceBus v6 https://docs.particular.net/nservicebus Azure Service Bus, In-memory?, MSMQ, RabbitMQ, SQL Server 4.5.2 Commercial -
    MassTransit http://masstransit-project.com/ Azure Service Bus, In-memory, RabbitMQ 4.5(.2?) Apache 2.0 GreenPipes (>= 1.2.0)
    NewId (>= 3.0.1)
    Newtonsoft.Json (>= 10.0.3)
    Newtonsoft.Json.Bson (>= 1.0.1)
    NimbusAPI https://github.com/NimbusAPI/Nimbus Azure Service Bus 4.5 MIT Microsoft.WindowsAzure.ConfigurationManager (= 2.0.3)
    Nimbus.InfrastructureContracts (>= 2.0.0.98)
    Nimbus.MessageContracts (>= 2.0.0.98)
    WindowsAzure.ServiceBus (>= 2.1.3 && <= 2.1.4)
    Shuttle.Esb http://shuttle.github.io/shuttle-esb/ MSMQ, RabbitMQ, SQL Server 4.0? BSD 3 Shuttle.Core.Infrastructure (>= 8.0.6)
    Rebus https://github.com/rebus-org/Rebus Azure Service Bus, MSMQ, RabbitMQ 4.5 MIT Newtonsoft.Json (>= 9.0.1)

    These libraries range from the relatively simple and tightly focused to the complete ‘enterprise-level’ configurable, extensible and/or fully supported.

    Some of these libraries distinguish between an ‘event’ (notify subscribers that something has happened) and a ‘command’ (tell subscribers that they should perform an action). Some support long-running business processes, often known as ‘sagas’. Some support distributed transactions. Some use dependency injection and can integrate with an inversion-of-control container.

    And because the feature sets vary so widely, I’ll just be highlighting how each library implements publishing an ‘event’ message, and how you subscribe to these messages.

  • Conditionally format rows in Excel depending on date range

    Sometimes I get asked Excel questions. This is one of those times!

    Given a spreadsheet with rows that contain a start and finish date, format the rows in the past, present and future in different colours, so that it looks like this:

    Spreadsheet showing rows with different colours

    I initially tried using a formula with Excel’s Conditional Formatting feature. Despite this being the recommended solution in some search results, I just found it set the one format for all the rows – not what I wanted. This post by Joseph D’Emanuele put me on the right track.

    Here’s what I ended up doing:

    1. Add a new column next to your existing data Spreadsheet with extra Status column added
    2. In the first cell of this new column, insert the formula =IF(B2 < TODAY(), "Past", IF(A2 > TODAY(), "Future", "Current"))
    3. Copy this formula down to the remaining rows. eg. Spreadsheet with Status column populated
    4. Now select all the rows you want to format (for me that’s A2:D5)
    5. On the Home menu tab, select Conditional Formatting, then Manage Rules
    6. You will add 3 rules – one for each status.
    7. Click New Rule
    8. Select Use a formula to determine which cells to format
    9. In Format values where this formula is true, enter =INDIRECT("D" &ROW()) = "Future"
    10. Click Format and choose the desired formatting to apply for Future dates
    11. Click OK and repeat adding new rules for “Current” and “Past”
    12. You should end up with something like this: Excel's Conditional Formatting Rules Manager dialog box
    13. Click OK and you should have rows formatted different colours depending on whether the start/finish date is in the past, current or in the future!
    14. You can optionally choose to hide the Status row if you’d rather not see it all the time.

    Note that the formula in the conditional formatting (=INDIRECT("D" &ROW()) = "Future") is hard-coded to the column – “D” in my case. If you move data around, you’ll need to update this to refer to the new column letter.

  • On the NBN

    We switched over to the NBN at home a couple of months ago. Unfortunately since the last change of Government in Australia, it appears that all NBN rollouts are getting fibre to the node (FTTN) rather than original plan of fibre to the premises (FTTP). So with the node servicing our neighbourhood being a fair distance from our house, it looks like the best we can expect for the foreseeable future is ~40MB. That is a 4x increase on what we used to get with ADSL2+, but it is a shame we can’t get the full 100MB if we wanted to pay for it.

    40MB isn’t too bad – I know of others that are only getting 20 (and there’s stories of some that switch over from ADSL to get a slower speed than what they used to have). Just seems a lost opportunity that if everyone had got fibre, I’m sure that would be capable of being upgraded in the future to even beyond 100MB.