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

Having created dispatcher classes for all of your individual traditional Synergy routines, you must create a 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 the generic code for the master dispatcher class looks like:
;;*****************************************************************************
;;
;; Title: MethodDispatcher.dbl
;;
;; Description: Declares dispatcher classes for exposed methods
;;
;;*****************************************************************************
import Harmony.TraditionalBridge
namespace TraditionalBridge.Dispatchers
public partial class MethodDispatcher extends RoutineDispatcher
public method MethodDispatcher
proc
;;Register routine dispatcher classes
endmethod
endclass
endnamespace
We recommend placing the master dispatcher class in the same folder and namespace as your routine dispatcher classes.
-
Right-click on the Dispatchers folder, select
Add > Class, and name the new fileMethodDispatcher.dbl. -
Replace the current code in the file with the sample scaffolding code shown above.
All that remains is to add a line of code to register all of your individual routine dispatcher classes with the environment.
-
Add the following code to the body of the
MethodDispatcherconstructor method:mDispatchStubs.Add("AddTwoNumbers", new AddTwoNumbersDispatcher()) mDispatchStubs.Add("GetEnvironment", new GetEnvironmentDispatcher()) mDispatchStubs.Add("GetLogicalName", new GetLogicalNameDispatcher()) -
Save the file
Your master dispatcher class should now look like this:
;;*****************************************************************************
;;
;; Title: MethodDispatcher.dbl
;;
;; Description: Declares dispatcher classes for exposed methods
;;
;;*****************************************************************************
import Harmony.TraditionalBridge
namespace TraditionalBridge.Dispatchers
public partial class MethodDispatcher extends RoutineDispatcher
public method MethodDispatcher
proc
;;Register routine dispatcher classes
mDispatchStubs.Add("AddTwoNumbers", new AddTwoNumbersDispatcher())
mDispatchStubs.Add("GetEnvironment", new GetEnvironmentDispatcher())
mDispatchStubs.Add("GetLogicalName", new GetLogicalNameDispatcher())
endmethod
endclass
endnamespace
Before we move on, let's make sure the project builds:
-
Right-click on the
TraditionalBridgeproject and selectBuild. -
Check the
Outputwindow and verify that the build was successful.1>------ Build started: Project: TraditionalBridge, Configuration: Debug x64 ------ ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
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