LibraryToggle FramesPrintFeedback

Joining a Fabric as a Managed Container

Overview

When a broker joins a fabric as a managed container, it stops being a broker because the default behavior of the fabric:join command is to wipe out the container's configuration and replace it with the fabric profile. To start up as broker, you need to ensure that the fabric has a profile with the proper configuration and associate it with the container. The fabric:join command's -p argument allows you to specify a profile to install into the container once the agent is installed.

Becoming a managed container

Several things happen when a broker joins a fabric as a managed container:

  1. The broker installs the required Fuse Fabric bundles to interact with the fabric's ensemble.

  2. The broker contacts the specified Fabric Server and initiates the joining process.

  3. The Fabric Server registers the container with the fabric's ensemble.

    This adds the container's information to the fabric's registry using the container name as the key. Because the container is a managed container, the registry creates an empty entry for the container and only includes the information it needs to manage the container.

    [Warning]Warning

    If the container being added to the fabric has the same name as a container already registered with the fabric, both containers will be reset and will always share the same configuration.

  4. The Fabric Server, as a delegate of the fabric's ensemble, takes control of the container.

    This process clears the container and resets its configuration to a default state.

  5. The ensemble installs the fabric profile into the container.

    This loads the Fabric Agent into the container to facilitate the management of the container.

    • If the -p argument is passed the fabric:join, the container's agent installs the artifacts and configuration settings from the specified profile.

    • The container sits empty and ready for you to associate one or more profiles with it.

  6. The agent monitors the container and the ensemble for changes.

    If the state of the container changes, the agent updates the ensemble's registry entry. If the ensemble has updates for the container, such as a new profile being associated with the container or a change to one of the profiles already associated with the container, the agent updates the container.

Remaining a message broker

Joining a fabric as a managed container converts a standalone broker into a vanilla fabric container. It can take on any characteristics that are required. If you want it to join the fabric and continue to function as a message broker, then you must ensure that the fabric being joined has a profile that will configure the container to be a message broker and assign that profile to the container.

The default set of profiles installed with Fuse Fabric include an mq profile that loads a default message broker. You can also create a new profile for your brokers as described in Editing a Broker's Configuration in a Fabric.

The easiest way to assign the profile is to do so when executing the fabric:join by using the -p flag. The specified profile will be assigned to the container as soon as the agent is installed. If you would rather do it in two steps, you can assign the profile using the fabric:container-change-profile command or Fuse Management Console.

Procedure

To join a broker to a fabric and have it start up as a broker:

  1. Create a profile for your broker.

    For details on creating a broker profile see Editing a Broker's Configuration in a Fabric.

  2. Get the URL for one of the Fabric Servers in the existing fabric.

    The URL of a Server has the following format:

    HostName:IPPort

    For example, given a fabric registry agent running on the host, myhost, the URL would be myhost:2181. The IP port, 2181, is the default IP port used by a Fabric Server and is usually the correct value to use. If you are in any doubt about which URL to use you can discover the URLs of the Fabric Servers as follows:

    1. Connect to the command console of one of the containers in the fabric.

    2. Enter the following sequence of console commands:

      FuseMQ:karaf@root> config:edit org.fusesource.fabric.zookeeper
      FuseMQ:karaf@root> config:proplist
         service.pid = org.fusesource.fabric.zookeeper
         zookeeper.url = myhostA:2181,myhostB:2181,myhostC:2181,myhostC:2182,myhostC:2183
         fabric.zookeeper.pid = org.fusesource.fabric.zookeeper
      FuseMQ:karaf@root> config:cancel

      The zookeeper.url property holds a comma-separated list of Fabric Server URLs. You can use any one of these URLs to join the fabric.

  3. Connect to the standalone broker's command console.

  4. Enter the following command:

    FuseMQ:karaf@root> fabric:join -p brokerProfile fabricURL brokerName

    You need to provide values for:

    • brokerProfile—the name of the profile you created in Step 1

    • fabricURL—the Fabric Server URL you obtained in Step 2

    • brokerName—the name the broker will use to register with the fabric

      [Important]Important

      The name should be unique among the containers in the fabric.

    For details on fabric:join see fabric:join in Console Reference.

Comments powered by Disqus