Skip to content

Developing a Custom Workflow Activity

Note: It is recommended that the Neuron process documentation be reviewed before running this sample. The documentation thoroughly describes each process component individually and describes how to configure each one as well as how to construct a process and associate it with a Neuron Publisher or Subscriber. See the Configuration Notes section at the end of this document for more information.

Overview

Writing a custom workflow activity for Neuron is common and contains the same steps you use to create a custom activity for any Microsoft Workflow (WF) host application. The only difference is where you deploy the activity assembly so that it will appear in the Neuron ESB Explorer’s Workflow Toolbox.

This sample includes a custom workflow activity that generates lorem ipsum text that can be used when creating workflows.

Note: Review the code in the Visual Studio project opened with this sample. It contains comments that will assist you in custom activity development.

Running the Sample

Open the Sample

To open this sample, see the topic Using the Neuron Samples and select the Developing a Custom Workflow Activity sample.

Note: This sample does not open a Neuron ESB Configuration. It only opens a Visual Studio project.

Configure the Sample

When launching this sample from the Samples Explorer, a Visual Studio project is opened. The references in this project need to be verified and the project needs to be built.

  1. In Visual Studio, expand the References list in the Solution Explorer.
  2. The project should be referencing the following assemblies:
  1. Compile the project.
  2. Copy the compiled project files (SampleDataActivityLibrary.dll and SampleDataActivityLibrary.pdb) to the Workflows folder of the Neuron program files installation directory (C:\Program Files\Neudesic\Neuron ESB v3\DEFAULT\Workflows).
Note: If the project has dependent assemblies, copy them to the Workflows folder as well.

Create a new Neuron Configuration

  1. If Neuron ESB Explorer is already opened, close it and re-open it and create a new Neuron Configuration (for this sample you do not need to configure a topic, publish or subscriber). You will not be able to see the custom workflow activity in the toolbox until you close and re-open the ESB Explorer.
  2. Click on the Processes section in the left navigation pane.
  1. From the new button dropdown, select Create Workflow
  1. Select Normal Workflow and click the Create Workflow button:
  1. You will see a new tab that contains the workflow designer with the toolbox on the right side.
  2. In the search filter on the Toolbox tab type “lor” and then scroll in the toolbox until you find the LoremIpsum activity:
  1. When you drag this activity onto the Workflow Designer, it will appear as a single activity and the properties will show in the Property Grid:
  1. Add a WriteLine activity just below the LoremIpsum activity and both activities will be automatically wrapped in a Sequence activity. The WriteLine activity is found in the Primitives category.
  1. Select the Sequence activity and then the Variables tab at the bottom and click on Create Variable to create a new variable called text of type String. In the WriteLine activity Text expression, set the expression to the variable named text.
  1. Now select the LoremIpsum activity and set its properties as shows in the next image. Remember to set the Result property to the text variable:
  1. Test the workflow by clicking the Test Workflow button . In the Edit Test Message dialog, leave the default values and click the OK button.
  2. The lorem ipsum text generated will be written to the Output window:
  1. Save the workflow by clicking the Apply button on the toolbar.

Debug a Custom Activity

When you copy the .pdb file into the Workflows folder along with the custom activity assembly then you are able to debug the activity.

  1. If it’s not already open, open Neuron ESB Explorer and open a workflow that has the LoremIpsum custom activity. Make sure you can successfully test the workflow.
  2. If it’s not already open, open the SampleDataActivityLibrary.sln in Visual Studio.
  3. In the LoremIpsum.cs file, add a breakpoint to the Execute method:
  1. From Visual Studio’s DEBUG menu, select Attach to Process and in the dialog select the running NeuronExplorer.exe process and then the Attach button:
  1. Test the workflow by clicking the Test Workflow button . In the Edit Test Message dialog, leave the default values and click the OK button.
  2. The breakpoint in Execute method will be hit.
Was this article helpful?
Dislike 0
Previous: Importing a Microsoft Workflow Sample
Next: Correlated Send/Receive Workflow