Service Bus for Windows Server: A Primer

An Enterprise Service Bus (ESB) is a shared messaging layer that gives you a consistent, scalable and flexible means of coordinating across disparate, loosely-connected services to execute business processes. Over the years, Microsoft has developed several service bus technologies:

BizTalk: A messaging and workflow orchestration platform to build ESB behaviors and capabilities. The BizTalk ESB toolkit provides a set of guidelines, patterns and tools.

Windows Azure Service Bus (ASB): This provides the messaging infrastructure for applications that live in the cloud, in your data center, and crosses all devices and PCs.

Service Bus for Windows Server (SBWS):  SBWS is based on ASB and shares many of the same capabilities, such as queue, topic and subscription support.  A distinct design goal is to ensure symmetry between SBWS and ASB and allow for a single set of code to be leveraged across both deployment environments.

Installation

Unlike ASB, which runs in the cloud and requires no local software installation, SBWS runs on-premises and must be installed and configured on a Windows Server 2013 or Server 2008 R2 machine. (It can also be installed on Win7 or Win8 for individual developer usage.)  For message persistence, it requires SQL Server 2012 or 2008, which is different from file-based Microsoft Message Queues.

To install, you may start from a contextual link or from Web Platform Installer.  The contextual link is here. Here’s how to install with Web Platform Installer:

  1. Launch Web Platform Installer, and search for “Service Bus 1.0”
  2. Click Add for Service Bus 1.0.  We’ll install the Cumulative Update after this.
  3. Follow the steps. You may be prompted to install .NET 4.5 if it’s not already installed. Reboot the machine if directed to.
  4. Install the latest Service Bus 1.0 Cumulative Update. (As of 4/16/2013, Update 1 is available.)

Configuration

  1. In Windows All Programs, select “Service Bus Configuration”
  2. Under Create a New Farm, select “Using Default Settings”
  3. Follow the steps to enter SQL Server Name and Test Connection, Service Account UserID and Password, and Certificate Generation Key. Leave “Enable firewall rules on this computer” checked.
  4. Click the “Next” arrow to continue, and a installation summary page should be displayed. Click the button with a check icon to commit the configuration.
  5. Verify installation was successful and save a copy of the installation log using the “View Log” feature. This includes the Primary Symmetric Key and endpoint connection strings.
  6. In addition, go to the SQL instance you have chosen and verify that three databases have been created:
    • SbGatewayDatabase
    • SbManagementDB
    • SBMessageContainer01

Administration

PowerShell Cmdlets

PowerShell Cmdlets are used to manage SBWS and ASB.  Developers and system administrators should get familiar with these commands. The complete command reference is here.

Service Bus Explorer

To make it easy to manage the messages and namespaces via GUI, Microsoft created a desktop application called Service Bus Explorer. This is a very convenient tool for developers and system administrators alike. It works for both ASB and SBWS. I use it on a daily basis when developing service bus code.

Setup for Working with Service Bus Remotely

Client Certificate

Developers can work with a local service bus without certificates.  However, to connect to a service bus hosted remotely, the client machine should have the proper client certificates. The certificates must be exported from host machine. Follow the steps here. 

In the Local Computer Certificate console, simply import these two files into the Personal and Trusted Root Certification Authorities, respectively.

ManageUsers Setting

To create a queue or send messages hosted remotely, a client that accesses the service bus should also be part of the ManageUsers group in the farm namespace.  To get the current ManageUsers, run this cmdlet:

Get-SBNamespace -Name ServiceBusDefaultNamespace

To add users to the namespace, run this cmdlet:

Set-SBNamespace –Name ServiceBusDefaultNamespace –ManageUsers mydomain\username1,mydomain\username2

In my next post, we are going to dive into coding.

About Lei Zhong

Lei Zhong is a software engineer with over 12 years of non-stop development experience in Microsoft technologies. He has worked for top-notch consulting firms, start-ups and commercial software firms with clients from various industries. He enjoys working in both front end and middle tier, and never hesitates to dive into database for optimal performance. He always strives to deliver well-structured code that not only works in current release but is easy and flexible enough for maintenance and future enhancement needs. He is MCPD in Web development, MCTS in SharePoint configuration/development, Distributed application, and SQL Server.

  • juanjock

    Why the log in SBMessageContainer01 database grow a lot?

  • juanjock

    Why the log in SBMessageContainer01 database grow a lot?