Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Red Hat Enterprise Linux, DNX, and Azure Service Bus

August 17, 2016
Andrew Male
Related topics:
Linux.NET
Related products:
Red Hat Enterprise Linux

Share:

    Service Bus is, according to Microsoft, “...a generic, cloud-based messaging system for connecting just about anything.” Most commonly used as an Azure service, it can be an excellent tool for managing non-critical workloads within an application and offers the benefit of being AMQP compatible when compared to Amazon’s SQS. Connecting to Service Bus (SB) on Windows is simple, but will the new .NET Core (DNX) platform be capable of the task?

    Library Adventures

    As of the writing of this post, Microsoft hasn’t yet released an updated version of its Azure Service Bus tools that is compatible with DNX. Thankfully, the AMQP compatibility makes it easy for libraries to be built that don’t depend on Microsoft.

    After a bit of searching, I was able to find just such a library, AzureSBLite, by Paolo Patierno (who unsurprisingly appears to be a member of the RedHat organization on GitHub). The library doesn’t explicitly state it is compatible with DNX, but I figured I’d give it a shot regardless.

    A bit of trial and error led me through the following missteps:

    • Had to make sure the https://api.nuget.org/v3/index.json NuGet feed was added to my ~/.nuget/NuGet/NuGet.Config feed list
    • Had to add the AmqpNetLite dependency to my project.json dependencies:
      • “AmqpNetLite”: { “version”: “1.1.9-rc” }

    Short and sweet, the library was compiling and ready for me to build code against.

    The Code

    I added a Program.cs file to the project and threw together my code. I won’t go through every single line, but there are certainly a few things to note:

    • SBConnStr, SBTopicName, and SBTopicSubscriptionName are values I copied directly from the Azure Service Bus management portal, available at: https://manage.windowsazure.com/ (at least while they work on moving it to the new portal)
      • In order to get a topic/subscription option for your SB queue, you’ll need to make sure you have upgraded your SB service to the Standard package instead of the Basic messaging tier
    • You’ll want to be sure you are copying the connection string with information specific to the access policy for your topic/subscription.
    • It seems the client and factory objects in the AzureSBLite library do not currently implement IDisposable; I will likely be submitting a pull request for this myself as I tend to prefer to leave cleanup to the IL compiler instead of trusting myself to call client.Close()
    • The subscription name is only relevant when you begin polling for messages on a topic, so no subscription name is supplied when pushing a message onto the queue.
    • I’ve added a limit to the number of times a queue is polled, but you will likely have different ways you’ll want to handle polling. (There are relevant details on this for pricing of the service, which can be found here.)
    • Don’t forget to mark your received messages as Complete. Not doing so will cause them to be continually consumed by all clients you have connected.

    In the end, the code was fairly straightforward to produce and the library worked perfectly once it was compiling.

    Conclusion

    I’m not sure whether or not Microsoft plans to release a version of the Azure tools for DNX, especially given how they have been supporting the AmqpNetLite project recently that powers AzureSBLite. The good news is that even if they don’t release one, libraries like these make it not only possible but also easy to consume Azure-hosted Service Bus messages anywhere that .NET Core will run.

    For additional information and articles on .NET Core visit our .NET Core web page for more on this topic.

    About Andrew Male

    Andrew Male (@AndyM84) is a senior engineer at an enterprise development company in Boston, MA. Andrew has been programming from a young age and is entirely self-taught; he has spent time in many corners of the programming world including game/VR work, agency work, and teaching development to students and adults alike. He spends most of his time working on architecture design and pursuing his favorite hobby—physics.

    Last updated: September 3, 2019

    Recent Posts

    • How to change the meaning of python and python3 on RHEL

    • vLLM or llama.cpp: Choosing the right LLM inference engine for your use case

    • How to implement and monitor circuit breakers in OpenShift Service Mesh 3

    • Analysis of OpenShift node-system-admin-client lifespan

    • What's New in OpenShift GitOps 1.18

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue