Quick Start Guide
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Quick Start Guide

The WSO2 Governance Registry (G-Reg) is an SOA-integrated registry-repository for storing and managing data or metadata related to services and other artifacts. It consists of two Web-based interfaces: the G-Reg Publisher and G-Reg Store. The  Publisher is used to create and manage assets, while the  Store is used  to search for and subscribe to assets.

Let's take a look at the basic use cases of the G-Reg using a sample scenario. 

Introducing the sample

BuyMore is a fictitious supermarket chain with more than 200 retail branches. Given below is a snapshot of the existing services of BuyMore with their lifecycle states:

Service

Version

Description

Current Lifecycle State

Service

Version

Description

Current Lifecycle State

BuyMoreBillCalculateRESTAPI

1.0.0

This is a Swagger-based REST service. It takes the item values, adds the tax rates, and gives out the total item value. BuyMore plans to discontinue this service after implementing a new loyalty scheme.

PRODUCTION

BuyMoreBillCalculateRESTAPI

2.0.0

This is a Swagger-based REST service that implements version 2 of BuyMoreBillCalculateRESTAPI. BuyMore has developed version 2 to implement their new loyalty scheme.

TESTING

Let's go through the main features of WSO2 G-Reg using BuyMore's services as an example.

Before you begin:

  1. Install Oracle Java SE Development Kit (JDK) version 1.6.24 or later or 1.7.* and set the JAVA_HOME environment variable.

  2. Download WSO2 Governance Registry to any location of your server. We call it <G-REG_HOME>.

  3. Start the G-Reg server by navigating to the <G-REG_HOME>/bin/ directory using the command line and executing wso2server.bat (for Windows) or  wso2server.sh (for Linux). 

Deploying the sample to create assets

Assets are registry resources or collections of resources that store metadata and information regarding governance-related entities. Developers create assets and manage their life cycles and dependencies using the G-Reg Publisher.

For the sake of simplicity, instead of creating assets from scratch using the G-Reg Publisher, let's deploy a sample that comes with the WSO2 G-Reg distribution. It creates different types of assets in the G-Reg. WSO2 G-Reg supports REST, JSON, SOAP, and Thrift, although we only work with REST services in this guide.

For information on creating assets from scratch through the G-Reg Publisher, see Adding and Deleting Assets.

  1. Make sure you have the G-Reg server started as instructed in the "Before you begin" tip above.

  2. Using the command line or terminal, navigate to the <G-REG_HOME>/samples/getting_started/ directory and execute the following command. It deploys the assets in the server: 

    ant

    Let's log in to the G-Reg Store and check whether the assets were created successfully.

  3. Go to the G-Reg Store using the URL https://localhost:9443/store/.

  4. Type "buymore" in the search field, click the search icon, and note that no search results appear. This is because all assets related to BuyMore are made private and are not visible to anonymous users.

  5. Let's log in to the G-Reg Store. Click the Sign In link in the top right-hand corner of the console and enter admin/admin as the credentials in the login screen.

  6. Note that searching for "buymore" now produces results in the Store.

You now have sample services and other artifacts related to BuyMore along with two users (a developer called Smith and a DevOps engineer called Mark ) deployed in the G-Reg. Next, let's log in to the G-Reg Store as Smith and subscribe to an asset. 

Subscribing to an asset

Smith is a developer at BuyMore. Smith comes to the G-Reg Store searching for the asset BuyMoreBillCalculateRESTAPI version 1.0.0 to calculate bill values of the products being purchased at BuyMore, and subscribes to it to receive notifications regarding any changes that happen to the asset later. 

  1. Log in to the G-Reg Store (https://localhost:9443/store/) as Smith. Smith's credentials are smith/smith@bm.

  2. Click Rest Services in the left menu.

    select rest services in the left menu
    select rest services in the left menu


    Notice that many services are shown in the search results. Smith knows that the service he wants (i.e., BuyMoreBillCalculateRESTAPI version 1.0.0) is owned by the Think Tank team in Boston and is hosted by the Vancouver data center, so he filters the search by those criteria to make sure he finds the right one.

  3. Expand the Teams filter in the Filter by menu, expand the Boston menu, and click the icon with the plus sign next to Think Tank to select it.

    select the team filter
    select the team filter
  4. Expand the DataCenters filter in the Filter by menu, and click the icon with the plus sign next to Vancouver to select it.

    select the data center
    select the data center
  5. Search for the asset by typing "name:BuyMoreBillCalculateRESTAPI" in the search field and clicking the search icon.



  6. The service BuyMoreBillCalculateRESTAPI version 1.0.0 appears in the search results. Click it to open it.

  7. The asset opens. Scroll down to see the following links:

    • Visualize: Opens a Swagger console where you can invoke the REST asset.

    • Show Dependencies: Opens a diagram displaying all the dependencies this asset has with other assets.

    • Copy URL: Gives you the option to copy the URL of the Swagger definition.

    • Download: Downloads the Swagger definition of the REST asset to a given location on your machine.

    view options of an asset
    view options of an asset

    Smith has now discovered the REST asset that can be called from other applications to calculate bill values.  Next, Smith subscribes to receive  notifications for this asset. A notification is an alert that you get via email and/or the G-Reg Store regarding an asset's lifecycle and/or information change. 

  8. Click the ->OPTIONS button in the top right-hand corner of the screen to expand the notification settings.


    You can subscribe to receive notifications through emails or through the G-Reg Store. You can also opt to receive notifications when an asset is changed and/or when it goes through a lifecycle state change. 

  9. Enable the option to receive notifications related to lifecycle state changes via the G-Reg Store.

Smith (developer) is now using BuyMoreBillCalculateRESTAPI version 1 for development work. 

Changing the lifecycle states of assets

BuyMore wants to introduce BuyMoreBillCalculateRESTAPI version 2, which implements the company's new loyalty scheme. As its testing is completed, BuyMore wants developers to use the new version of the asset in their applications. Mark , who is a DevOps engineer of BuyMore, logs in to the G -Reg Publisher and changes the lifecycle state of BuyMoreBillCalculateRESTAPI version 2 from TESTING to PRODUCTION

  1. Log in to the G-Reg Publisher ( https://localhost:9443/publisher/ ) as Mark. Mark's credentials are mark/ mark@bm.

  2. Use the following text to search for the service to be promoted to production, and then click the asset to open it.
    name:BuyMoreBillCalculateRESTAPI version:2.0.0

  3. Once the asset opens in the Publisher, go to its LIFECYCLE tab, add a comment to explain why you are changing its lifecycle state, and then click   Promote

  4. Note that the lifecycle state of the service is changed from TESTING to PRODUCTION, and the comment you added appears under history. Any user who goes to the  LIFECYCLE  tab of this service can see the comments history.


    Now that a new version of the asset is in production, Mark deprecates the older version (i.e., version 1). This triggers an alert to Smith, who is subscribed to it to receive notifications.

  5. Click the GOVERNANCE CENTER - PUBLISHER label at the top of the console to go to the publisher's Homepage, search for the term "BuyMoreBillCalculateRESTAPI", and click version 1.0.0 of the asset to open it.  

  6. Once the asset is opened, go to its LIFECYCLE tab and click Deprecate.

  7. Note that the lifecycle state of the asset is updated successfully.

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.