-
Notifications
You must be signed in to change notification settings - Fork 14
Tutorial 04 06 Add Main Dispatcher Class

In addition to adding dispatcher classes for all your individual traditional Synergy routines, you must add the generated master dispatcher class that is responsible for registering your routine dispatcher classes with the Traditional Bridge library code, enabling them to be dispatched to as needed.
This is what generic code for the master dispatcher class looks like, where <interface_name> is the name of the SMC interface with the definitions for the traditional Synergy routines you are exposing:
;;*****************************************************************************
;;
;; Title: <interface_name>Dispatcher.dbl
;;
;; Description: Declares dispatcher classes for exposed methods
;;
;;*****************************************************************************
import Harmony.TraditionalBridge
import TraditionalBridge.Dispatchers.BridgeMethods
namespace TraditionalBridge.Dispatchers
public partial class BridgeMethodsDispatcher extends RoutineDispatcher
public method <interface_name>Dispatcher
proc
;;Declare dispatcher classes for the '<interface_name>' interface methods
mDispatchStubs.Add("<routine_name>", new <routine_name>_Dispatcher())
InitHook()
endmethod
endclass
endnamespace
We recommend placing the master dispatcher class in the same folder and namespace as your routine dispatcher classes.
-
In Solution Explorer, right-click the Dispatchers folder (
TraditionalBridge > Sources > Dispatchers) and selectAdd > Existing Itemfrom the context menu. -
In the Add Existing Item dialog, navigate to the Dispatchers folder, select
BridgeMethodsDispatcher.dbl, and then click Add. -
Open the
BridgeMethodsDispatcher.dblfile, which will look like this:
;;*****************************************************************************
;;
;; Title: BridgeMethodsDispatcher.dbl
;;
;; Description: Declares dispatcher classes for exposed methods
;;
;;*****************************************************************************
;; WARNING: GENERATED CODE!
;; This file was generated by CodeGen. Avoid editing the file if possible.
;; Any changes you make will be lost if the file is re-generated.
;;*****************************************************************************
import Harmony.TraditionalBridge
import TraditionalBridge.Dispatchers.BridgeMethods
namespace TraditionalBridge.Dispatchers
public partial class BridgeMethodsDispatcher extends RoutineDispatcher
public method BridgeMethodsDispatcher
proc
;;Declare dispatcher classes for the 'BridgeMethods' interface methods
mDispatchStubs.Add("AddTwoNumbers", new AddTwoNumbers_Dispatcher())
mDispatchStubs.Add("GetEnvironment", new GetEnvironment_Dispatcher())
mDispatchStubs.Add("GetLogicalName", new GetLogicalName_Dispatcher())
InitHook()
endmethod
endclass
endnamespace
Next topic: Add Traditional Bridge Host
-
Tutorial 2: Building a Service from Scratch
- Creating a Basic Solution
- Enabling OData Support
- Configuring Self Hosting
- Entity Collection Endpoints
- API Documentation
- Single Entity Endpoints
- OData Query Support
- Alternate Key Endpoints
- Expanding Relations
- Postman Tests
- Supporting CRUD Operations
- Adding a Primary Key Factory
- Adding Create Endpoints
- Adding Upsert Endpoints
- Adding Patch Endpoints
- Adding Delete Endpoints
-
Harmony Core CLI Tool
-
OData Aware Tools
-
Advanced Topics
- CLI Tool Customization
- Adapters
- API Versioning
- Authentication
- Authorization
- Collection Counts
- Customization File
- Custom Field Types
- Custom File Specs
- Custom Properties
- Customizing Generated Code
- Deploying to Linux
- Dynamic Call Protocol
- Environment Variables
- Field Security
- File I/O
- Improving AppSettings Processing
- Logging
- Optimistic Concurrency
- Multi-Tenancy
- Publishing in IIS
- Repeatable Unit Tests
- Stored Procedure Routing
- Suppressing OData Metadata
- Traditional Bridge
- Unit Testing
- EF Core Optimization
- Updating a Harmony Core Solution
- Updating to 3.1.90
- Creating a new Release
-
Background Information