Developing ORP extensions

All software for the ORP platform is written in C# using the .Net Core framework. ORP uses Azure functions to listen to process triggers. A template is available to start developing an Azure function. The template is hosted in the ORP GitHub repository.

The repository can be found here: https://github.com/wolfpackdcs/Templates

Another helpful repository is the example project. This repository contains a working example of a listener that creates a file for the Routigo platform. see: https://github.com/wolfpackdcs/Example

The first step in the development cycle is to create a project from templates. To be able to successfully build a project access to the Wolfpack Nuget repository is needed. Contact your account manager to get access to this Nuget repository.

For a complete walkthrough to install the templates see: https://wolfpack-dcs.atlassian.net/wiki/spaces/CS/pages/1085866005

Selecting a trigger

Customising a flow in ORP starts with selecting a trigger to act on. A complete list of triggers can be found here: https://wolfpack-dcs.atlassian.net/wiki/spaces/CS/pages/2221408356

For example: when adding functionality when an order is added to ORP the NEWORDER trigger can be used. When an order comes in the NEWORDER process trigger will be sent to the processmanager. If no NEWORDER processes are configured the trigger is discarded, if a NEWORDER process is configured the trigger will be handled and each task in the process will be run sequentially.

See process manager and event triggers for a complete overview: https://wolfpack-dcs.atlassian.net/wiki/spaces/CS/pages/2222293357

To understand the flow of a process see the example customisation page:

Acting on triggers

When acting on a trigger the function will need to be configured to listen to a specific topic and a specific subscription. This is the first thing that will need to be configured. In the below snippet the topic-name and the subscription name will need to be configured.

namespace TEST.Functions { public class ServiceBusFunction : FunctionBase { public ServiceBusFunction(IKernel kernel) : base(kernel) { } [FunctionName("DefaultListenerFunction")] public async Task Run([ServiceBusTrigger("topic-name", "subscription-name", Connection = "ServiceBusConnection")] Message msg, Binder binder) { Message result = await RunAsMessageHandlerProcessManagerTaskAsync<ASB_TaskMessage, MessageHandler>(msg, binder); } } }

When the topic and and the subscription are configured the function can receive messages and send response messages. The actual sending and receiving of messages is all handled by the function. No specific code is needed. The core of the Azure function is the line below:

Message result = await RunAsMessageHandlerProcessManagerTaskAsync<ASB_TaskMessage, MessageHandler>(msg, binder);

The RunAsMessageHandlerProcessManagerTaskAsync method will call the MessageHandler with the ASB_TaskMessage arguments. This MessageHandler will handle the message and if no exceptions are thrown send a success response back to the process manager. If no exception is thrown and the handler could not successfully handle the message the developer should throw an exception. This will make sure that the process manager will get an error response. If the process manager receives an error response the process tasks will not further be executed.

 

 

 

 

 

copyright wolfpack DCS b.v. 2020