Deploying and registering Custom Service Brokers

Once you have created (or downloaded) a Service Broker .dll, you need to register it with the K2 environment. The first step is to copy the service broker dll to the ServiceBroker directory on all the physical K2 servers. (By default, this directory is %PROGRAMFILES%\K2\ServiceBroker). It may be necessary to restart the K2 Server service before you can copy the .dll, since it may be in-use by the service. You should also copy the .dll to all K2 servers since the Service Broker assembly will not be automatically deployed to all servers in all your K2 environments.

Once the assembly has been copied to all the K2 servers, use K2 Management to register the Service Broker as a Service Type in the K2 environment. For more information see the Service Types topic in the K2 User Guide.

Once the Service Type has been registered, you can create a Service Instance for the new Service Type. As part of the Service Instance registration task, you may need to provide various configuration settings that the Broker requires, and specify the Authentication Mode that the Service Instance will use.

Once the Service Instance has been registered, you should see a list of Service Objects, and then you can start creating SmartObjects for the Service Objects using the SmartObject design tool of your choice.

Follow these steps to register a new Service Type in your K2 environment.

In a multi-server Farm environment, ensure that the underlying assembly (and dependencies) have been copied to each physical K2 server before you register a Service Type. While you only need to register a Service Type with a K2 environment once, the actual assembly and its dependencies must be copied to each physical K2 server in that environment.
  1. Click New in the Service Types section.
  2. The Configure Service Type page opens.
  3. Configure the Service Type. Configuration values are determined by the selected Service Type.
    The list of names are based on .NET Reflection, where K2 will iterate over assemblies in the ServiceBroker directory on the K2 server (default: "%ProgramFiles%\K2 \ServiceBroker") and return those assemblies that implement the necessary Service Broker/Type Interfaces
  4. Click OK

Updating a Service Broker

If you rebuild your custom Service Broker, you will need to copy the .dll file to the physical K2 servers again. It may be necessary to restart the K2 Server service before you can copy the .dll, since it may be in-use by the service.

If you have made changes to the Service's DescribeSchema() method or the Service Object Definitions, you should refresh the Service Instances for the Service Type to pick up these changes. If you have created SmartObjects for the Service Objects in the Service Instances, you may need to update the SmartObjects to handle the new or modified Properties and Methods.