Create a Messaging server

The Messaging server is a discovery service which enables processes to locate each other. Processes register the ability to publish data or intent to subscribe to data with the messaging server. Publishing and subscribing is done on a per-channel basis. Without the Messaging server, the system would be less flexible and less resilient.

To create a Messaging server, right-click on dhtPackage and select New > Process Instance.

Screenshot

The New Process Instance dialog will appear. Enter the process instance name (dhtDMServer) and template into the dialog and click Add. As mentioned before, use dht as the prefix for all entities.

Screenshot

Complete the rest of the process details. All fields except those in Process Instance Parameters are common across all processes.

In the Instance Details, provide a description for the instance.

Screenshot

The Shutdown Alerts specifies what to do if the process shuts down either normally or unexpectedly. For the system, select No action for an expected shutdown, and Restart this instance for an unexpected shutdown as this will give us a basic level of resilience.

Screenshot

Do this for all processes.

The Reserved Parameters subtab contains the general process configuration. The only two values in here that must be set are Host and Port. To make the system portable, these can reference environment variables. Set host to the fully qualified domain name of the host you are using. Set port to ENV=DELTACONTROL_PORT=+1000. This will start the Messaging server on the Kx Control port + 1000.

Port numbers

Any port can be selected as long as it is available. The example of +1000 is just a guide for incrementing port values of the system to free ports (e.g. +1000, etc). Consequently, there is a chance that port +1000 will conflict. See below for how to troubleshoot this problem.

Screenshot

The Instance Parameters subtab contains the template-specific parameters. The DS_DMSERVER template contains only the initialStateFunct and should be left as it is.

Screenshot

Save the process instance by clicking the Save button on the right side of the process instance editor.

Test the process instance to make sure it runs. Click the Run button on the right side of the process instance editor pane. Alternatively, open the dhtPackage in the Process Library folders, right-click the process instance, and select Run.

Screenshot

Check in the Process Library Status viewer to see if the process is running. If the viewer has been closed, open it by selecting Tools > Viewers > Process Library Status from the main menu.

Screenshot

The viewer contains all of the process instances in the system. Narrow down the instances in the list by filtering the Instance column using the dht suffix.

Not running

In this example, the instance is not running because there is nothing in the Status column. Also, the host and port names are still environmental variables, rather than the actual IP address and port values.

Our process failed to start so now we will have to troubleshoot our instance.

Screenshot

If not already, open the dhtDMServer instance editor and select the History subtab.

Screenshot

Right-click on the first line of the log and select Show Partial Log.

Screenshot

A portion of the log file will appear. Scroll to the bottom of the log, here Control was unable to resolve the configuration parameter and tried to assign the port.

Screenshot

If there is a port conflict, go back to the Reserved Parameters subtab and change the port value, save the process instance and try starting the instance again. In the example below, the port value has been changed from +1000 to +2000 due to a port conflict, but can pick any free port.

Screenshot

Save the process instance using the Save button.

Start the process instance using the Run button.

Check the Process Library Status viewer.

Status has changed to running.

Screenshot

  • Once the message server process is working, we can add some more process instances. Before doing this, next create a parameter attribute for repeated use with each instance.

The message server process is working. Next, add some more process instances. Before doing this, create a parameter attribute for repeated use with each instance.